rsync配置

之前折腾了好久的rsync,每次都报错验证失败,研究了好久,今天终于配置成功了。个人认为rsyncd抽风,一模一样的配置今天就可以了。。。



下面的是rsync的配置
1.在主从上安装rsync

apt-get install rsync

2.主的配置

mkdir /etc/rsyncd
vi /etc/rsyncd.conf
# Minimal configuration file for rsync daemon
# See rsync(1) and rsyncd.conf(5) man pages for help
# This line is required by the /etc/init.d/rsyncd script
# GLOBAL OPTIONS
uid = root
gid = root
use chroot = no
read only = yes
#limit access to private LANs
hosts allow=10.26.13.193 10.26.13.195
hosts deny=*
max connections = 5
pid file = /var/run/rsyncd.pid
secrets file = /etc/rsyncd/rsyncd.secrets
#lock file = /var/run/rsync.lock
motd file = /etc/rsyncd/rsyncd.motd
#This will give you a separate log file
log file = /var/log/rsync.log
#This will log every file transferred - up to 85,000+ per user, per sync
transfer logging = yes
log format = %t %a %m %f %b
syslog facility = local3
timeout = 300
# MODULE OPTIONS
[chinatmp]
path = /tmp/china/
list=yes
ignore errors
auth users = china
comment = tmp_china
[test]
path = /tmp/china1/
list=yes
ignore errors
auth users = haha
comment = hahaha

path 是主服务准备传文件的路径
auth users 这个user不用是系统用户,可以随意起名
comment 随便写
[test] 或 [chinatmp] 这个是认证名,远程连接时要用

然后 vi /etc/default/rsync
RSYNC_ENABLE=true

ln -s /etc/rsyncd/rsyncd.conf /etc/rsyncd.conf

以上主服务就配置好了


3.从服务安装rsync后直接连接

rsync -avzP haha@10.26.13.195::test /tmp/hina
-avzP 这些参数根据自己需要填写
haha 这个是主服务上面的用户
10.26.13.195 主服务允许访问的地址
test 主服务配置文件里 [test]模块名
/tmp/hina 这个地址是从主传到本地的位置,如果不存在会自动创建

以上最简单的rsync就配置好了。有疑问可以看日志 /var/log/rsync.log





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值