Rsync synchronization implementation file

Story background: Our company is doing a new retail, the need for each machine to synchronize released update files, so I did a little research here

Technology Research: There are two ways to synchronize files between scp and rsync Linux.

sync and scp do not exist in the folder, the execution time or less, but in the case of very different folder exists. The reason is scp to copy: If mas2 file does not exist, create a new, if there is coverage, and Dashboard if there is no host mas2 not changed. Scp can be understood as to "copy." And then rsync file exists in two hosts, compare two files are identical enough, the same words, do nothing, if the differences directly updated.

Simply put, do rsync only difference file updates.


#### Rsync introduce
rsync is an open source backup tool, and then between different hosts can be synchronized to achieve full volume and incremental backups, for centralized backup or remote backup scenarios.
rsync listening port: 873
rsync operating mode: C / S
#### Rsync transfer mode
- local mode
local transmission, the internal host data transfer (similar to the cp command)
- remote mode
remote channel transmission, to transmit data through channel ssh (similar scp command)
- daemon mode
daemon transmission, users do not use the system for transmission (high security)

#### Rsync command parameters
-a copy files of various types (corresponding -tropgDl)
-v display transfer process
for transmitting compressed -z
-r recursive directory and subdirectories transmission
-t file retention time constant
-o file holding owner information
-g file owner group information holding
-p holding file permissions
-l remains flexible connection
-P synchronous display process progress and
-D file information holding device
--bwlimit = 100 speed transmission
--delete source and destination data consistent
--partial HTTP

#### install rsync
`sudo APT-GET install` general machine seems to have a
#### server
1. Create rsyncd.conf configuration file, sudo vim /etc/rsyncd.conf
` ai # uid = user processes running
gid = ai # run user group
port = 873 # listening port
fake super = yes # do not need to run rsync as root, allowed to accept data
use chroot = no # confined to push data to a directory on
max connections = 0 # maximum number of connections
timeout = 600 # timeout
log file = /var/log/rsyncd.log # define log file path
############################### ######
[backup] # module name
path = / backup # define receives backup data directory
ignore errors # ignore the error message
read only = false # backup data read-write
list = false # are not allowed to view module information
auth users = test # define virtual user authentication using
secrets file = /etc/rsync.passwd # authentication password path '

2. Create rsync.passwd
`echo" the Test: 123456 "> /etc/rsync.passwd
chmod 600 /etc/rsync.passwd otherwise transmission will complain`
3. Start rsync
`rsync --daemon`

#### Client
1. Create rsync.passwd
`echo" 123456 "> /etc/rsync.password
chmod 600 /etc/rsync.password otherwise transmission will complain '

Example #### (pull)
`-avz [email protected] the rsync --password-Backup File :: = / etc / rsyncd.password / tmp / Backup /`

#### Timing pulling
the pull command to configure the client crontab

Guess you like

Origin www.linuxidc.com/Linux/2019-11/161368.htm