--delete devilzy@192.168.152.154::html/home/html--PASSWORD-FILE=/ETC/RSYNCD.PW
Uploading files to the server side
/USR/BIN/RSYNC-VZRTOPG--progress--password-file=/root/rsyncd.pw/home/index Devilzy@192.168.152.154::index
/USR/BIN/RSYNC-VZRTOPG--progress--password-file=/root/rsyncd.pw/home/html devilzy@192.168.152.154::html
This command backs up all files (includin
three target trees to be backed up. The backup users authorized by the three modules are msyn, msyn, and 98syn, respectively. The user information is stored in the file/etc/rsyncd. scrt and/etc/rsync98.scrt. The content is as follows:
[Root @ www/etc] # cat/etc/rsyncd. scrt
Msyn: xxxxxxxxx
In 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,
/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
)
# Rsync-vzrtopg -- progress -- password-file =/etc/rsync. pas/backup/web/rsync@10.0.0.10: backup
This command backs up all files (including subdirectories) in the local machine/web directory to the backup directory set by the backup module of rsync server (10.0.0.10.
Note
, which can be used as the Rsync of the client without enabling port 873)
3. Install the Rsync client software
The Code is as follows:
Whereis rsync # Check whether rsync has been installed in the system. The following prompt is displayed, indicating that rsync has been inst
! 192.168.152.155 -- dport 873-J Drop In this case, only the Client IP 11.22.33.44 can enter this rsync server.
7. Configure rsync Client 1. Set the password # Vi/etc/rsyncd. pw 111111 Modify permissions # Cd/etc # Chown root. Root rsyncd. pw # Chmod 600 rsyncd. pw 2. Connect the client to the server Retrieving files from the server /Usr/bin/rsync-vzrtopg -- Prog
absolute paths
When you synchronize later, only the new content is synchronized.
Finally, the above command is added to the scheduled task to synchronize.
Possible problems:
Firewall port Development issue: Iptables-a input-p tcp-m State--state new-m TCP--dport 873-j ACCEPTPermission problem, write permission required
Step Two: Sersync+inotify to achieve synchronization
Before using Sersync, we must install the
Deployment 4.1 Inotify-slave Deployment 4.1.1 Check if rsync is installed 4.1.2 Create a new rsync user and Module directory and change its user group 4.1.3 Writing the rsync daemon configuration file/etc/rsyncd.conf 4.1.4 Configuring a virtual user's password file 4.1.5 Start rsync Service 4.1.6 via Inotify-master te
, and add it to the exclude list. This is equivalent to using--exclude in the client command to specify the pattern, although the Exlude mode specified in the configuration file is not passed to the client and is applied only to the server. A module can specify only one exlude option, but it is possible to use "-" and "+" in front of the pattern to specify whether it is exclude or include #这个我的理解是排除目录中不需同步的文件# Exclude From = #可以指定一个包含exclude模式定义的文件名#
/init.d/iptables Restart #最后重启防火墙使配置生效System operation and 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/
[-- 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
authentication information.
The installation is complete.1.3 Use cwrsync 1.3.1 open cmd on windows (command prompt)
After the command is opened, switch the cmd path to the bin directory of the cwrysnc installation directory as the working directory.
1.3.2 push test on window
C: \ Users \ Administrator \ Desktop \ cwRsync_5.5.0_x86_Free \ bin> rsync.exe-avzP./cwRs
Ync_5.5.0_x86_Free.zip rsync_backup@
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 functio
Use rsync and crond servers for WEB Service backup, rsynccrondBack up WEB services using rsync and crond serversScenario:A company has a Web server. The data in the server is very important, but if the hard disk breaks down, the data will be lost.Now the leaders ask you to back up data on other machines. The requirements are as follows:At every night, package the backup system configuration files, website p
is used, rsync synchronizes data first, and then delete the files to be cleared. If you see so many delete operations, do you have a trembling liver? Indeed, in the official instructions of rsync, This option can be dangerous if used incorrectly! It is a very good idea to run first using the dry run option (-n) to see what files wocould be deleted to make sure important files aren't listed. in this sentenc
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.
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.