Configure rsync to synchronize data to the RPM package to install rsync and configure

Source: Internet
Author: User

[[Email protected] Home] # rpm-Qa | grep rsync # Check whether the rsync package is installed.
Rsync-2.6.8-3.1
[[Email protected] centos] # rpm-IVH rsync-2.6.8-3.1.i386.rpm # Install Manually If Not Installed

[[Email protected] rsync-3.0.4] # Vim/etc/xinetd. d/rsync


1 configure rsync servervi/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
}

2 configure rsync to start automatically
[[Email protected] etc] # chkconfig rsync on
[[Email protected] etc] # chkconfig rsync -- list
Rsync on

3. Configure rsyncd. conf
[[Email protected] etc] # Vim rsyncd. conf

Uid = root
Gid = root
Use chroot = No
Max connections = 4
Strict modes = Yes
Port = 873
PID file =/var/run/rsyncd. PID
Lock file =/var/run/rsync. Lock
Log File =/var/log/rsyncd. Log

[Backup]
Path =/srv
Comment = This is test
Auth users = scihoo
Uid = root
Gid = root
Secrets file =/home/rsync. Ps
Read Only = No
List = No


4. Make sure that the rsync port number in ETC/services is correct.
[[Email protected] etc] # Vim/etc/services
Rsync 873/tcp # rsync
Rsync 873/udp # rsync

5. Configure the rsync password (the path has been written in the preceding configuration file)/home/rsync. PS (name can be written at will, as long as it is consistent with the above configuration file), format (one row per user)
[[Email protected] etc] # vi/home/rsync. Ps
Scihoo: scihoo

6. Configure rsync Password File Permissions
[[Email protected] Home] # chown root. Root rsync. Ps
[[Email protected] Home] # chmod 400 rsync. Ps

7 STARTUP configuration
[[Email protected] Home] #/etc/init. d/xinetd restart
Stopping xinetd: [OK]
Starting xinetd: [OK]

8. If xinetd does not exist, install it.
[[Email protected] Home] # Yum-y install xinetd


Start rsync server
Two Methods for rsync server startup
9. Start the rsync server (independently started)
[[Email protected] Home] #/usr/bin/rsync -- daemon

10. Start the rsync server (xinetd superprocess started)
[[Email protected] Home] #/etc/init. d/xinetd reload

11 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.
[[Email protected] Home] # vi/etc/rc. Local
/Usr/local/rsync-daemon # Add a row

12. Check whether Rsync is enabled.
[[Email protected] Home] # lsof-I: 873
Command PID user FD type device size node name
Xinetd 4396 root 5u IPv4 633387 tcp *: rsync (Listen)




Client Configuration
1. Configure three processes.
1.1 SET Password File
1.2 test the rsync execution command
1.3 put the rsync command into the Job Schedule (crontab)
[[Email protected] Home] # vi/etc/xinetd. d/rsync

# Default: Off
# Description: the rsync server is a good addition to an FTP server, as it \
# Allows CRC checksumming etc.
Service rsync
{
Disable = Yes
Socket_type = stream
Wait = No
User = root
Server =/usr/bin/rsync
Server_args = -- daemon
Log_on_failure + = userid
}

1.1 configure the password file (NOTE: For security purposes, set the attribute of the password file to 600. The Rsync. PS password must be the same as the password in the rsync server password setting case)
[[Email protected] Home] # vi rsync. Ps
Sciooo

[[Email protected] Home] # chown root. Root. rsync. PS # grant permissions
[[Email protected] Home] # chmod 600. rsync. PS # The permission must be modified.

1.2 download files from the server
[[Email protected] rsync-3.0.4] # rsync-avz -- password-file =/home/rsync. PS [email protected]: backup/home/

Upload from local to server
[[Email protected] rsync-3.0.4] # rsync-avz -- password-file =/home/rsync. PS/home [email protected]: Backup

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.