|
First, introduction
At work often encountered distribute the code or data backup, will use rsync, configuration is not complex, only to do the next record, the installation environment is as follows:
1) CentOS6.6
2) rsync-3.0.6-12.el6.x86_64
3) Server IP: 192.168.19.128; Client IP: 192.168.19.145
Second, the installation
$ Yum install -y rsync xinetd
$ Setenforce 0 or echo "SELINUX = disabled"> / etc / selinux / config (need to restart to take effect)
Third, the configuration
$ Vi /etc/rsyncd.conf
uid = root # specified UID file transfer
gid = root # specified GID file transfer
#hosts allow = 10.50.53.100 # allows you to specify host access
#hosts deny = 0.0.0.0 / 32 # to block access to specified hosts
use chroot = yes
max connections = 10 # maximum number of connections allowed
pid file = / var / run / rsyncd.pid # specified pid file path
lock file = / var / run / rsync.lock # specified process lock file
log file = / var / log / rsyncd.log # specified log path
timeout = 600 # connection time
port = 873 # specify tcp port
[Backup]
path = / data
comment = rsync files
read only = no
list = yes
auth users = chicken00
secrets file = / etc / .rsyncd.secrets
# Set the user and password, a user with the same configuration file specifies (auth users)
$ Echo "chicken00: chicken00"> /etc/.rsyncd.secrets
# 600 must be set file permissions
$ Chmod 600 /etc/.rsyncd.secrets
Fourth, start
# Set boot
$ Chkconfig rsync on
# Check boot
$ Chkconfig --list rsync
rsync on
#rsync daemon xinetd configuration management tool content
$ Cat /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 = no
flags = IPv6
socket_type = stream
wait = no
user = root
server = / usr / bin / rsync
server_args = --daemon
log_on_failure + = USERID
}
# Start Service
$ /etc/init.d/xinetd Start
Fifth, check
# Enable the firewall
Sixth, the client synchronization test
$ Echo "chicken00"> /etc/.rsyncd.secrets
$ Chmod 600 /etc/.rsyncd.secrets
$ Echo 'hello rsync !!'> hello.txt
#upload files
$ Rsync -vzrtopg --delete --progress hello.txt chicken00@192.168.19.128 :: backup --password-file = / etc / .rsyncd.secrets
# In the end see if the file synchronization service coming
#download
$ Rsync -vzrtopg --delete --progress chicken00@192.168.19.128 :: backup $ (pwd) / backup - $ (date +% Y-% m-% d) --password-file = / etc / .rsyncd. secrets |
|
|
|