目标:实现免密同步数据;
1、安装rsync包;
2、手工添加配置文件;
cat /etc/rsyncd.conf
# See rsyncd.conf man page for more options. # configuration example: pid file = /var/run/rsyncd.pid max connections = 5 exclude = lost+found/ motd file = /etc/rsyncd.motd log file = /var/log/rsyncd.log log format = %t %a %m %f %b timeout = 30 port=873 [rsynsc] uid = root gid = root use chroot = yes read only = yes path = /xxxxxxxx/path/ comment = welcome list=yes #auth users = test #secrets file = /etc/rsyncd.secrets
开启rsync服务
/usr/bin/rsync --daemon --config=/etc/rsyncd.conf
查看rsync服务是否正常运行
[root@localhost ]# netstat -an | grep 873 tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN tcp6 0 0 :::873 :::* LISTEN unix 3 [ ] STREAM CONNECTED 23873 /run/systemd/journal/stdout
同步方法:
rsync -avzP rsync://rsync_server_ip/path/ localpath
note:
查看rsync服务器下的目录信息
rsync -v rsync://rsync_server_ip/path/