Using rsync in Linux to synchronize files between multiple servers

Source: Internet
Author: User
First, my server ip: 192.168.122.129 Client IP: 192.168.122.1111. configure the server first: confirm whether to install rsync # rpm-qa | greprsync. If not, you can install rsync from the CD as follows: 1. attached Disk: MkdirmntcdromMountdevhdcmntcdromCdServerrpm-ivhrsync

First, my server ip Address: 192.168.122.129

Client IP: 192.168.122.111

1. Configure the server first:

Check whether rsy is installedNc

# Rpm-qa |GrepRSync

If not, you can install the following on the CD:


1. Attach a CD:

Mkdir/mnt/CdRom

Mount/dev/hdc/mnt/cdrom

Cd Server

Rpm-ivh rsync-2.5.6-20.i386.rpm

Umount/Mnt/cdrom

Eject

2. Configure rsync
In/etc/xinetd. d/rsync

Change disable = yes to no
Service rsync
{
Disable = no
Socket_type = sTrEam
Wait = no
User = root
Server =/usr/bin/rsync
Server_args = -- daemon
Log_on_failure + = USERID
}

3. Configure rsync to start automatically

Root@www.linuxIdC.com etc] #ChkconfigRsync on
[Root@www.linuxidc.com etc] # chkconfig rsync -- list
Rsync on

4. Configure rsyncd. conf by yourself

Uid = root
Gid = root
Use chroot = no
Max connections = 4
Strict modes = yes
Port = 873

Hosts allow = 192.168.122.111
PidFile=/Var/run/rsyncd. pid
Lock file =/var/run/rsync. lock
Log file =/var/log/rsyncd. log
[Backup] # What you want to back up
Path =/srv # actual directory
Comment = This is test
Auth users = scihoo
Uid = root
Gid = root
Secrets file =/home/rsync. ps
Read only = no
List = no

5. Add port 873 to/etc/services

Rsync873/tCp# Rsync
Rsync 873/udp # rsync

6. Configure the rsync password (the path has been written in the above configuration file)/home/rsync. ps (the name can be written as long as it is consistent with the one in the above configuration file), in the format
(One user in one row)
[Root@www.linuxidc.com etc] # vi/home/rsync. ps
Root: 123456

7. Configure the rsync Password File Permission to go to the home directory.
[Root@www.linuxidc.com home] #ChownRoot. root rsync. ps
[Root@www.linuxidc.com home] #Chmod700 rsync. ps

8. Start

Start rsync
[Root@www.linuxidc.com home] #/usr/bin/rsync? Daemon

9. Add rc. local
In various operating systems, rc files are stored in different locations and can be modified so that rsync-daemon can be loaded during system startup.
[Root@www.linuxidc.com home] # vi/etc/rc. local
/Usr/local/rsync? Daemon # Add a row

9. Check whether rsync is enabled.
[Root@www.linuxidc.com home] #LsOf-I: 873
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
Xinetd 4396 root 5u IPv4 633387 TCP *: rsync (LISTEN)

Started successfully on the server side

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.