rsync is a data mirror backup tool under Linux system. Rsync can back up local system data to any remote host through network. rsync has the following features:
The entire directory tree and file system can be mirrored to incrementally synchronize data, and file transfer efficiency is high, so the synchronization time is short. You can maintain the permissions, time and other attributes of the original file. Encrypted data transmission ensures data security. Then we will introduce the use of rsync in detail through examples. Here we assume that there are two Linux systems, A and B. The A system runs the service, and the B system acts as a remote disaster recovery backup machine for A. Then the A system is the server of rsync. The B system is the client of rsync. The rsync software needs to be installed on both A and B systems. In this way, the rsync daemon is run on the A system, and the B system can periodically back up the data specified on the A system through the system daemon crontab. Thereby achieving remote disaster tolerance of data. Our installation environment is: Operating system
: Red Hat Enterprise Linux Server release 5 kernel version: Linux web 2.6.18-8.el5A system IP address: 192.168.60.253B system IP address: 192.168.60.231 ( 1) Install the home page address of rsyncrysnc on both A and B systems: http://rsync.samba.org/, the version we downloaded here is rsync-3.0.4, and then compile and install: [root@web ~ ]#tar zxvf rsync-3.0.4.tar.gz [root@web ~]#cd rsync-3.0.4[root@web rsync-3.0.4]# ./configure[root@web rsync-3.0.4] # make[root@web rsync-3.0.4]# make install This completes the rsync installation. (2) Configure the rsyncrsync configuration file on the A system as /etc/rsyncd.conf. After rsync is installed, the default is no such file. We can manually create one. The rsyncd.conf file is composed of one or more module structures. The file consists of global parameters and module parameters. A module definition starts with the module name in square brackets until the definition of the next module begins. The configuration is as follows: uid = nobodygid = nobodyuse chroot = nomax connections = 10pid file = /var/run/rsyncd.pidlock file = /var/run/rsync.locklog file = /var/log/rsyncd.log
[ixdba]path = /webdatacomment = ixdba fileignore errorsread only = truelist = falseuid = rootgid = rootauth users = backupsecrets file = /etc/server.pass The meaning of each of the above options is explained as follows: uid This option specifies when The user ID that the daemon should have when the module transfers files. The default value is  quo;nobody”. gid This option specifies the user group ID that the daemon should have when the module transfers files. The default value is “nobody”. max connections This option specifies the maximum number of concurrent connections for the module to protect the server. Connection requests that exceed the limit will be temporarily restricted. The default value is 0, which means there is no limit. Pid pid file This option is used to specify the path of the PID file corresponding to the rsync daemon. lock file This selection specifies a lock file that supports max connections. The default value is /var/run/rsyncd.lock. log file This option specifies the log output file path for rsync. [ixdba] indicates the beginning of defining a module, and ixdba is the corresponding module name. path This option is used to specify the file or directory to be backed up. It is required. The directory specified here is /webdata. list This option sets whether the module is listed when the client requests a list of modules that can be used. The default value is true if you need to create a hidden module. Can be set to false. auth users This option is used to define the username that can be connected to the module. Multiple users are separated by spaces or commas. It should be noted that the users here have nothing to do with the Linux system users. The user specified here is backup. secrets file This option specifies a file containing the “username: password” format. The user name is the user defined by the “auth users” option. The password can be specified as long as it matches the client's secrets file. This file only works if auth users are defined. The system does not have this file by default, you can create one manually. (3) Start the rsync daemon on the A system and execute the following command to start the rsync daemon: [root@web ~]# /usr/local/bin/rsync --daemon[root@localhost /]# ps -ef| Grep rsyncroot 20278 1 0 16:29 ? 00:00:00 /usr/local/bin/rsync --daemon(4) Configure rsync on the B system. Do not make any settings on the backup machine. Just perform rsync synchronization. In order to avoid the password during the synchronization process, you need to create a secrets file on the B system. The content of this file is the password of the user specified in the "system" rsyncd.conf file, and the name of the file and The path can be specified at will, as long as it is specified during rsync synchronization. Next, perform the synchronization operation, please see the following command: [root@web~]# /usr/local/bin/rsync -vzrtopg --delete --progress [email protected]::ixdba /ixdba.net --password- File=/etc/server.pass describes the meaning of each parameter in this command as follows: “--vzrtopg” The option v is ““—verbose”, that is, the detailed mode output, z means “ld”; Compress” That is, the backup file is compressed during transmission, and r means “-recursive”, that is, the subdirectory is processed in recursive mode. t is “--times”, used to maintain file time information, o ie “--owner” used to maintain file owner information. p is “--perms” is used to maintain file permissions, g is “--group” used to maintain the file group information. “--delete” option specifies data mirroring synchronization based on the rsync server, that is, to maintain the consistency of the rsync server directory with the client directory. Here, it is synchronized based on the A server. “--progress” option is used to display the process of data mirror synchronization. “[email protected]::ixdba” indicates that the ixdba module in the server 192.168.60.253 is backed up, that is, the module that specifies the backup, and the backup indicates that the user backs up the module using "backup". “/ixdba.net” is used to specify the backup path of the backup file on the client machine, that is, the backup file is stored in the /ixdba.net directory of the backup machine. “--password-file=/etc/server.pass” is used to specify the location of the password file stored on the client, so that the client does not need to enter the interactive password when executing the synchronization command. Note that the name of the password file and The location can be specified at will, but this file must exist on the client. The content of the file is only the password of the backup user. This refers to the password of the backup.
6. Sfdisk & ndash; backup partition table If you install multiple systems, it can easily lead to
STM32 The storage medium corresponding to the three boot modes is the three boot modes corresponding
Linux supports sharing open files between different processes. To illustrate file sharing, lets firs
With Windows for a long time, it will inevitably start to lack freshness, so some people will try to
OpenSSL installation and configuration tutorial under Windows
What is the difference between Linux process priority NI and PR?
12 Linux Process Management Commands Introduction
Linux operating system three ways to configure environment variables
How to fix Linux can not start failure
linux compile Analysis of Common Errors
Fedora Features - Smolt solves hardware compatibility problems
Win7 computer installed graphics card after the blue screen how to do
Linux file search technology Daquan
Windows XP system broadband application skills
How to install Eclipse and PyDev extensions in Ubuntu 14.04?
Super hegemony function analysis
The computer can start at night and can't start what happened in the evening
Win10 system prompts "The current page script has an error" What should I do?
Windows 7 beta trial experience