I. INTRODUCTION
Rsync's common 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, so that the local and remote two of the host file synchronization between, it is mainly the transmission of the two files, rather than the entire transmission every time, so the speed is very fast.
Rsync it can be paired with rsh or SSH, or it can be used as a direct socket connection in daemon mode, so rsync can be used as an excellent backup tool.
This is a simple introduction to the basic method of using rsync to back up remote network host files.
Here, we're working with rsync as a daemon mode for Linux.
First, give a simple definition: Of course, a host running rsync daemon mode, we call this machine is a rsync server, or this host is a backup host (Backup Server).
The backup host opens a port of 873 and waits for the other rsync connection. So the server remembers to open this port.
When you connect, rsync Server checks to see if the password matches, and if you check by password, file transfer begins.
When the first connection completes, the entire file is transmitted once, and the next time it transmits only the parts of the two files.
These are the operating methods of rsync client (remote network host to be backed up) and Rsync server.
With the above method, we can also set up several backup hosts, so that the important files on the network can be dispersed to several hosts to spread the risk.
Once the backup is complete, we can do further storage of these backup hosts, such as using tar as a package for tar, backing up the files to the hard drive, and so on.
The following content, I use Ubuntu 7.10 as a client, Centos5 do server testing.
Two. Installation method
The latest version of Rsync is 2.6.8, which can be downloaded to rsync.samba.org.
If you use the RPM kit, please install it in the following way, of course rhel5 and CENTOS5 are installed by default
#rpm-IVH rsync*.rpm
#yum Install Rsync
Its profile location in/etc/rsyncd.conf, strange, I did not automatically generate this file, then we have to configure his own
Three. Set up Rsync server: (assuming this host name is rsync.x111.com)
The rsync server side has the following four items to set:
1. Planning to establish a backup directory area
2. Start the rsync in xinetd
3. Setting:/etc/rsyncd.conf
4. Set: Password file
The following are described in turn:
1. Planning the establishment of a backup directory area:
It is recommended that you prepare a larger and separate partition and have a backup directory in it so/blackup/x99
2. Start the rsync in xinetd
The system does not have XINETD installed by default.
# yum Install xinetd
#service xinetd Restart
#chkconfig rsync on
The above operation, mainly to open rsync this daemon, once there is rsync client to connect, XINETD will refer it to RSYNCD (port 873).
3. Set/etc/rsyncd.conf:
Global Settings
UID = root
GID = root
Use chroot = no # chroot not used
Max connections = 4 # Maximum number of connections is 4
PID file =/var/run/rsyncd.pid
Lock file =/var/run/rsync.lock
Log file =/var/log/rsyncd.log # logging Files
The following section, which represents an open setting for an Rsync client host, has a simple template as follows:
[X99]
Path =/blackup/x99/x99_backup
Auth users = X99_backup
Secrets file =/etc/rsyncd.secrets
Read Only = no
Note of the above file:
[X99] represents the host code to be backed up, and the name is set themselves.
Path is used to set up the backup files to be stored in that directory. This can be mkdir open, you can set up
Auth users on behalf of the authorized account, you can set up their own.
Secrets file represents the password file where the account password is stored, and the path file name that is placed.
Of course, this backup host can accommodate many rsync client connections, as long as the corresponding sections are set in the rsyncd.conf.
The following example, representing two hosts x99 and X100 want to back in:
[X99]
Path =/blackup/x99/x99_backup
Comment = XXXXX
Auth users = X99_backup
Secrets file =/etc/rsyncd.secrets
Read Only = no
[X100]
Path =/blackup/x100/x100_backup
Auth users = X100_backup
Secrets file =/etc/rsyncd.secrets
Read Only = no
4. Set Password file:
Rsyncd.secrets content is very easy, the format is "account: password";
As the following example:
X99_backup:x99pass
Attention! The above set is just an example, you must not set your own to apply directly.
Next, the file attribute of rsyncd.secrets This password file should be set to root, and the permissions should be set to 600, otherwise the backup cannot be successful!
So, please:
#chown Root.root Rsyncd.secrets
#chmod rsyncd.secrets
At this point, rsync server This end has been set up, if you want to view the backup log.
#tail-F/var/log/rsyncd.log
Next is the client side (that is, the network host to back up) settings.
current 1/2 page
1 2 Next read the full text