首页 » 澳门葡京官网 » Linux » CentOS下cwRsyncServer双机连续同步配置

澳门葡京官网

 

本次采用CentOS系统,如是Linux请自行到网上下载rsync的tar包进行编译安装。
 
服务器端配置(192.168.0.51):
yum安装rsync

[root@localhost /]# yum install rsync

查看是否安装成功

[root@localhost /]# rpm -qa rsync
rsync-3.0.6-9.el6.x86_64

编辑配置文件(默认是不存在的,直接vi,然后复制下面代码进去,修改对应的path路径即可)

[root@localhost /]# vi /etc/rsyncd.conf
use chroot = false
strict modes = false
read only = yes
list = no
hosts allow = *
max connections = 10
lock file = /var/run/rsyncd.lock
motd file = /var/run/rsyncd.motd
log file = /var/run/rsyncd.log
transfer logging = yes
uid = nobody
gid = nobody
# Module definitions
# Remember cygwin naming conventions : c:\work becomes /cygwin/c/work
#
[hmj]
path = /heminjie
read only = false
transfer logging = yes
ignore errors

启动服务

[root@localhost /]#/usr/bin/rsync --daemon

加入开机自启动代码

[root@localhost /]#echo "/usr/bin/rsync --daemon" >> /etc/rc.local

检查rsync是否已启动

[root@localhost /]# ps -ef | grep rsync
root 1571 1 0 11:59 ? 00:00:00 /usr/bin/rsync --daemon

停止服务

[root@localhost /]#kill 进程号

客户端配置(192.168.0.52):
安装rsync

[root@localhost /]# yum install rsync

同步服务器上的数据到/home/heminjie

[root@localhost /]# rsync -vzrtopg --progress 192.168.0.51::hmj /home/heminjie

设置crontab,让同步命令每隔1分钟执行一次

[root@localhost ~]# crontab -e
*/1 * * * * rsync -vzrtopg --progress 192.168.0.51::hmj /home/heminjie

原文链接:CentOS下cwRsyncServer双机连续同步配置,转载请注明来源!

0