Rsync needs to be installed on the client and server side, some distributions of Linux systems are installed by default and available: Rpm-qa rsync for queries
One, server-side configuration (192.168.1.1):
1.
The default rsync is that there is no configuration file for users to set themselves
Create an Rsync profile: vim/etc/rsyncd.conf
uid = root #运行rsync守护进程的用户gid = root #运行rsync守护进程的组use chroot = no #不使用chrootmax connections = 2 # Maximum number of connections is strict modes = yes #是否检查口令文件的权限port = 873 #默认的端口号 # These are the files that are automatically generated after you start the Rsync service, or you can manually specify the path #pid file = Storage of /usr/local/rsyncd.pid pid Files # Storage #log of lock file = /usr/local/rsync/rsync.locl lock file file = /usr/local/rsync/log/rsyncd.log log file Storage #motd file = /usr/local/rsync/ rsyncd.motd Welcome Information [zt] #模块参数, the client will specify the path = /123/ #需要做镜像的目录comment = my name is zt #此模块的注释ignore errors # Ignore some extraneous IO errors read only = no # Read-only list = no #不在服务器上吧提供同步数据的目录显示auth users = zt #认证的用户名, regardless of the system user, no this column means anonymous access! This user name needs to be consistent with the user name in Rsync.pass secrets file = /etc/rsync.pass #指定的密码认证文件hosts allow = 192.168.1.226 #允许的主机hosts  DENY = 0.0.0.0/0       &Nbsp; #禁止的主机
2.
Create a certified password file
Vim/etc/rsync.pass #需与上诉配置文件当中指定的密码认证文件一样
ZT:PASSWD #格式是 Account: Password, create complete save exit
chmod 600/etc/rsync.pass: Need to specify permissions
3.
Modify the configuration of rsync in xinetd: Vim/etc/xinetd.d/rsync
Inside you can see disable = yes to turn rsync off, change the value to No to open
4.
There are two ways to start rsync:
Start with daemon: rsync--daemon
Start with XINETD Super process:/usr/rc.d/init.d/xinetd/reload: or start
Second, the configuration of the client (192.168.1.2)
To download rsync, build the Rsync profile touch/etc/rsyncd.conf, note that the contents of the configuration file are empty!
Establish the password file Vim/etc/rsync.pass, go in Add passwd, only need to add the source server password can be
chmod 600/etc/rsync.pass operation after starting service
Three
Two common synchronization command formats are described here:
Server download to Local: Rsync-avz--delete [email protected]::zt/local Directory
On the ground to the server: Rsycn-avz--password-file=/etc/rsync.pass/local directory/[email protected]::zt
If the appeal of the operation is not a problem also reported wrong, it is recommended that the two machines 873 services killed and then started in one!
Netstat-anpt|grep 873: After viewing port kill-9 port: Kill
Or a change is made to initiate the action of the appeal.
Run Chekconfig--list to view after startup
Four
Scheduled periodic scheduled backups
Crontab-e
* * * * * */usr/bin/rsync-az--delete--password-file=/etc/rsync.pass [email protected]::zt/local Directory
#分时日月周, you can set your own
Date View system time, date-r view time zone, date-s modify system time
Five
Rsync+inotify-tools Real-time synchronization
This need to download Inotify-tools package, can go to the official website download: http://inotify-tools.sourceforge.net/download
#问题来了, this piece I did not succeed, I followed the code on the Internet do not understand what meaning! Hey 650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0008.gif "alt=" J_0008.gif "/> There's nothing I can do to save God.
: 650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/82/47/wKioL1dP7jiCTiNuAAAehJw-9uo408.png "title=" QQ picture 20160601171734.png "alt=" Wkiol1dp7jictinuaaaehjw-9uo408.png "/>
Error message: 650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/82/48/wKiom1dP7WzACTT_AAAHtOqB0VA170.png "title=" QQ picture 20160601171743.png "alt=" Wkiom1dp7wzactt_aaahtoqb0va170.png "/>
I have already removed the rsync parameter, or the error, to solve
This article is from the "11422312" blog, please be sure to keep this source http://11432312.blog.51cto.com/11422312/1785544
Rsync+inotify-tools real-time synchronization steps