rsync服務安裝和配置
rsync服務安裝:
檢查是否安裝:
rpm -qa | grep rsync
如果安裝了,則需要做如下配置和修改
1. 修改 /etc/xinetd.d/rsync 下的內容
打開啟動選項:
disable = yes 改為 disable = no
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
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
2. 新建:vi /etc/rsyncd.conf
輸入如下內容:
uid = root
gid = root
use chroot = no
max connections = 10
strict modes = yes
pid file=/opt/myysrnc/rsyncd.pid
lock file=/opt/myysrnc/rsyncd.lock
log file= =/opt/myysrnc/rsyncd.log
[www]
path= /data/www
comment= analyse
read only = false
hosts allow = *
3. 啟動守護進程
/usr/local/bin/rsync --daemon
客戶端:
執行同步命令:
/usr/bin/rsync -arzuv /data/www/ 192.168.136.128::www/
注意:客戶端必須執行同步命令觸發同步操作.
要實現定時同步,可以通過crontab -e加入定時任務來實現.