Article Title: Synchronous backup of rsync files from linux to linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
I. Environment
Server (server) for file backup: 192.168.1.201 (RHEL 5)
Server (client) receiving backup files: 192.168.1.202 (CENTOS 5)
Ii. installation and configuration
1. Server Configuration
A. Use rsync installed by default to edit the/etc/rsyncd. conf file. If not, create A new file.
Vi/etc/rsyncd. conf
# [Globale]
Strict modes = yes # check passwd file
Port = 873 # default port
Logfile =/var/log/rsyncd. log
Pidfile =/var/run/rsyncd. pid
Max connections = 4
# [Modules]
[Testlink] # backup module
Uid = root
Gid = root
Path =/usr/local/apache/htdocs/testlink/upload_area # directory to be backed up
Read only = no
Host allow = *
Auth users = wwyhy
Secrets file =/etc/rsyncd. scrt
[Bugfree] # backup module
Uid = root
Gid = root
Path =/usr/local/apache/htdocs/bugfree/BugFile # directory to be backed up
Read only = no
Host allow = *
Auth users = wwyhy
Secrets file =/etc/rsyncd. scrt
[Redmine] # backup module
Uid = root
Gid = root
Path =/usr/local/redmine-0.8.1/files # directory to be backed up
Read only = no
Host allow = *
Auth users = wwyhy
Secrets file =/etc/rsyncd. scrt
B. Add a password file.
Vi/etc/rsyncd. scrt
The content is as follows:
Wwyhy: 123456 # (set by yourself)
C. Change the permission to 600
Chmod 600/etc/rsyncd. scrt
D. Start the Service (if a firewall is enabled, allow port 873 to pass through)
Rsync -- daemon -- config =/etc/rsyncd. conf &
2. Configure the client
On the client side, I compile and install the rsync-3.0.3.tar.gz file.
A. installation:
Tar-zxvf rsync-3.0.3.tar.gz
Cd rsync-3.0.3
./Configure
Make
Make install
B. Add a password file
Vi/etc/rsyncd. scrt (new if no)
The content is as follows:
Wwyhy: 123456 (the file is the same as the client file)
C. Change the File Permission to 600.
Chmod 600/etc/rsyncd. scrt
Iii. Start backup
You can run the man rsync command on the client to view the BACKUP command.
We use scripts to automatically perform backups.
Column: rsync-avz -- password-file = password file path username @ host IP address to be backed up: Module name in backup
Path for receiving backup files
Create a script file in/root
Vi backup
Add the following content:
# Testlink attachment BACKUP command on 1.192.168.1.201
Rsync-avz -- password-file =/etc/rsyncd. scrt wwyhy@192.168.1.201: testlink
/Home/wangwei/testlink/upload_area
#2.192.168.1.201 bugfree attachment BACKUP command
Rsync-avz -- password-file =/etc/rsyncd. scrt wwyhy@192.168.1.201: bugfree
/Home/wangwei/bugfree/BugFile
#3.192.168.1.201 backup commands for redmine attachments
Rsync-avz -- password-file =/etc/rsyncd. scrt wwyhy@192.168.1.201: redmine
/Home/wangwei/redmine-0.8.1/files
Chmod u + x backup
Automatic Execution At 2.30 per night
Vi/etc/crontab
30 2 *** root/backup