The Rsync service is an efficient remote data backup tool with port number 873,is a non-independent service under the Liunx. Managed by XINETD Super service, instead of listening 873port.Strengths:1. Rsync is able to use SSH and SSL remote control to connect to a remote host for backup. Dependent sshd Service2, enables
Lab Environment:Backup server:192.168.160.101Node1 server:192.168.160.245Experimental purpose: Implement NODE1 scheduled incremental backups to backup serverAdd two domain name resolution via local Hosts file (two all to do) synchronize data via domain name more intuitive!Backup server:Ping test:Node1 Server:Ping test:Install Rsync: (both server and client are in
directory PermissionsSetfacl-m user:nobody:rwx/var/www/html/Start rsyncRsync--daemonCentos7 startSystemctl Start RSYNCDClient TestingBackup from remote server to nativeRsync-avz [Email protected]::backup/backup/rsync/Uploading to a remote server from this computerrsync-avz/backup/
4. Set the client cron job on the server 192.168.11.2. Self-action backup or mirroring per night
0 * * 1-5/root/.test.sh
Note: Automatically run/root/.test.sh for backup every nine o'clock in the evening from Monday to Friday
#more/root/.test.sh
#!/bin/sh
Date= ' Date +%w '
Rsync-tvzrp-e ssh--progress--delete test@192.168.11.7::test/shopu/test/$DATE--password
is the Certified module name, which needs to be specified on the client side
Path=/var/mail # need to do a mirrored directory
Comment = Backup Mail # comment
Ignore errors # Ignores some irrelevant IO errors
Read Only = yes # reading only
List = no # does not allow column files
Auth users = postfix # Specify user
Secrets File=/etc/rsyncd.pwd # Authentication file name, mainly save user password, permissions set to 600, owner root, or client will erro
rsync+inotify Synchronizing backup MYSQL data Rsync has the advantages of high security, fast backup, support of incremental backup, and so on, which can solve the requirement of low real-time data backup. , but
...Connected to 192.168.1.1 (192.168.1.1). Escape character is ' ^] '. @RSYNCD: 30.0Synchronizing data in order to enter the password is not entered manually, we also create a client-side password file (this file path and password to the same server side, the client does not have to write the name) [[email protected] ~]# echo "123" >/etc/ Rsyncd.secrets #文件名可以不一样, but in/etc [[email protected] ~]# cat/etc/rsyncd.secrets123[[email protected] ~]# chmod 600/etc/ Rsyncd.secretsSynchronizing data on
Assume that there are two linux systems A as the server and B as the backup machine. You need to install rsync software on Ah AB to run the rsync daemon on system, system B regularly backs up data specified by system A through the crontab daemon to implement data backup.
Server Configuration1. Run the command to check
Rsync + inotify for real-time server backup
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'
What are the restrictions on rsync backup? -- Linux Enterprise Application-Linux server application information. For details, refer to the following section. Environment: Install cwrsync_server_2.0.10_installer.zip in win2003
Linux AS4 U2 installation rsync-2.6.3-1
Objective: To back up win2003 data to Linux
Test backup
he is not for the directory backupImproved backup.shVim backup1.shCmd= "/usr/local/inotify-tools-3.14/bin/inotifywait"$cmd-mrq--format '%w%f '-e create,close_write,delete/data|\While Read lineDo[!-e "$line"] continueRsync-az--delete $line [email protected]::bier--password-file=/etc/rsync.passwordDoneWhen the file does not exist, it continue and avoids errors, so this script can be used to create a simple file backup usingFour, according to the direc
Real-time file backup using Linux commands-incron, rsync, and inotify
I,Rsync, incronIntroduction
For details about the rsync tool and its use with the cron tool for Scheduled backup, refer to the blog: http://blog.csdn.net/wangjun2008/article/details/4268539;
Inotify is a f
First, the service side settings1. Modify server-side configuration# vi/etc/rsyncd.confModify:UID = Nobody # This option specifies the UID that the daemon should have when the module transmits the file. The default value is "nobody".GID = Nobody # This option specifies the GID that the daemon should have when the module transmits files. The default value is "nobody".Max connections = 4 # Maximum number of connections is 4Use chroot = no # no chrootLog file =/var/log/rsyncd.logPID file =/var/run/
program has been suspended state[Email protected] ~]$ Inotifywait-r-e modify,create,delete/tmpsetting up watches. Beware:since-r is given, this could take a while! Watches established.Then /tmp create a new file in the directoryTouch/tmp/newfileThe inotifywait process exits and outputs the following information/tmp/create NewFileSynchronizing changes with rsyncRsync is a fast incremental backup tool. It has several features that make it ideal for us
end of a string.Example:C:\Documents and Settings\user>echo%date%2012-08-08 WednesdayC:\Documents and Settings\user>echo%date:~5,10%08-08 Week ThreeC:\Documents and Settings\user>echo%date:~5,4%08-0C:\Documents and Settings\user>echo%date:~5,5%08-08Cwrsync Command Explanation:Rsync.exe--delete-az "/cygdrive/d/adbackup/addata" [email protected]::adbackup--password-file=]/cygdrive/d/ Adbackup/command/cwrsync/pass.txt "--delete-az de-sync to keep both ends of the file consistent"/cygdrive/d/adback
LSYNCD on which server to start, this server is like when the server is synchronized, other servers if more files will be deleted, fewer files will be synchronized from this server.
Modifying the contents of the file will also be synchronized
Rsync can achieve synchronization/backup of files, install configuration step to Linux under rsync
, files are moved into the monitored directoryIn_create, create a new file or subdirectory in the monitored directoryIn_delete, file or directory is deletedIn_delete_self, self-deletion, that is, an executable file deletes itself when executedIn_move_self, self-moving, that is, an executable file moves itself at execution timeTest creationTest Deletetest off - writetest shutdown - when writing, creation can also monitorSimplified outputSometimes the restart will fail , so put it in the rc.local.
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.