Configure rsync to synchronize data to the Internet in CentOS5.6

Source: Internet
Author: User

I. Requirements

The guard has a requirement to synchronize data from an intranet server to an internet server. Previously, I used rsync + insync-tool + ssh for real-time synchronization updates, I was on a business trip in Dongguan a few days ago. The developer called me and said that the data on the two servers was not synchronized. I went up and checked it again, the system account used to synchronize data was modified by colleagues in Beijing. ssh password-free login failed, so data cannot be synchronized, later, I thought that there was indeed a security risk when a single user was opened in the system to synchronize data. I had a specific communication with developers, and the data synchronization of this project was not so necessary to be synchronized in real time, so now I want to use rsync for single synchronization. The specific steps are as follows:

II. Environment

Intranet: 10.20.220.247

Synchronization directory 1:/data/Dynamic data/softmgr-v3/static-file/update

Synchronization directory 2:/data/Dynamic data/softmgr-v3/static-file/v1_0

Internet: 114.112.36.X

Synchronization directory 1:/data/apps/ksoftmgr/ksafe/client/update

Synchronization directory 2:/data/apps/ksoftmgr/ksafe/client/v1_0

Iii. installation and configuration

1. Server (114.112.36.69)

A. [root @ localhost ~] # Yum-y install rsync xinetd

B. [root @ localhost ~] # Vi/etc/xinetd. d/rsync

Change disable = no to yes

[Root @ localhost ~] #/Etc/init. d/xinetd start

C. Write the rsync configuration file

[Root @ localhost ~] # Vi/etc/rsyncd. conf

Uid = root

Gid = root

Use chroot = no

Max connections = 10

Strict modes = yes

Pid file =/var/run/rsyncd. pid

Lock file =/var/run/rsync. lock

Log file =/var/log/rsyncd. log

[Update]

Path =/data/apps/ksoftmgr/ksafe/client/update

Comment = update file

Ignore errors

Read only = no

Write only = no

Hosts allow = 125.89.65.194

Hosts deny = *

Uid = root

Auth users = wcm

Secrets file =/etc/web. pass

[V1_0]

Path =/data/apps/ksoftmgr/ksafe/client/v1_0

Comment = v1_0 file

Ignore errors

Read only = no

Write only = no

Hosts allow = 125.89.65.194

Hosts deny = *

Uid = root

Auth users = wcm

Secrets file =/etc/web. pass

D. Write a password file

[Root @ localhost ~] # Vi/etc/web. pass (format account: password)

Wcm: 8888888

[Root @ localhost ~] # Chown root: root/etc/web. pass

[Root @ localhost ~] # Chmod 600/etc/web. pass

E. Start rsync.

[Root @ localhost ~] # Rsync -- daemon

[Root @ localhost ~] # Echo "rsync -- daemon">/etc/rc. local

2. Client (10.20.220.247)

A. [root @ localhost ~] # Yum-y install rsync

B. Write a password file

[Root @ localhost ~] # Vi/etc/web. pass (mainly: Write the password of the account used for synchronization only)

8888888

[Root @ localhost ~] # Chown root: root/etc/web. pass

[Root @ localhost ~] # Chmod 600/etc/web. pass

C. Write a crontab and synchronize it once every minute.

[Root @ localhost v1_0] # crontab-e

*/1 ***/usr/bin/rsync-avz -- progress -- delete/data/parse data/softmgr-v3/static-file/update/wcm@114.112.36.x :: update -- password-file =/etc/web. pass

*/1 */usr/bin/rsync-avz -- progress -- delete/data/parse data/softmgr-v3/static-file/v1_0/wcm@114.112.36.X :: v1_0 -- password-file =/etc/web. pass

Iv. Test

Delete or create a file under Intranet update and v1_0 to check whether the corresponding operation is performed on the machine on the Internet. If yes, It means OK. I must scatter it, online non-synchronization is a tragedy.

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.