服务器在线 - 服务器软件 - 网站地图 服务器在线,专注于服务器技术!

当前位置:主页 > 服务器系统 > CentOS > 正文

Centos6 使用rsync同步数据操作方法

时间:2018-06-30    来源:未知    投稿:admin    点击:

服务端:

安装服务:

yum install xinetd rsync -y

vi /etc/xinetd.d/rsync                                # 编辑配置文件,将disable = yes 改成no

 

vi /etc/rsyncd.conf                                # 编辑rsync配置文件:


  1. uid = root
  2. gid = root
  3. address = 58.218.92.1               #监听IP地址,填写本机IP
  4. port = 873 #使用的端口号
  5. hosts allow = 222.187.224.27 #允许访问rsync服务的IP地址
  6. hosts deny= * #拒绝所有其他
  7. IP timeout = 300 #超时时间
  8. use chroot = yes  #锁定允许访问的目录
  9. max connections = 5 
  10. pid file = /var/run/rsyncd.pid 
  11. lock file = /var/run/rsync.lock 
  12. log file = /var/log/rsyncd.log  #日志文件路径
  13. motd file = /etc/rsyncd.motd  #欢迎文件路径
  14. [turbomail] 
  15. path =/data/rsync                 
  16. comment = hello rsync
  17. red only = yes 
  18. list = yes 
  19. auth users = rsync
  20. secrets file =/etc/rsync.passwd 

创建欢迎文件:

echo "welcome to rsync" > /etc/rsync.motd

创建密码文件:

vi /etc/rsync.passwd


  1. rsync:passwdopendoor 

chmod 600 /etc/rsync.passwd

重启xinetd,并开机启动。

/etc/init.d/xinetd restart

chkconfig xinetd on

 

 

 

客户端:

echo "password123" > /root/rsync.passwd

chmod 600 /etc/rsync.passwd

rsync -avz rsync@58.218.92.1::rsync --password-file=/root/rsync.passwd /rsync

 

--bwlimit=300    #每秒传输k。

`date +"%Y%m%d"`  #以日期为文件夹

 

如果您的问题仍未解决,还可以加入服务器在线技术交流QQ群:8017413寻求帮助。


相关内容
最新热点内容