欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

错误集:配置rsync下行同步时:rsync: failed to connect to 192.168.2.4: No route to host (113)

程序员文章站 2024-03-13 23:26:16
...

配置rsync下行同步时

一、执行同步命令时

#rsync -az --delete --password-file=/etc/server.pass [email protected]::wwwroot /opt/abc

1、报错如下

rsync: failed to connect to 192.168.2.4 (192.168.2.4): No route to host (113)
rsync error: error in socket IO (code 10) at clientserver.c(125) [Receiver=3.1.2]

错误集:配置rsync下行同步时:rsync: failed to connect to 192.168.2.4: No route to host (113)

2、报错导致原因

1)主服务器未开机
2)防火墙阻挡(firewalld)
3)通过的网络上有防火墙阻挡(iptables)

1)排除第一个,虽无法连接到主机,但是我master还是开机状态,暂时排除第一项原因

错误集:配置rsync下行同步时:rsync: failed to connect to 192.168.2.4: No route to host (113)

2)防火墙阻挡(firewalld)

Master(192.168.2.4)

systemctl stop firewalld.service 
setenforce 0

错误集:配置rsync下行同步时:rsync: failed to connect to 192.168.2.4: No route to host (113)
Slave(192.168.2.5)

[[email protected] opt]#rsync -az --delete --password-file=/etc/server.pass [email protected]::wwwroot /opt/abc
[[email protected] opt]#ls
abc  rh
[[email protected] opt]#ls abc
1.html

错误集:配置rsync下行同步时:rsync: failed to connect to 192.168.2.4: No route to host (113)

3)通过的网络上有防火墙阻挡(iptables)

出错原因:server端的防火墙设置了过滤规则

解决办法:使用iptables关闭server端的防火墙

1.暂时关闭

$sudo service iptables stop

2.打开

$sudo service iptables start

3.永久打开和关闭

$sudo chkconfig iptables on

$sudo chkconfig iptables off
相关标签: 错误集