With particular emphasis on: This step is very important, if this can not be synchronized back inotify a good job will not synchronize data.
1 ) create data to be synchronized respectively
[root@rsync-client-inotify ~]# mkdir /data/{web,web_data}/redhat.sx -p
[root@rsync-client-inotify ~]# touch /data/{web/redhat.sx/index.html,web_data/redhat.sx
/a.jpg}
[root@rsync-client-inotify ~]# tree /data
/data
├── web_data
│ └── redhat.sx
│ └── a.jpg
└── web
└── redhat.sx
└── index.html
4 directories, 2 files
2 ) perform the synchronization command
For S1 (172.16.100.1):
[root@rsync-client-inotify ~]# rsync -avzP /data/web/redhat.sx [email protected]. 22
1::web/ --password-file=/etc/rsync.password
[root@rsync-client-inotify ~]# rsync -avzP /data/web_data/redhat.sx rsync_backup@172.
16.100.1::data/ --password-file=/etc/rsync.password
For S2 (172.16.100.2):
[root@rsync-client-inotify ~]# rsync -avzP /data/web/redhat.sx [email protected].
2::web/ --password-file=/etc/rsync.password
[root@rsync-client-inotify ~]# rsync -avzP /data/web_data/redhat.sx rsync_backup@172.
16.100.2::data/ --password-file=/etc/rsync.password
Tip: Before deploying inotify later, inotify master server (ie rsync-client-inotify) must ensure
The file can be manually pushed to S1, the S2, so that subsequent inotify-tools to call these commands to automatically push.
After synchronization finished, respectively, for the corresponding directory S1, S2 for viewing! Here to S1 as an example:
[root@rsync-server-1 ~]# tree /data
/data
├── web_data
│ └── redhat.sx
│ └── a.jpg
└── web
└── redhat.sx
└── index.html
4 directories, 2 files