本文共 1168 字,大约阅读时间需要 3 分钟。
实现方式:
源服务器 安装sersync 监控文件(inotify)的变动 调用rsync传输数据给目标服务器
目标服务器 启动rsync的服务
yum -y install rsync
vim /etc/rsyncd.conf#自行创建该配置文件
配置文件内容
(以下内容复制到刚创建的配置文件,看个人需求修改)uid = rootgid = rootuse chroot = no#设置允许登录的ip,这里没有限制IPhosts allow=*#设置最大连接数max connections = 3#设置启动rsync服务器的文件pid file = /var/run/rsyncd.pidlock file = /var/run/rsync.lock#同步模块[tp5shop] <-模块名称,自行填写#需要的文件及其文件夹路径path = /usr/local/nginx/html/tp5shop <-需要同步的本地目录#备注comment = tp5shop#只读关闭read only = false
/usr/bin/rsync --daemon
shell > wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/sersync/sersync2.5.4_64bit_binary_stable_final.tar.gzshell > mv sersync2.5.4_64bit_binary_stable_final.tar.gz /usr/local/shell > cd /usr/local/shell > tar xf sersync2.5.4_64bit_binary_stable_final.tar.gzshell > mv GNU-Linux-x86 sersync
shell > vim confxml.xml
#实际修改只用修改以下几段,其他看个人需求
shell > /usr/local/sersync/sersync2 -n 10 -d -o /usr/local/sersync/confxml.xmlshell > ps aux | grep sersync
-n 启用线程数量 -d daemon方式启动 -o 指定配置文件
第6行开始
转载地址:http://jbhx.baihongyu.com/