前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Rsync保持两服务器数据一致

Rsync保持两服务器数据一致

作者头像
三杯水Plus
发布2018-11-14 15:24:24
1.7K0
发布2018-11-14 15:24:24
举报
文章被收录于专栏:运维运维

 Rsync保持两服务器数据一致

上次数据通过NFS拷贝过去后,只是实验一下,还没有真正迁移,现在两边数据又有不一样的;这次准备用rhel本身的rsync服务保持数据同步

服务端配置 1,发现原系统已安装rsync,就直接利用 #rpm -qa | grep rsync rsync-2.5.7-5.3E #ls /etc/xinetd.d/rsync /etc/xinetd.d/rsync 2,主要是更改rsyncd.conf和 rsync这两个文件 #mkdir /etc/rsyncd #cd /etc/rsyncd #ls rsyncd.conf #主配置文件 rsyncd.motd #banner消息 rsyncd.secrets #里面的内容用户名:密码 3,#cat rsyncd.conf pid file = /var/run/rsyncd.pid port = 873 address = 服务器IP uid = root gid = root use chroot = yes read only = yes max connections = 5 motd file = /etc/rsyncd/rsyncd.motd log file = /var/log/rsync.log

[home] path = /home list = yes ignore errors auth users = root hosts allow = 客户端IP secrets file = /etc/rsyncd/rsyncd.secrets strict modes = yes [home2] path = /home2 list = yes ignore errors auth users = root hosts allow = 客户端IP secrets file = /etc/rsyncd/rsyncd.secrets strict modes = yes [home3] path = /home3 list = yes ignore errors auth users = root hosts allow = 客户端IP secrets file = /etc/rsyncd/rsyncd.secrets strict modes = yes [cvs] path = /cvs list = yes ignore errors auth users = root hosts allow = 客户端IP secrets file = /etc/rsyncd/rsyncd.secrets strict modes = yes # 4,#cat /etc/xinetd.d/rsync # default: off # description: The rsync server is a good addition to an ftp server, as it \ # allows crc checksumming etc. service rsync { disable = no #开 socket_type = stream wait = no user = root server = /usr/bin/rsync server_args = --daemon --config=/etc/rsyncd/rsyncd.conf #主配置文件的位置 log_on_failure += USERID } # service xinetd restart Stopping xinetd: [ OK ] Starting xinetd: [ OK ] # netstat -tulpn | grep :873 tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN 26323/xinetd

客户端配置 1,# rpm -qa | grep rsync rsync-3.0.6-4.el5_7.1 2,#直接用命令复制 rsync -avz --progress --delete root@服务端IP::home /home --password-file=/etc/rsyncd.secrets rsync -avz --progress --delete root@服务端IP::home2 /home2 --password-file=/etc/rsyncd.secrets rsync -avz --progress --delete root@服务端IP::home3 /home3 --password-file=/etc/rsyncd.secrets rsync -avz --progress --delete root@服务端IP::cvs /cvs --password-file=/etc/rsyncd.secrets 客户端的rsyncd.secrets文件里只要写上密码即可 其中-a 代表rlptgoD,其实就是保证目录及文件的权限,修改时间,属主,组等一致 --progress 查看进程 --delete 客户端内容和服务的一致,当服务端有删除时,客户端也要删除 另外由于strict modes 开了,rsyncd.secrets文件权限要设置成600

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2012-12-18 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档