我在rsync上工作了一下午,设置了一个rsync服务器,但是我不知道如何使用它。
我有两台机器:66 和 12。66 是服务器,我想将 66 的数据备份到 12,所以我使用 rsync。
我已完成以下操作:
在 66:
sudo apt-get install xinetd
sudo vim /etc/xinetd.d/rsync
service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
sudo nano /etc/rsyncd.conf
max connections = 2
log file = /var/log/rsync.log
timeout = 300
[wwwroot]
comment = Public Share
path = /home/wwwroot
read only = no
list = yes
uid = nobody
gid = nogroup
auth userusers = user
secrets file = /home/rsync.secrets
sudo /etc/init.d/xinetd restart
在 12:
rsync -v [email protected]::wwwroot /home/young001/backup --password-file=/home/rsync.pass
它告诉我们:
skipping directory .
sent 4 bytes received 6 bytes 2.86 bytes/sec
total size is 0 speedup is 0.00
日志是:
2013/06/12 03:18:18 [30477] name lookup failed for 125.221.225.12: Name or service not known
2013/06/12 03:18:18 [30477] connect from UNKNOWN (125.221.225.12)
2013/06/12 10:18:18 [30477] rsync on ctp/ from young001@UNKNOWN (125.221.225.12)
2013/06/12 10:18:18 [30477] building file list
2013/06/12 10:18:18 [30477] skipping directory .
2013/06/12 10:18:18 [30477] sent 98 bytes received 54 bytes total size 0
2013/06/12 03:19:59 [30484] name lookup failed for 125.221.225.12: Name or service not known
2013/06/12 03:19:59 [30484] connect from UNKNOWN (125.221.225.12)
2013/06/12 10:19:59 [30484] rsync on ctp/ from young001@UNKNOWN (125.221.225.12)
2013/06/12 10:19:59 [30484] building file list
2013/06/12 10:19:59 [30484] skipping directory .
2013/06/12 10:19:59 [30484] sent 98 bytes received 54 bytes total size 0
它似乎表明目录是空的,但我不知道哪个目录是空的。
/home/young001/backup 是一个空目录,而 /home/wwwroot 不是一个空目录。
我想将 wwwroot 同步到备份,我哪里做错了?
答案1
使用“a”或其他 rsync 选项来实际执行除检查之外的其他操作:
rsync -av [email protected].......
顺便说一句,您可以简单地使用 rsync 和 ssh 来完成这项工作,而无需安装 rsync 服务器。