users required) for easy and secure data backup and image backup1.3 Rsync Common options-V (--verbose): Verbose mode output, which shows the progress information at the time of transmission-Z (--compress): Data compression on transmission,--compress-level= number, can be compressed according to the compression level-A (--archive): archive mode, which means to transfer files recursively and keep all file at
/share/man/man1/rsync.1.gzYum install xinetd # Only install xinetd. in CentOS, xinetd is used to manage the rsync service.Yum install rsync xinetd # if no rsync exists by default, run this command to install rsync and xinetdVi/etc/xinetd. d/
[-- exclude option and -- exclude-from option] if you do not want to synchronize something to the target end, you can use the-exclude option to hide it, rsync attaches great importance to privacy. you can use the-exclude option multiple times to set a lot of "privacy ". If you want to hide too much privacy, setting it in the command line option will be troublesome, and rsync is still considerate. It provid
contains a single colon ":" delimiter when the mode is started.3. Use a remote shell program (such as rsh, SSH) to copy the contents of the remote machine to the local machine. When SRCThe address path contains a single colon ":" delimiter when the mode is started.4. Copy files from the remote rsync server to the local machine. This mode is started when the SRC path information contains the "::" delimiter.5. Copy files from the local machine to the r
= no #修改为no
/etc/init.d/xinetd start #启动 (CentOS is xinetd to manage rsync services)
4. Create the authentication password file
Vi/etc/passwd.txt #编辑文件, add the following
123456 #密码
: wq! #保存退出
chmod 600/etc/passwd.txt #设置文件权限, only set the file owner to have read, write permission
5, test the source server 192.168.21.129 to the two target server 192.168.21.127,192.168.21.128 data synchronization between
Mkdir/home/www.111cn.net/ceshi #在源服务器上
the –exclude option multiple times to set a lot of "privacy."If you want to hide too much privacy, setting in command-line options will be cumbersome, rsync is very thoughtful, it provides the –exclude-from option, so you can put the privacy one by one in a file, and then let rsync directly read this file just fine.[–partial Options]This is the legendary function of the continuation of the breakpoint. By d
option will be troublesome, and rsync is still considerate. It provides the-exclude-from option, this allows you to list privacy in one file, and then let rsync directly read the file. [-- Partial Option] This is the legendary resumable upload function. By default, rsync deletes the files that are interrupted by transmission and re-transmits the files. However,
follows
Copy Code
[Root@web2 ~]# rsync-avzp--delete--password-file=/etc/rsyncd/rsyncd.password apache@web1::webhome/var/www/html/Receiving incremental file list./Index.html100% 21.48kb/s 0:00:00 (xfer#1, TO-CHECK=1/3)Newpage.html100% 0.63kb/s 0:00:00 (xfer#2, TO-CHECK=0/3)Sent bytes received 264 bytes 728.00Total size is speedup is 0.13
Description
--delete: Local and server exactly the same, if there is a different local, t
--partial
--progress Display backup process
-Z,--compress compression of backed-up files on transfer
--EXCLUDE=PATTERN Specifies to exclude file modes that do not require transfer
--INCLUDE=PATTERN Specifies the file mode that is not excluded and needs to be transferred
--exclude-from=file exclude files in the specified mode in file
--include-from=file does not exclude files that match the file-specified pattern
--version Print version Information
--a
matters1 hint that the password file can not be read, you need to manually enter the password, may be the password file permissions are not 600, or the format is wrong, or the wrong path.2 prompts to create a new directory or file transfer failure, may be synchronized directory does not have permissions, it is best to sync the directory permissions to modify to 744.3 from the client synchronization files to the server, the best single file directory transmission, or error prone.
.
can also be added to the/etc/rc.d/rc.local to allow the system to automatically start and so on.
Client synchronization
rsync-Parameter user name the contents of the square brackets (module name) in the ip::rsyncd.conf of the @ synchronization server are stored locally as:
Rsync–vzrtopg–delete--progress--exclude "*.log" Lansgg@192.168.182.130::lansggtest/ro
.RSYNCD.MOTD (Configuration welcome information, optional)# VI/ETC/RSYNCD.MOTDRSYNCD.MOTD records the welcome information for the Rsync service, where you can enter any textual information, such as:Welcome to use the rsync services!4, let the configuration effective#service xinetd Restart
Third, start rsync server
Two ways to start an
the words installed:# yum-y Install rsync
To perform an asynchronous synchronization operation:
/usr/bin/rsync-avz--progress rsync@192.168.3.191::backup /www
# crontab-e # (You can sync files every three minutes at timed time)
*/3
* * * * Rsync
Rsync random start script and rsync script
Server
1 #!/bin/sh 2 # chkconfig: 2345 21 60 3 # description: Saves and restores system entropy pool for \ 4 #create by xiaohu 5 #2014.06.02 6 #This script is the Rsync service script 7 . /etc/init.d/functions 8 case "$1" in 9 start)10 echo "rsync is starting"11
/etc/rsyncd. scrtMsyn: xxxxxxxxxIn addition, this file can only be read and written by the root user. Note that for security purposes, the attribute of this file must only be readable by the owner; otherwise, rsync will refuse to run. We can set its property to 600:[Root @ www/etc] # chmod 600/etc/rsyncd. scrt[Root @ www/etc] # mkdir/var/log/rsyncAfter these files are configured, you need to start the rsyncd service on the master server:[Root @ www/et
/rsync-avz -- progressRsync@192.168.3.191: backup/Www
# Crontab-e # (files can be synchronized every three minutes at a scheduled time)*/3
* *** Rsync-avz -- progress
Rsync@192.168.3.191: backup
/Www
The following command is complete:
# Vi/etc/rsyncd. pasAdd PasswordRsyncofpassNote that the password file on the client
This article by show according to Lin Feng to provide friendship sponsorship, starting in the mud row world. Just have a few days to start learning Linux file synchronization software rsync, when learning rsync, we can be divided into the following several steps: 1. What is rsync? 2. How rsync Works 3.
service
Rsync Client Setup steps
1. Install rsync software (omitted)
2. The client generates a Verification Certificate file.
# Echo "cmscms">/etc/rsyncd. pwd cmscms is the password
# Chmod 600/etc/rsyncd. pwd
3. Test
Run the following command to test whether the rsync client can synchronize with the rsync server:
#/
maintenance www.osyunwei.com warm reminder: qihang01 original content copyright, reproduced please indicate the source and the original link3. Installing the Rsync client softwareWhereis rsync #查看系统是否已安装rsync, the following prompt appears stating that you have installedRsync:/usr/bin/rsync/usr/share/man/man1/
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.