rsync同步配置

因为公司数据库比较重要,现在只有一台服务器,IP为:118.145.*.*暂称为server,公司一台虚拟机,IP为。192.168.0.100 ,暂称为rsync

1、安装服务器端:yum -y installxinetd
2、安装路径:/etc/xinetd.d/
3、启动路径: /etc/init.d/xinetdstart
4、配置文件:/etc/rsyncd.conf

在家里建立两台虚拟机,10为server,201为client ,可以实现同步
rsync同步配置
实现只同步2个目录中不同的部分。速相对快一些


网站服务器配置rsyncd,/etc/rsyncd.conf配置
[sitebackup]                               // name
path = /opt/sh                  // copied directory
use chroot = no
hosts allow = *
hosts deny = *
list = true
uid = nobody
gid = nobody
#log file = /var/log/rsyncd.log
#auth users = mysql
#secrets file = /etc/rsyncd.secrets

因为服务器的ssh端口改变了,不再是22了。所以本地机子链接时需要定义rsh
rsync -zvr --rsh='ssh -p622' root@IP:/opt/sh/ /Backup/
这样就可以把服务器端的/opt/sh/下的文件差异同步到本地
rsync --daemon 启动成功,netstat确认873有监听。

原文地址:https://www.cnblogs.com/94YY/p/3873489.html