Rsync server Construction
This solution uses the client to actively synchronize servers
Server Configuration:
1. Create a directory
Mkdir/etc/rsyncd
Touch/etc/rsyncd. conf
Touch/etc/rsyncd. secrets
Chmod 600/etc/rsyncd. secrets
2. Specify the directory to be backed up
3. modify the configuration file
Pid file =/var/run/rsyncd. pid
Log file =/var/log/rsyncd. log
Read only = no
Max connections = 50
Use chroot = yes
[Mysql]
Hosts allow = 192.168.0.0/24 10.13.2.0/24 210.51.19.0/24 220.181.67.0/24
Path =/data/mysql // directory to be backed up
Uid = root
Gid = root
Secrets file =/etc/rsyncd. secrets
Read only = no
[Www]
Hosts allow = 192.168.0.0/24 10.13.2.0/24 210.51.19.0/24 220.181.67.0/24
Path =/data/www/
Uid = root
Gid = root
Secrets file =/etc/rsyncd. secrets
Read only = no
4. Change the password file
Vim/etc/rsyncd. secrets
Mysql: 123.com
Www: 123.com
5. Start the rsync daemon mode.
/Usr/bin/rsync -- daemon -- config =/etc/rsyncd. conf
6. Open firewall port 873
Iptables-a input-p tcp-m state -- state NEW-m tcp -- dport 873-j ACCEPT
Client settings
1. Add a password file
Cd/root/
Vim rsyncd. secrets
Only enter the 123.com password.
2. synchronize data
/Usr/bin/rsync-vzrtopg -- password-file =/root/rsyncd. secrets root@192.168.0.10: mysql/data/mysql/
3. Verify data
4. Add a scheduled task
Crontab-e
This article is from the "ShareDream" blog