rsync 同步目录

Try `rm --help' for more information.
rsync: failed to connect to 192.168.129.58: Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(124) [sender=3.0.6]

出现这个错误的原因是因为服务端的服务没开起来,或者端口的问题。

 

检查rsync服务是否已经启动,

ps -ef | grep 'rsync'

可以看到rsync服务并没有启动。

手动启动rsync服务

我的 rsync 在 /etc/xinetd.d 下 

可以看到启动成功

 

可能是密码或权限问题

服务端 

/etc/rsyncd.passwd
格式为: username:password
rsync_back:123456

chmod 600 /etc/rsyncd.secrets


客户端

/etc/rsync.pas
格式为: password
123465

chmod 600 /etc/rsync.pas

修改rsyncd.conf

把 rsync 修改为0

uid = 0
gid = 0

现在贴出配置 服务器A /etc/rsync.conf

uid = 0
gid = 0
use chroot = no
max connections = 200
timeout = 300
motd file = /var/rsyncd/rsync.motd
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log

###########下面指定模块,并设定模块配置参数,可以创建多个模块###########
[backup]  # 模块名称
path = /mysqlback/backup/
ignore errors
read only = false
write only = false
list = false
hosts allow = *
auth users = rsync_backup
secrets file = /etc/rsyncd.passwd


/etc/rsyncd.passwd
格式为: username:password
rsync_back:123456

chmod 600 /etc/rsyncd.secrets

启动服务
/usr/bin/rsync  –daemon –config=/etc/rsyncd.conf


服务器B
rsync -a  --password-file=/etc/rsync.pas /data/backup/  rsync_backup@192.168.129.58::backup

/etc/rsync.pas
格式为: password
123465

chmod 600 /etc/rsync.pas

 

参考文件 http://blog.51cto.com/ouyangjun/1691923

                 http://ju.outofmemory.cn/entry/27665

                https://www.jb51.net/article/41417.htm

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值