rsync file sync backup from Linux to Linux

Source: Internet
Author: User
Tags redmine rsync testlink man rsync

rsync file sync backup from Linux to Linux

First, the environment

Server (server side) that needs to back up files: 192.168.1.201 (RHEL 5)

Server (client) receiving backup files: 192.168.1.202 (CENTOS 5)

Second, installation configuration

1. Server-side configuration

A, using the system default installation of Rsync edit/etc/rsyncd.conf file, if not a new one.

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] #备份模块

uid= Root

gid= Root

Path=/usr/local/apache/htdocs/testlink/upload_area #要备份的目录

Read Only= No

Host allow= *

Auth users= wwyhy

Secrets file=/ETC/RSYNCD.SCRT

[Bugfree] #备份模块

uid= Root

gid= Root

Path=/usr/local/apache/htdocs/bugfree/bugfile #要备份的目录

Read Only= No

Host allow= *

Auth users= wwyhy

Secrets file=/ETC/RSYNCD.SCRT

[Redmine] #备份模块

uid= Root

gid= Root

Path=/usr/local/redmine-0.8.1/files #要备份的目录

Read Only= No

Host allow= *

Auth users= wwyhy

Secrets file=/ETC/RSYNCD.SCRT

B. Add a password file

Vi/etc/rsyncd.scrt

The contents are as follows:

wwyhy:123456 # (Set yourself)

C, change the permissions of 600

chmod 600/ETC/RSYNCD.SCRT

D, start the service (if you have a firewall, allow port 873 to pass)

Rsync--daemon--config=/etc/rsyncd.conf &

2. Configure the Client

Client I compiled my own installation of the rsync-3.0.3.tar.gz

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 (no new)

The contents are as follows:

wwyhy:123456 (file is the same as client file content)

C, change the file permissions to 600

chmod 600/ETC/RSYNCD.SCRT

Third, start the backup

The backup instructions can be viewed on the client via the man rsync command

We use the script to automate the backup.

Column: Rsync-avz--password-file= password file path [email protected] Host IP required for backup:: module name in Backup

Path to receive backup files

Build a script file in/root

VI Backup

Add content as follows:

192.168.1.201 Testlink Attachment Backup instructions on the #1.

Rsync-avz--password-file=/etc/rsyncd.scrt [Email protected]::testlink

/home/wangwei/testlink/upload_area

192.168.1.201 Bugfree Attachment Backup instructions on the #2.

Rsync-avz--password-file=/etc/rsyncd.scrt [Email protected]::bugfree

/home/wangwei/bugfree/bugfile

192.168.1.201 Redmine Attachment Backup instructions on the #3.

Rsync-avz--password-file=/etc/rsyncd.scrt [Email protected]::redmine

/home/wangwei/redmine-0.8.1/files

chmod u+x Backup

2.30 per night automatic execution

Vi/etc/crontab

2 * * * root/root/backup

    • This article is from: Linux Learning Tutorial Network

rsync file sync backup from Linux to Linux

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.