In linux, the rsync incremental synchronization method-Linux Enterprise Application-Linux server application information. For details, refer to the following section. Run rpm-qa | grep rsync to check whether rsync has been installed.
The following describes the configuration process of rsyns.
1. Configure the server
First, edit/etc/rsyncd. conf as follows:
Uid = nobody # The user nobody for backup is any user
Gid = nobody # The backup group nobody is any group
Use chroot = no # Do not use chroot
Max connections = 10 # maximum number of connections
Log file =/var/log/rsyncd. log # log file
[Rsyncd] # Here is the Authentication Module name
Path =/home/test/# directory for synchronization
Ignore errors # ignore unrelated IO errors
Read only = yes # read-only
List = no # column list not allowed
Anth users = root # authenticated user name
Secrets file =/etc/rsyncd. secrets # password file storage address
Edit a rsyncd. secrets password under/etc to store the file.
Format:
Username: Password, for example, root: xl1100
Finally, start rsync on the server as a daemon.
Command: rsync? Daemon
Rsync starts at Port 873.
Ii. Client Configuration
Edit a rsyncd. secrets password under/etc to store the file.
Run the following command:
Rsync-vzurtopg -- progress -- delete root@192.168.100.150: rsyncd/home/test -- password-file =/etc/rsync. secret
Parameter v indicates a detailed prompt
Z indicates Compression
U indicates update only
Topg stores original file attributes such as the master and time parameters.
-- Progress indicates display
-- Delete: if the server deletes this file, the client also deletes the file to ensure true consistency.
Root is the user name
@ 192.168.100.150 is the Server IP Address
: The subsequent rsyncd is the authenticated Module name.
/Home/test is the name of the local directory for backup.
-- Password-file =/etc/rsync. secret specifies the address where the password is stored.
You can write the script rsync. sh.
#! /Bin/sh
Rsync-vzrtopg -- progress -- delete root@192.168.100.150: rsyncd/home/test -- password-file =/etc/rsync. secret
Then, add the script to the/etc/crontab file to regularly execute updates.
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.