Real-time synchronization of multiple servers, Linux and Windows system files using software Rsync and Inotify Real-time synchronization of files between two Linux hosts Host A: 192.168.254.201 Host B: 192.168.254.202 Experimental purpose, implemented on host B Make changes, real-time synchronization on host A. 1.1 Configuration on host A 1.1.1 Create a folder to be synchronized Mkdir /opt/rsync 1.1.2 Install Rsync Emerge rsync I use Gentoo, it is installed by default, and the configuration file is in /etc. /rsyncd.conf 1.1.3 Modify the configuration file Nano –w /etc/rsyncd.conf # Globel setting uid = root gid = root use chroot =no max connectiongs = 10 pid file = /var/run/rsyncd.pid lock file = /var/run/rsync.lock log file = /var/log/rsync.og # Folder Setting,Permit add more folder [images] path = /opt/image/read only = no auth users = rsyncuser secrets file = /Etc/rsyncd.secrets 1.1.4 Write verification file Nano –w /etc/rsyncd.secrets rsyncuser:Password01
Chown -R 600 /etc/rsy Ncd.secrets 1.1.5 Startup Service Rsync --daemon --config=/etc/rsyncd.conf Echo –en ‘rsync –daemon –config=/etc/rsyncd.conf’ >> /etc/Rc.local 1.2 Configuration on Host B 1.2.1 Create the same directory Mkdir /opt/rsync 1.2.2 Install rsync and inotify Emerge rsync Emerge inotify-tools 1.2.3 Create Access Password Echo –en ‘Password01’ > /etc/rsyncd.secrets Chmod 600 /etc/rsyncd.secrets 1.2.4 Configuring Synchronization Scripts nano -w /root/InotifyRsync.sh #!/bin/bash host_1=192.168.254.201 src=/opt/image/dst=images User=valeRsync inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f' -e
modify,delete$ do rsync - avzP --delete --password-file=/etc/rsyncd.secrets $src $ echo "${file} was rsynced" done exit 0 1.2.5 Test Run echo -ne ‘/root/InotifyRsync.sh & ’ >> /etc/rc.local Sh /root/InotifyRsync.s h Also open a terminal to test under /opt/rsync and check if the A host is synchronized. 1.2.6 Properties supported by inotify
IN_ACCESS, ie the file is accessed
IN_MODIFY, the file is written IN_ATTRIB, the file attributes are modified, such as chmod, chown, touch, etc. IN_CLOSE_WRITE, the writable file is Close IN_CLOSE_NOWRITE, the non-writable file is closed IN_OPEN, the file is opened by IN_MOVED_FROM, the file is removed, such as mv IN_MOVED_TO, the file is moved, such as mv, cp IN_CREATE, create a new file IN_DELETE, the file is deleted, such as rm IN_DELETE_SELF, self-delete , that is, an executable file deletes itself when executing IN_MOVE_SELF, self-moving, that is, an executable file moves itself IN_UNMOUNT during execution, the host file system is umount IN_CLOSE, the file is closed, equivalent to (IN_CLOSE_WRITE
The following error message appears after starting vnc4server: LSPPC-Lenny:~# vnc4serverxauth: (stdi
In todays increasingly prominent network security issues, how to ensure the security of Ubuntu syste
CentOS modify IP address First turn off the firewall: service iptables stop# ifconfig eth0 192.168.1
Nginx has been widely used in production environments compared to Apaches high performance and high
Kdump and crash configuration methods and failure analysis methods
Microsoft extends the life cycle of Vista and Windows 7
CentOS Apache configuration details
Linux system to refresh the motherboard BIOS method
Git some small experience and tips overview
The solution to run the window program under Linux
Linux release cache memory tutorial
CentOS 6.5 configuration yum install Nginx
The final solution for the Eva qq crash of QQ software under Linux
How to set win10 default browser into IE browser?
Windows 8 Source Manager Essential Skills
Win8.1 update when the black screen how to do win8.1 upgrade restart black screen solution
Install the Linux operating system through the image file on the hard disk
How does Win10 cancel the power-on password? How to undo the power-on password
How to grow wheat quickly in my world My world's fast-growing wheat strategy
Win7 system running Need for Speed 10 how to solve the problem?
Hao bet Win8 actually blocked Win7
How do win8 system people look at the Asian Cup abroad?
Windows 7 64-bit version can not use QQ Wubi method solution