rsync file synchronization

A:192.168.137.128

B:192.168.137.129

 

(A and B have already deployed rsync)

   /etc/rsyncd.conf

[root@localhost data]# cat /etc/rsyncd.conf
uid=root
gid=root
use chroot=no
max connections=10
strict modes=yes
port=873
address=192.168.137.129 (host IP)
read only=no
list=no
pid file=/var/run/rsyncd.pid
lock file=/var/run/rsync.lock
log file=/var/log/rsyncd.log

[case]  (moduble)
path = /opt/data
comment = ucweb-file

 

 1. Create a file

[root@localhost data]# >1.txt
[root@localhost data]# >2.txt
[root@localhost data]# >3.txt
[root@localhost data]#
[root@localhost data]# ls
1.txt  2.txt  3.txt

 2. Synchronize all files (note: case, is the module configured in rsyncd.conf of 128)

[root@localhost data]# rsync -auvz /opt/data [email protected]::case
sending incremental file list
data/
data/1.txt
data/2.txt
data/3.txt

sent 190 bytes  received 69 bytes  518.00 bytes/sec
total size is 0  speedup is 0.00

 

 3. Sync the modified files

[root@localhost data]# vi 1.txt
[root@localhost data]# rsync -auvz /opt/data [email protected]::case
sending incremental file list
data/
data/1.txt

sent 132 bytes  received 31 bytes  326.00 bytes/sec
total size is 6  speedup is 0.04

 

Conclusion: It is suitable for synchronizing small files, because the contents of the files are compared each time they are synchronized, and the performance may be reduced when encountering large files (untested)

          Generally, it works better with inotify-tools.

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326212214&siteId=291194637