Rsync installation configuration basic tutorial

  
 

A. Introduction to rsync's commonly used backup tool, which is currently maintained by rsync.samba.org.

rsync uses the so-called "rsync algorithm" to provide a very fast file transfer method, The file between the local and the remote two hosts is synchronized. It mainly transmits the transaction part of the two files instead of transmitting it all at once, so the speed is quite fast.

rsync it can With rsh or ssh, you can also use direct socket connection as daemon mode, so rsync can be used as an excellent backup tool.

I will briefly introduce the basic method of using rsync to back up remote network host files. Here, we are running rsync as a daemon mode of linux. First, let's give a simple definition: Of course, if a host runs the rsync daemon mode, we call this machine an rsync server, or this. The host is a backup server (Backup Server). The backup host will open a port of 873, waiting for the other party to rsync the connection. So the server remembers to open the port connection, rsync Server will check if the password matches, if passed After the password check, the file transfer starts. When the first connection is completed, the entire file will be transferred once.

The next time, only the changed part between the two files will be transmitted.

The above is how the rsync client (the remote network host to be backed up) and the rsync server operate.

Implementation: I want to synchronize the file under the server/webapps/wwwroot to /webapps/wwwroot on the backup machine

Second, install the download address: http://rsync.samba. Org/ftp/rsync/src/rsync-3.0.4.tar.gztar zxvf http://rsync.samba.org/ftp/rsync/src/rsync-3.0.4.tar.gzcd rsync-3.0.4./Configure --prefix=/usr/local/rsyncmake make install

Three: Configuration: Rsync server: No configuration files installed by default: mkdir /usr/local/rsync/logs mkdir /usr/local/rsync/Etc mkdir /usr/local/rsync/run add the main configuration file: vim /usr/local/rsync/etc/rsyncd.conf

uid = rootgid = rootport = 873use chroot = nohosts allow = 192.168.9.3# Hosts deny = 192.168.10.0/24pid file = /usr/local/rsync/run/rsyncd.pidlock file = /usr/local/rsync/run/rsync.locklog file = /usr/local/rsync/logs/rsyncd.logignore Errors

[9aiyx]path = /webapps/wwwrootauth users = 9aiyxsecrets file = /usr/local/rsync/rsyncd.passread only = no

Add password file: vim /usr/local/The format rsync/rsyncd.pass is as follows: Username: Password 9aiyx :9aiyx then gives 600 permissions: chmod 600 /usr/local/rsync/rsyncd.pass

Start rsync service: rsync --daemon --config=/usr/local/rsync/etc/rsyncd.conf & ; (and added to the rc.local file)

Rsync client:

Add password file: vim /root/rsyncd.pass (only password can be written inside) 9aiyxchmod 600 /root The /rsyncd.pass installation procedure is the same as above: Then execute the following command: rsync -arP --password-file=/root/rsyncd.pass [email protected]::9aiyx /webapps/wwwroot & or specify the task plan synchronization.

Security Settings: iptables -A INPUT -p tcp -s ! 192.168.9.3 --dport 873 -j DROP Only allows hosts with 192.168.9.3 to connect to rsync server

Copyright © Windows knowledge All Rights Reserved