Yesterday, mysql synchronization was done well, and today, by the way, the website code synchronization research. Online search for rsync, unison and other software can achieve synchronization. Looked at the vps already installed rsync, then use this. The process of installing rsync is ignored, you can use yum or apt-get to install, you can also download it on the official website: http://rsync.samba.org
The current environment is, two fixed ip Linux server, to achieve a regular synchronization of a directory of server A to server B. So I want to treat A as the rsync server and B as the rsync client.
Configure A first:
A is centos above, use xinetd to run rsync. In general, xinetd is also included in the system, and there is no yum.
Modify the rsync startup file in xinetd: vi /etc/xinetd.d/rsync
Change the disable=yes to disable=no, the complete code is as follows: # default: off # description: The rsync server is a good addition to an ftp server, as it \\# allows crc checksumming etc.service rsync{disable = noflags = IPv4socket_type = streamwait = nouser = rootserver = /usr/bin/rsyncserver_args = --daemonlog_on_failure + = USERID}
Next modify the rsync configuration file, located in /etc/rsyncd.conf, if not, you can create a new one: uid = root # run root as gid = rootuse chroot = nomax connections = 5 # simultaneous connection Number pid file = /var/run/rsyncd.pidlock file = /var/run/rsyncd.locklog file = /var/log/rsyncd.logtransfer logging = yesport = 873 #用港口[www]#module name, just fill the read Only = yes #yes is read only path = /home/www # directory to be synchronized (multiple separated by spaces) comment = www #best as the module name auth users = rsync #allow which users are allowed to synchronize (required later Set) secrets file = /etc/r Sync.pas #userprofile (username+password)hosts allow = 111.111.111.111 #ip address allowed for synchronization exclude = tmp/123/#不sync directory (relative path, multiple spaces separated)
Create a file to store the key, the location of the secrets file above: Username: Password
eg
admin:admin
Start xinetd, see rsync can No, the port 873 is occupied.
You can test it with telnet on server B. If you can configure iptables, you need to open port 873.
The next step is to configure the client. Since it is not a two-way synchronization, just install rsync.
Set the key file (read from inside rsync runtime). My put in /etc/rsync.pas, the content is the password set above.
The following can be performed by synchronizing the rsync command: rsync -avz --password-file=/etc/rsync.pas [email protected]::www /home/www
avz I will not explain these parameters, and the parameters provided by rsync are much better.
--password-file is the above key file, @ is the account set by the server before, @ is the ip of the server, @:www is the module name, sync to the local /home/www directory .
If the command is executed successfully, you can add the above command to the crontab to achieve timed file synchronization.
Add ftp user in linux, and set the corresponding permissions, the operation steps are as follows: 5
According to the bus structure, it can be divided into a bus type and a non-bus type. As we often
A.Linux files can be divided into four types: ordinary files, directory files, link files, and devi
The network is often dropped. Many technicians think that the router is unstable. The ac
Linux system PPPoE broadband connection setting method
Linux common troubleshooting instructions (on)
Copy and paste shortcuts under Linux
Neighbor subsystem of linux protocol stack (garbage collection seven)
Win7 boom will continue until 2013
How to manually clear or refresh the SWAP partition of Linux
Powerful screen commands in Linux systems
Win8 system function start/stop and disable graphic tutorial
Zombie Besieged City 1case1 Clearance Raiders Zombie Besieged City 1case1 How to Play
Windows Home Theme Installation
Windows2003 server IIS enabled Gzip compression
Win7 system laptop graphics card can be changed?
Russia's WP8 market share declines, need to work harder
How to enable or disable the guest account of Win8
How to use the DISM to repair Win8.1 system images
Lenovo notebook boot display Windows will not move
How to remove the Windows 8 system icon Xiao Huang lock restrictions