rsync的BT故障排查

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了rsync的BT故障排查相关的知识,希望对你有一定的参考价值。

今天一早DB就过来说,一直在工作的rsync服务没有将中转的数据文件定时上传至服务器上,叫我看下原因。

经检查,原来是做了crontab的rsync无法工作了,找出了故障,紧接着便是解决。

1. 先来确定是否是网络的原因,首先是telnet

[[email protected] ~]$ telnet 10.123.1.66 873

Trying 10.123.1.66...

Connected to 10.123.1.66.

Escape character is ‘^]‘.

Connection closed by foreign host.

telnet出现了闪退的问题


其实到了这里我就该想到服务被关掉了才对,唉。。。

2.检查rsync服务器的iptables以及selinux

[[email protected] ssh]# iptables -L

Chain INPUT (policy DROP)

target     prot opt source               destination

ACCEPT     all  --  anywhere             anywhere

ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED

ACCEPT     icmp --  anywhere             anywhere            icmp destination-unreachable

ACCEPT     icmp --  anywhere             anywhere            icmp time-exceeded

ACCEPT     icmp --  anywhere             anywhere            icmp echo-reply

ACCEPT     icmp --  anywhere             anywhere            icmp echo-request

ACCEPT     tcp  --  10.123.0.0/16        anywhere            tcp dpt:ssh

ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:webcache

ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:rsync

ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:pcsync-https

REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited

Chain FORWARD (policy DROP)

target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)

target     prot opt source               destination

[[email protected] ssh]# getenforce

Disabled

iptables以及selinux均正常

3. rsync检测

[[email protected] ~]$ rsync -avz /translog/elcotable/DBM-721_elcas_order_20170304.del [email protected]:/home/elpayment

ssh: connect to host 10.123.1.66 port 22: Connection timed out

rsync: connection unexpectedly closed (0 bytes received so far) [sender]

rsync error: unexplained error (code 255) at io.c(600) [sender=3.0.6]

仍出现错误

4.检查rsync相关的配置以及检查rsync的日志

[[email protected] ssh]# tail -100f /var/log/rsyncd.log

2017/03/03 18:00:00 [8942] connect from UNKNOWN (192.168.1.8)

2017/03/03 18:00:00 [8942] rsync to guiyangKF/ from [email protected] (192.168.1.8)

2017/03/03 18:00:00 [8942] receiving file list

2017/03/03 18:00:00 [8942] sent 76 bytes  received 134 bytes  total size 0

2017/03/03 18:35:30 [11286] rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(542) [receiver=3.0.6]

2017/03/06 11:03:05 [18972] rsyncd version 3.0.6 starting, listening on port 873

2017/03/06 11:11:57 [19043] rsync: failed to create pid file /var/run/rsyncd.pid: File exists (17)

2017/03/06 11:11:57 [19043] rsync error: error in file IO (code 11) at clientserver.c(1015) [receiver=3.0.6]

2017/03/06 11:12:08 [19046] rsyncd version 3.0.6 starting, listening on port 873

[[email protected] ssh]# tail -100f /var/log/messages

Mar  6 11:09:45 epsapp1 rsyncd[19022]: rsync: unable to open configuration file "/etc/rsyncd.conf": No such file or directory (2)

Mar  6 11:09:45 epsapp1 rsyncd[19022]: rsync error: syntax or usage error (code 1) at clientserver.c(953) [receiver=3.0.6]

Mar  6 11:09:45 epsapp1 xinetd[2854]: EXIT: rsync status=1 pid=19022 duration=0(sec)

5.结论是:rsync没有正常启动

[[email protected] ssh]# ps -ef|grep rsync

root     19116     1  0 11:15 ?        00:00:00 rsync --daemon --config=/etc/rsyncd.conf

root     19224 18129  0 11:42 pts/1    00:00:00 grep rsync

启动后,rsync传输正常

[[email protected] ~]$ bash 1-66rsync.sh

sending incremental file list

DBM-721_elcas_order_20170306.del

sent 190816 bytes  received 27 bytes  127228.67 bytes/sec

total size is 986828  speedup is 5.17

sending incremental file list

sent 71 bytes  received 8 bytes  158.00 bytes/sec

total size is 30448786  speedup is 385427.67


本文出自 “shell脚本” 博客,请务必保留此出处http://jianglipan.blog.51cto.com/9541041/1903583

以上是关于rsync的BT故障排查的主要内容,如果未能解决你的问题,请参考以下文章

Rsync 故障排查整理(经典)

rsync 常见故障排查及思路

rsync 常见故障排查及思路

jvm故障排查

路由器故障排查功能的方法

故障排查