首页 > 代码库 > rsync

rsync

1.安装rsync和xinetd

yum install rsync xinetd


2.配置xinetd:

vi /etc/xinetd.d/rsync

#disable = yes修改为

disable = no


3.启动xinetd服务:

service xinetd start


4,编辑rsyncd.conf配置文件:

[root@dx-it-twebs01 wuxiaoyu]# cat /etc/rsyncd.conf 

#motd file = /etc/rsyncd.motd

use chroot = yes

uid=root

gid=root

max connections = 2000

timeout = 600

pid file = /var/run/rsyncd.pid

lock file = /var/run/rsyncd.lock

log file = /var/log/rsync.log

ignore errors

read only = false

list = false

hosts allow = dx-it-tw03.dx.sankuai.com

hosts deny = *


[wikidata]

comment = wikidata

path = /data/store/

auth users = sankuai

secrets file = /etc/rsync/sankuai_rsyncd.secrets

[root@dx-it-twebs01 wuxiaoyu]# 


5,配置服务端秘钥

mkdir /etc/rsync

touch /etc/rsync/sankuai_rsyncd.secrets  ##密码为sankuai:123456789

chmod  600 /etc/rsync/sankuai_rsyncd.secrets


6,配置客户端服务秘钥

touch secrets.txt

chown  sankuai.sankuai secrets.txt

chmod  600 secrets.txt 


7,测试传输wuxiaoyu这个目录到rsync的服务端

rsync -varz  mfs/wuxiaoyu   sankuai@dx-it-twebs01.dx.sankuai.com::wikidata --password-file secrets.txt


网上有很多教程使用xinet.d来启动rsync服务端。

不过也使用rsync自带的来启动服务端

如:rsync --daemon --config=/home/leyewen/etc/rsync/rsyncd.conf


rsync