File synchronization between centos servers

Source: Internet
Author: User
Tags rsync

Configure the file synchronization server as a synchronization service for other servers

1. Install xinetd first.

Yum-y install xinetd

2. Rsync is generally installed by default.

3. Run Vim/etc/xinetd. conf to change disable = yes to disable = No.

3. Vim/etc/rsyncd. conf (note that this file is not available, just write it directly)

# Rsync
Uid = nobody
Gid = nobody
Max connections = 4
Use chroot = No
Log File =/var/log/rsyncd. Log
PID file =/var/run/rsyncd. PID
Lock file =/var/run/rsyncd. Lock
# Auth users = root
Hosts allow = 192.168.1.3/6
# Hosts deny = 192.168.100.0/24
[Default]
Path =/usr/tomcat6/webapps/tkpcms/published/default/
Comment = deployment WWW
Ignore errors
Read Only = Yes
List = No
Hosts allow = 192.168.1.3/6
Auth users = default
Secrets file =/etc/rsyncd. pwd
Description
[Module name]
Path = backup file path
Auth users = authorized account
Uid = uid at execution time
Gid = GID at execution time
Secrets file = Password File Location
Read Only = read-only or not
4. Create a verification file
Echo default: XXX>/etc/rsyncd. pwd
Chmod 600/etc/rsyncd. pwd
5. Start the service
Rsync-daemon
6. Echo "rsync-daemon">/etc/rc. d/rc. Local # add it to the self-starting File
7. The service uses port 873 by default. Therefore, you must add an open port in iptables.
Vim/etc/sysconfig/iptables
8. Add
-A RH-Firewall-1-INPUT-M state -- state new-m tcp-p tcp -- dport 873-J accept
9. Service iptables restart
10. Check whether the listener is enabled.
Netstat-Na | grep 873
The output is
TCP 0 0 0.0.0.0: 873 0.0.0.0: * listen
TCP 0 0: 873: * listen
Ii. Client Configuration
1. Echo XXX>/etc/rsyncd. pwd # rsync server Postfix password (Note: as long as the password is used)
2, rsync-avuz-delete default@192.168.1.4: default/data/www/-- password-file =/etc/rsyncd. pwd
Test passed to prove service availability
3. crontab-e # Add a scheduled synchronization task.

From: http://blackhost.iteye.com/blog/831893

Related Article

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.