Rsync synchronizes two servers

Source: Internet
Author: User

Requirement: two servers (a and B) store a large number of images on server a and need to be synchronized to server B at three o'clock every night. Both the source and target directories are/Image

Enable program: rsync

Configuration on server:

1./etc/rsyncd. conf

Uid = nobody

Gid = nobody

Use chroot = No

Max connectionts = 6

Read Only = Yes

Hosts allow = 192.168.95.0/24

PID file =/var/run/rsyncd. PID

Lock file =/var/run/rsyncd. Lock

Log File =/var/log/rsyncd. Log

[Image]

Comment = image

Path =/image/

Ignore errors

List = No

Auth users = root

Secrets file =/etc/rsyncd. passwd

2./etc/rsyncd. passwd

Root: Test


After completing the preceding configuration, run

# Rsync -- daemon

If the system prompts that the rsyncd. passwd file is not found, it indicates that the file is not in the default/etc/path or is not created. You just need to move the file.



Configuration on server B:

/Etc/rsync. passwd

Dongpi2014


Note that the password file on server a and server B is written differently. The password file on server a needs to record the user name, while the password file on server B does not need to record the user name.

Then execute the command

Rsync-ARV -- password-file =/etc/rsyncd. passwd rsync: // [email protected]/test/image/

In this way, synchronization starts.


Note:

If the following error is reported:

@ Error: Unknown module 'xxx'

Rsync error: Error starting client-server protocol (Code 5) at main. C (1503) [runner ER = 3.0.6]

ThisAn error indicates that the Password File Permission is incorrect. The normal password file permission should be 600


The -- password-file option may only be used when accessing an rsync daemon.

This error indicates that the server has not executed the rsync -- daemon command (the service has not been started)


@ Error: AUTH failed on module XXXXX

This error indicates that there is a problem with the username and password in server a and server B, which may be caused by the format of username and password in server B.




In addition to the above methods, you can also use the automated notebook CT script to complete

#! /Usr/bin/CT

Set timeout 3000


Spawn rsync-avcz -- delete [email protected]:/image // Image

Reset CT "Password :"

Send "dongpi2014 \ r"

CT "] *"


Exit

Interact


This article from the "empty heart" blog, please be sure to keep this source http://songknight.blog.51cto.com/2599480/1551555

Rsync synchronizes two servers

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.