日志信息
# tail -f /var/log/rsyncd.log
2011/01/25 16:40:36 [30371] name lookup failed for 192.168.206.200: Name or service not known
2011/01/25 16:40:36 [30371] connect from UNKNOWN (192.168.206.200)
2011/01/25 08:40:36 [30371] rsync on www/ from appbackup@unknown (192.168.206.200)
2011/01/25 08:40:36 [30371] building file list
2011/01/25 08:40:36 [30371] sent 263 bytes received 66 bytes total size 2313891
2011/01/27 08:45:05 [2533] rsyncd version 3.0.3 starting, listening on port 873
5、client端测试
创建密码文件,只填密码即可,密码要与server端的一致。
debian-vm:~# vi /etc/rsyncd.secrets
123456
同步
debian-vm:~# /usr/bin/rsync -vzrtopg --delete --progress appbackup@192.168.206.120::www /data/webroot --password-
file=/etc/rsyncd.secrets
receiving incremental file list
deleting 20101129.csv
./
ip.txt
2358 100% 2.25MB/s 0:00:00 (xfer#1, to-check=2/7)
sent 81 bytes received 886 bytes 1934.00 bytes/sec
total size is 2375 speedup is 2.46
参数说明:
-vzrtopg里的v是verbose,z是压缩,r是recursive,topg都是保持文件原有属性如属主、时间的参数。
--progress是指显示出详细的进度情况
--delete是指如果服务器端删除了这一文件,那么客户端也相应把文件删除
6、crontab定期更新脚本
# more rsync.sh
#!/bin/bash
#列表显示远程的目录
/usr/bin/rsync -vzrtopg --delete --progress appbackup@192.168.206.120::www --password-file=/etc/rsyncd.secrets
/usr/bin/rsync -vzrtopg --delete --progress appbackup@192.168.206.120::www /data/webroot --password-
file=/etc/rsyncd.secrets