Rsync + inotify enables real-time server backup, rsyncinotify
Inotify:
Inotify is integrated into the kernel. inotify is used as a third-party software to monitor directory changes through the interfaces provided by the kernel.
The inotifywait command can monitor fine-grained real-time changes to files in the directory. The monitored command is
Inotifywait-mrq -- timefmt '% d/% m/% y % H: % m' -- format' % T % w % f % e'-e modify, delete, create, att
After Rsync completes data backup, this operation will be automatically terminated. For this purpose, it is best to add a "-a" option for files on the basis of the above command) and a "-e" option to specify the remote shell program to ensure security. In this case, the remote shell uses an encryption protocol, such as ssh, so that the remote shell can use the-e ssh
Rsync + inotify for data synchronization and FAQs
Rsync: Remote Sync is a data image backup tool for Unix-like systems. Rsync can be used to back up data with low real-time requirements. For example, you can use the specified backup file server to back up data to the specified remote server and regularly perform data mirroring on the local disk.
Inotify: inotify
Max connections = 200
Timeout = 600
Use chroot = no
Read only = yes
Pid file =/var/run/rsyncd. pid
Host_allow = 192.168.48.148 // write the IP address of the client here
# Syslog facility = local7
# Log file =/var/log/rsyncd. log
# Rsync config
# The 'standard' things
[Rsync_gmmold] // defines the synchronization path. The client uses this keyword for Link)
Path =/home // path to be synchronized
Comment = gmmold // unknown for the moment
3. Start the
)Production Scenario Cluster Architecture server sub-scheme1) for the company's important data chaos and leadership of the proposed backup of the entire network of data solutions2) by locally packaged backup, then rsync+inotify/rsync+sersync the data back to a fixed storage server, then checks and sends alerts to the administrator for backup results on the storage server.3) regularly back up the data in the
, Copy Local files and start this mode of work when both SRC and des path information do not contain a single colon ":" delimiter.2, use a remote shell program (such as rsh, SSH) to copy the contents of the local machine to the remote machine. This mode is started when the DST path address contains a single colon ":" Separator.3, a remote shell program (such as rsh, SSH) is used to copy the contents of the
/tmp/rtest1 root@192.168.1.101:/tmp/
Automatic sync Configuration
Describes the method for configuring a password without entering the synchronization.
1, the use of SSH key
This method can be used to synchronize directly with the rsync command without entering a password during synchronization.
Generate SSH key on host:
the default display is an empty string;%T: Use the custom time format in the--TIMEFMT option;For example, to monitor the Create,delete,modify,close_write events that occur on the/tmp/test directory and all of its internal files, use the following command:# inotify-r--timefmt '%d/%m/%y%h:%m '--format '%T%w%f '-e create,delete,modify,close_write/tmp/testThis command exits after monitoring the first event on a file, and if you want to monitor it all the time, you need to add the-m option to the co
content for transmission)Rsync-avpz-e "Ssh-p 10022" 192.168.31.182/tmp/111/./111/(Specify port for copy transfer)Rsync-avl--delete--exclude [email protected]:: mokuaiming /test./--password-file=/home/admin/rsyncd.passwd (rsync reference term, more complete)Rsync Backend Ser
One, usage example 1, incremental backup local file#rsync-av ebook/tmp///Note: It is best not to have the file name:#rsync-AVZRTOPGL--PROGRESS/SRC/DST2. Local and Remote directory synchronization#rsync-AUV--delete Program doc/media/cbdisk/project///sync to USB drive#rsync-AUV--delete program doc [email protected]:/home
First, we assume that the server on which the site is located is a server and that the backup server is a B server. The way to install rsync is not to say, Linux directly yum/apt-get install rsync can be
1. Create a public key and key on Server A with the Ssh-key-gen command (for password-free login to B server)
SSH-
rsync syncDifferences in synchronization and replication:Copy: Full copy Source to targetSync: Incremental copy, transfer only changed dataSynchronous operation:Remote SyncSupports local replication, or synchronizes with other Ssh,rsync hosts.Official website: http://rsync.samba.org/Command usagersync [options] Source directory destination DirectoryCommon options
Rsync It is an application software under Unix/linux, it can keep multiple server data synchronization consistency, rsync will copy the whole content on the first synchronization, but only the modified files are transmitted the next time. Rsync in the process of transmitting data, it is possible to compress and Unzip operation, so you can use less bandwidth. can
It is in the Window System synchronization actual combat
1. Remote Data Synchronization Tool rsync Introduction
1.1 Software Introduction
Rsync is a remote data synchronization tool that allows fast synchronization of files between multiple hosts through Lan/wan. Rsync is a tool used to replace RCP, which is currently maintained by Rsync.samba.org.
-party software can monitor changes in the file system, thus triggering the synchronization of rsync, we use inotify-tools to achieve this function.Idea: Inotify-tool should be installed on the host that needs to be monitored, if we install it on Master, monitor its own file system, when the file system changes, it should notify the client to synchronize, such as:SSH 172.16.1.3 '/root/rsync.sh 'The premise of dual-machine
Some rooms will limit the flow of the machine, in order to not touch the bottom line, in the use of SCP and rsync should pay attention to.In order to avoid the disconnection caused by your SCP or the Lazy OPS Setup firewall, we have to limit the flow of our data, and it's better to be slower than pinched. Therefore (limited to 1M bytes/s):
Scp-l 10000 A large file your account @ remote machine or rsync is
How to Use rsync in Linux for data backup, linuxrsync
For various organizations and companies, data is the most important to them. Even for e-commerce, data is equally important. Rsync is a tool/software that backs up important data through the network. It is also a network protocol for synchronizing folders and files between systems through the network on Unix-like and Window systems.
Rsync Introduction: Data Backup tool (with push-pull feature)Characteristics:The entire directory tree and file system can be saved in a mirror.It is easy to keep the original file permissions, time, soft connection and so on.Install without special permissions.Fast: When you synchronize for the first time, rsync copies the entire content, but only the modified files are transferred the next time.
After the rsync server configuration is over, the next step is to issue an rsync command on the client to enable the server-side files to be backed up to the client. Rsync is a very powerful tool, and its commands have many feature options, and we'll analyze all of its options below.The command format for rsync can be
I. Rsync Overview
Rsync is a data image backup tool in Unix-like systems. It can be seen from the software name-remotesync. Rsync is a file synchronization and data transmission tool in Linux. It uses the "rsync" algorithm to synchronize files between a client and a remote file server, you can also back up data from on
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.