File sync backup from linux to linux

Source: Internet
Author: User
Tags gz file redmine rsync testlink man rsync
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.