Rsync同步设置的一例
以下文档于2014-12-10更新
先在服务端操作
#wget http://pkgs.repoforge.org/rsync/rsync-3.0.9-2.el6.rfx.x86_64.rpm
#rpm –ivh rsync-3.0.9-2.el6.rfx.x86_64.rpm
#chkconfig rsync on
#service xinetd restart <如果提示没有此服务, yum –y install xinetd
#因为一般没有rsyncd.conf配置文件.手动建一个
#mkdir /etc/rsyncd
#touch /etc/rsyncd/rsyncd.conf
#ln –s /etc/rsyncd/rsyncd.conf /etc/rsyncd.conf
#vim /etc/rsyncd.conf
<以下为/etc/rsyncd/rsyncd.conf 文档>
[global]
uid = root
gid = root
use chroot = no
max connections = 4
strict modes = yes
port = 873
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
[backup]
path = /var/testrsync
comment = This is test
read only = no
write only = no
auth users = root
uid = root
gid = root
secrets file = /var/rsync.ps
list = no
截图如下:
#touch /var/rsync.ps
#echo “1qaz2wsx”>>/var/rsync.ps <这个是将root的密码保留至/var/rsync.ps中>
#chown root.root /var/rsync.ps
#chmod 400 /var/rsync.ps
<如果没有操作上面的那些步骤.会出现下面的错误的现象>
<下面创建下测试的文件,这个路径与/etc/rsyncd/rsyncd.conf 中的path一致>
#mkdir /var/testrsync
#touch /var/testrsync/aa.txt
#echo “hello”>>/var/testrsync/aa.txt
在另外的一台服务器上面也做下相关的操作.
# rsync -avzP --password-file=/var/rsync.ps root@192.168.1.182::backup /var/testrsync/