The data in the server is the most important, the data of commercial use is more important, once lost, the result is unimaginable. So backup is important. Can be used to Rsync+crontab to do data synchronization.
Method/Step
The first is the installation
wget http://rsync.samba.org/ftp/rsync/src/rsync-3.1.0.tar.gz
CD rsync-3.1.0/
./configure--prefix=/usr/local/rsync
Make
Make install
Under test
Make Test
No problem
Start the configuration below, note that the default is no rsyncd.conf file, you need to manually create
The following is the contents of the file, such as
UID = root
GID = root
Use chroot = no
Max connections = 4
PID file =/var/run/rsyncd.pid
Lock file =/var/run/rsync.lock
Log file =/var/log/rsyncd.log
[logs]
Path =/mnt/hgfs/code/test
Ignore errors
Read Only = True
List = False
Hosts allow = 192.168.1.200
Auth users = root
Secrets file =/etc/backserver.pas
Configuring a password file (/etc/backserver.pas) is also required to manually create
Vi/etc/backserver.pas
root:123456789
You need to modify the permissions of the file to 600, both the owner and the group are root
Chown Root:root/etc/backserver.pas
chmod 600/etc/backserver.pas
-
/usr/bin/rsync--daemon
-
First generate a password configuration file that needs to be consistent with the password on the source data server
vim/etc/ Rsyncd.secretes (File not present, vi manually generated)
chmod 600/etc/rsyncd.secretes
7
Use Crontab to update daily 4 o'clock in the morning (this time the server pressure is slightly smaller)
crontab-e00 * * * RSYNC-VZRTOPG--progress--delete--password-file=/etc/rsyncd.secretes [email protected]::logs/dat A/test
This synchronizes the data from the remote server's/mnt/hgfs/code/test (configured within the/etc/rsyncd.conf of the source data server) to the/data/test under the remote server.
You can view the scheduled tasks by Vi/var/spool/cron/username (if username is root and the path is/var/spool/cron/root).
Installation of rsync under Linux and configuration of remote server data synchronization