更新时间:2022-10-01 14:21:13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
实验环境: 操作系统 CentOS6.5 x64 Server IP地址:192.168.9.104 Client IP地址:192.168.9.109 1,下载安装 rsync
#wget https://download.samba.org/pub/rsync/rsync-3.1.2.tar.gz #tar xf rsync-3.1.2.tar.gz #cd rsync-3.1.2 #./configure #make #make install 2,Server系统配置 rsync
# vim /etc/rsyncd.conf uid = nobody gid = nobody use chroot = no max connections = 10 pid file = /var/run/rsyncd .pid
log file = /var/log/rsync .log
lock file = /var/lock/rsync .lock
hosts deny = * [zabbix] path = /data0/zabbix
comment = zabbix php file
ignore errors read only = no
write only = no hosts allow = 192.168.9.109 192.168.1.104 192.168.5.0 /24
list = false
uid = root gid = root 3,Server启动 rsync 守护进程
# /usr/local/bin/rsync --daemon --config=/etc/rsyncd.conf # ps -ef | grep rsync # netstat -lanptu | grep 873 4,Client同步操作 从Server同步到Client # rsync -az --delete --progress --exclude "*.php" --exclude "class.*" 192.168.9.104::zabbix /opt 从Client同步到Server # rsync -vzrtopg /tmp/5.txt 192.168.9.104::zabbix 可以设置定时任务 |