-get:
sudo apt-get install rsync
basic usage of rsync
The basic language of rsync is structured as follows:
Rsync Parameters Source File file
Here are a few of the most common parameters: the-v:verbose model, which outputs more detailed messages. -R: Recursive is equipped with all subdirectories and files. -A: The enclosure mode, as in the case of-rlptgod, is to be transferred to all subdirectories and files, retaining the link, the owner of the file, the group, the rights, and the time stamp
-AVH--port=873--progress--delete/home/www.111cn.net/home_www.111cn.net_user@192.168.21.127::home_ Www.111cn.net--password-file=/etc/passwd.txt
RSYNC-AVH--port=873--progress--delete/home/www.111cn.net/home_www.111cn.net_user@192.168.21.128::home_ Www.111cn.net--password-file=/etc/passwd.txt
After the operation is completed, the two target servers are 192.168.21.127,192.168.21.128 on each other, and the Ces
/RSYNC.PASSCchmod 600/ETC/RSYNC.PASSC②, perform data synchronization test operations:RSYNC-AVH--port=873--progress--delete [email protected]:jumpserver--password-file=/etc/rsync.passc/data/ jumpservertest/(v in-VZRTOPG in command line is Verbose,z is compression, R is RECURSIVE,TOPG is the parameter that keeps the original property of the file as owner, time. --progress is the display of detailed progress,--delete is that if the server side delete the
following 2-line command on the source serverRSYNC-AVH--port=873--progress--delete/home/www.osyunwei.com/[email protected]::home_www.osyunwei.com-- Password-file=/etc/passwd.txtRSYNC-AVH--port=873--progress--delete/home/www.osyunwei.com/[email protected]::home_www.osyunwei.com-- Password-file=/etc/passwd.txtAfter the completion of the operation, respectively on the two target server 192.168.21.127,192.168.
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/rsync.1.gzYum Install xinetd #只安装xinetd即可, CentOS is a xinetd to manage rsync servicesYum Install rsync xinetd #如果默认没有rsync, run this command to install rsync and xinetdVi/etc/xinetd.d/rsyn
source serverRSYNC-AVH--port=873--progress--delete/home/www.osyunwei.com/[email protected]::home_www.osyunwei.com-- Password-file=/etc/passwd.txtRSYNC-AVH--port=873--progress--delete/home/www.osyunwei.com/[email protected]::home_www.osyunwei.com-- Password-file=/etc/passwd.txtAfter the completion of the operation, respectively on the two target server 192.168.21.127,192.168.21.128 view, in the/home/www.osy
123456#chmod 600/etc/password.txt # #设置文件权限,#rsync-AVH--port 873--progress--delete/var/www/html/[email protected]::web--password-file=/etc/password.txt # # #在 Tested on the source server and found it possible to back up the original server data to the target server#tar zxf inotify-tools-3.14.tar.gz # # # #安装inotify-tools#cd inotify-tools-3.14#./configure--prefix=/usr/local/inotify#make make InstallSet environment variables below and add soft links#ech
fs.inotify.max_user_instances=65535
: wq! #保存退出
Parameter description:
Max_queued_events:
INotify Queue Maximum Length, if the value is too small, there will be "* Event queue Overflow * *" error, resulting in inaccurate monitoring files
Max_user_watches:
How many directories are included in the file to sync, available by: Find/root/ceshi-type D | Wc-l statistics, the max_user_watches value must be guaranteed to be greater than the statistical result (here/root/ceshi is the synchronized file di
/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/rsync # Edit the configuration file and set rsync to start at startupDisable = no # Change to no/Etc/init. d/xinetd start # start (in CentOS, xinetd is used to manage rsync services)
4. create an authentication password file
Vi/etc/passwd.txt # edit the file
/rsync.passwdwebuser:password//user and password separated by semicolonsand set the 600 file properties:chmod 600/etc/rsync.passwdTo start the Rsync service:/usr/local/rsync/bin/rsync--port=873--address=192.168.121.129--daemonTo do a push test on the 192.168.121.128 (source) Host:RSYNC-AVH--delete--password-file=/etc/rsync.passwd/tmp/[email protected]::tmp#注意:/tmp directory default system is already there, if synchronization of other directories, the
This article is No. 9 in the O M of chinamoocs. It is too slow to update ,,
In O M, sometimes we need to delete large files, or n (n is infinite ~~) Multiple small files
So, RM,
Here, rocky introduces the most cute, gentle, mature, kind and kind of Linux in history.
This is another method of rsync.
① Syntax:
# Rsync -- delete-before-AVH -- Progress -- stats DEST SRC
Explanation:
When SRC and DEST are both objects [f], this indicates clearing t
In O M, sometimes we need to delete large files, or N (N is infinite ~~) Multiple small files
So, rm,
Here, Rocky introduces the most cute, gentle, mature, kind and kind of Linux in history.
This is another method of rsync.
① Syntax:
# Rsync -- delete-before-avH -- progress -- stats DEST SRC
Explanation:
When SRC and DEST are both objects [f], this indicates clearing the object content rather than deleting the object.
When SRC and DEST are both direc
to do this is to save the important data in a top-level directory, and then copy it to the external hard disk to back up the directory with the following command:rsync-avh/home/usr/dir//media/disk/backup/If you want to ensure that locally deleted files are also deleted on the external drive, you need to use the--deleted switch as follows:RSYNC-AVH--delete/home/user/dir//media/disk/backupUse this switch wit
= 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 #在源服务器上创建测试文件夹, and then run the following 2-line co
Install mysql-server #安装mysql数据库service mysqld start #启动mysql服务iptables-F #清空iptables规则mysql-uroot-p-e ' Create dat Abase discuzdatabase; ' #创建discuz数据库mysql-uroot-p-e ' Grant all on discuzdatabase.* to [email protected] '% ' identified by ' Youpass '; "#创建discuz用户并赋予管理discuzdatabase的权限mysql-uroot-p-e ' flush privileges; ' #刷新mysql权限To configure the Web service:# #注意事项: Due to some of the mechanisms of rsync+inotify, it is first fully configured on the RS1 discuz in the use of rsync synchroniza
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.