Requirement: two servers (a and B) store a large number of images on server a and need to be synchronized to server B at three o'clock every night. Both the source and target directories are/Image
Enable program: rsync
Configuration on server:
1./etc/rsyncd. conf
Uid = nobody
Gid = nobody
Use chroot = No
Max connectionts = 6
Read Only = Yes
Hosts allow = 192.168.95.0/24
PID file =/var/run/rsyncd. PID
Lock file =/var/run/rsyncd. Lock
Log File =/var/log/rsyncd. Log
[Image]
Comment = image
Path =/image/
Ignore errors
List = No
Auth users = root
Secrets file =/etc/rsyncd. passwd
2./etc/rsyncd. passwd
Root: Test
After completing the preceding configuration, run
# Rsync -- daemon
If the system prompts that the rsyncd. passwd file is not found, it indicates that the file is not in the default/etc/path or is not created. You just need to move the file.
Configuration on server B:
/Etc/rsync. passwd
Dongpi2014
Note that the password file on server a and server B is written differently. The password file on server a needs to record the user name, while the password file on server B does not need to record the user name.
Then execute the command
Rsync-ARV -- password-file =/etc/rsyncd. passwd rsync: // [email protected]/test/image/
In this way, synchronization starts.
Note:
If the following error is reported:
@ Error: Unknown module 'xxx'
Rsync error: Error starting client-server protocol (Code 5) at main. C (1503) [runner ER = 3.0.6]
ThisAn error indicates that the Password File Permission is incorrect. The normal password file permission should be 600
The -- password-file option may only be used when accessing an rsync daemon.
This error indicates that the server has not executed the rsync -- daemon command (the service has not been started)
@ Error: AUTH failed on module XXXXX
This error indicates that there is a problem with the username and password in server a and server B, which may be caused by the format of username and password in server B.
In addition to the above methods, you can also use the automated notebook CT script to complete
#! /Usr/bin/CT
Set timeout 3000
Spawn rsync-avcz -- delete [email protected]:/image // Image
Reset CT "Password :"
Send "dongpi2014 \ r"
CT "] *"
Exit
Interact
This article from the "empty heart" blog, please be sure to keep this source http://songknight.blog.51cto.com/2599480/1551555
Rsync synchronizes two servers