Debian install rsync
#直接执行
apt-get install rsync
#若出现错误提示
#Package 'rsync' has no installation candidate
#执行
apt-get update
apt-get upgrade
#再次执行
apt-get install rsync
hundred
yum install rsync
master server A
Migrate to server B
Both A and B install rsync
The following is configured on the A server:
After the rsync server is installed, the rsync.conf file is not generated, and rsyncd.conf needs to be created manually
vim /etc/rsyncd.conf
Fill in the following content as required
log file = /var/log/rsyncd.log
pidfile = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
secrets file = /etc/rsyncd.secrets
hosts allow = B 的 IP
[wwwroot]
path = /www/wwwroot
comment = sync etc from server
uid = root
gid = root
port = 873
ignore errors
use chroot = no
read only = yes
list = no
dont comperss = *.gz *.bz2 *.tgz *.zip *.rar *.z
max connections = 200
timeout = 600
auth users = backuser
Configure sync username and password
vim /etc/rsyncd.secrets
Just configure one line in the rsyncd.secrets file
backuser:123456
Important, you must give /etc/rsyncd.secrets 600 permissions
chmod 600 /etc/rsyncd.secrets
Also create a username and password file on the B client and execute permissions
vim /etc/rsyncd.secrets
#写入密码
123456
#赋权
chmod 600 /etc/rsyncd.secrets
After the configuration is complete, run rsync on server A
rsync --daemon
#注意,每次修改 rsyncd.conf 都要重启 rsync
#如果无法重启可以杀死 rsync 的进程id
Transfer on B client
rsync -avzP backuser@A的IP::wwwroot /www/wwwroot/ --password-file=/etc/rsyncd.secrets