Install Rsync
The code is as follows |
Copy Code |
wget http://rsync.samba.org/ftp/rsync/rsync-3.1.0.tar.gz Enter directory after decompression ./configure–prefix=/usr/local/rsync Make Make install Vi/etc/xinetd.d/rsync |
Change the original yes to No
The code is as follows |
Copy Code |
Service rsync { Disable = no Socket_type = Stream wait = no user = root Server =/usr/bin/rsync Server_args =–daemon Log_on_failure + + USERID } |
Start rsync with System
code is as follows |
copy code |
#chkconfig rsync on Vi/etc/rsyncd.conf #rsync configuration file Secrets file =/etc/rsyncd.secrets MOTD file =/ETC/RSYNCD.MOTD Rad>list = yes UID = root GID = root Use chroot = no Max connections = 5 Log file =/var/log/rsyncd.log PID file =/var/run/rsyncd.pid Lock file =/var/run/rsync.lock # Remote Sync Configuration module [Home] Comment = Home~~sync Directory Path =/home/ Auth users = Test [Root@localhost web]# Vi/etc/rsyncd.secrets Test:3pfesfesrserwdrsererwx [Root@localhost web]# chown Root.root/etc/rsyncd.secrets [Root@localhost web]# chmod 600/etc/rsyncd.secrets # VI/ETC/RSYNCD.MOTD |
RSYNCD.MOTD records the welcome information for the Rsync service, where you can enter any textual information, such as:
Welcome to use the rsync services!
Start:
The code is as follows |
Copy Code |
#/usr/bin/rsync–daemon or #/usr/local/rsync/bin/rsync–daemon
|
View Startup:
The code is as follows |
Copy Code |
PS aux | grep rsync |
Client Connection use:
The code is as follows |
Copy Code |
/usr/bin/rsync-vzrtp–progress–port=874–delete–password- File=/etc/rsyncd.client test@ your ip::home/web/shanmao.me/home/web/.
/usr/local/rsync/bin/rsync-vzrtp–progress–password-file=/etc/rsyncd/xx.sec.client test@ your ip::home/web/mxxa_com. /home/web/ |
All done, and then you can sync it with rsync!!!
Example
The code is as follows |
Copy Code |
Rsync-avz--password-file=/var/rsync/rsync.pass/home/html/web rsync_user_12@ 192.168.0.120::web |
We have a password here, if you set the password can
Create a password profile: vi/var/rsync/rsync.pass.conf
Write user name and password:
The code is as follows |
Copy Code |
/var/rsync/rsync.pass.conf Rsync_user_12:@23ysffa |
3. Open a service process for rsync/usr/local/rsync/bin/rsync--daemon
4. The client also installs rsync, the configuration password file:/var/rsync/rsync.pass
[Problems encountered]
1. Wrong password
@ERROR: Auth failed on module tee
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1522) [receiver=3.0.3]
Engaged in a long time, the password has been wrong, had to ask the high talent know rsync password configuration file permissions must be set to 600 before you can, change, fix!
2. Synchronized files, owner has become MySQL
Rsync will be the original source host file UID and GID to the target host, the source host directory owner is www, uid:502 gid:502, target host uid:502 gid:502 is MySQL, so decisively target host/etc/p ASSWD,/etc/group www user and MySQL user uid gid for a change, and then reboot the server, fix!!