In linux, use rsync for data synchronization-Linux Enterprise Application-Linux server application information. The following is a detailed description. First install Rsync, such as on Redhat Fedora Linux or RHEL AS3:
Rpm-ivh rsync-2.5.7-5.3E.i386.rpm
Installation is complete.
The rsync client and server are both in the same execution file, but the parameters added are different.
For example, if server A is 192.168.0.100 and server B is 192.168.0.101, for example, synchronize files in the/www/downloads/new directory on server 101 to the/www/download directory of 192.168.0.100, then, run rsync on 100 as the server and 101 as the client.
First, set up the configuration file of the 192.168.0.100 server.
In a configuration file, uid and gid indicate the running identity. chroot indicates that the directory is automatically switched after the connection, and read only = false indicates that other clients are allowed to upload data to the server on the local machine. Host allow and deny are restricted connection addresses. Auth user is the authenticated user name, And secrets file =/etc/rsyncd. pwd indicates that the password is read here when the authenticated user name is used.
Next, edit the password file:
Vi/etc/rsyncd. pwd
Backup: 123456
Set Password File Permission 700: (LOGIN fails if the permission is incorrect)
Chmod 700/etc/rsyncd. pwd
Then start the rsync service:
/Usr/bin/rsync -- daemon
Add rsync to the Automatic startup script and start it automatically after it is started:
Echo "/usr/bin/rsync -- daemon">/etc/rc. d/rc. local
Note that iptables must allow connection to port 873 of rsync.
-V indicates that the output result is displayed, r indicates the persistence attribute, t indicates the persistence time, and L indicates that soft link is treated as a common file.
Create a client password file:
Vi/root/rsync. pwd
123456
Note: The client password script does not contain the user name.
Set Password File Permission 700: (LOGIN fails if the permission is incorrect)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.