美文网首页
【综合架构故障集合】

【综合架构故障集合】

作者: 杨丶子 | 来源:发表于2019-05-27 15:21 被阅读0次
  • 故障索引

Rsync同步备份故障:
1.not a regular file 不是普通的文件
2.cannot delete non-empty directory 无法删除非空目录
3.Connection refused 连接拒绝
4.auth failed on module data auth 模块数据失败
5.Unknown module 'data' 未知的模块的数据
6.secrets file must be owned by root when running as root 秘密文件
7.read error: Connection reset by peer (104) 读取错误:由对等方重置连接
8.password file must not be other-accessible 密码文件不能是其他可访问的
9.denied on module data from UNKNOWN 未知模块'数据'
10.chdir failed 失败
11.invalid uid rsync 无效的用户 rsync
12.getcwd: cannot directories getcwd 无法定位到当前目录
13.failed to create pid file /var/run/rsyncd.pid: File exists Rsync 服务器启动错误
14.auth failed on module backup 身份验证模块备份失败
NFS网络文件系统:
1.access denied by server 权限拒绝
2.Program not registered 检查挂载信息失败没有注册
3.wrong fs type 错误的文件系统类型
4.Read-only file system 文件只读

1. not a regular file 不是普通的文件

scp默认只能复制普通文件 与cp类似
scp加一个 -r 参数就好了

[12:37 root@backup ~]# scp /etc 172.16.1.31:nfs01/tmp/
root@172.16.1.31's password: 
/etc: not a regular file

2.cannot delete non-empty directory 无法删除非空目录

symlink: 软链接 导致报错,可能已经备份过了

[12:39 root@backup ~]# rsync -av /etc 172.16.1.31:/tmp/
root@172.16.1.31's password: 
sending incremental file list
cannot delete non-empty directory: etc/init.d
could not make way for new symlink: etc/init.d
cannot delete non-empty directory: etc/rc0.d
could not make way for new symlink: etc/rc0.d
.....
..

3.Connection refused 连接拒绝

检查是否能ping通对应服务器

[12:41 root@backup ~]# rsync -avz /etc 176.16.1.31:/tmp
ssh: connect to host 176.16.1.31 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]

4.auth failed on module data

data模块认证错误(密码)

原因:
1.密码写错
2.密码文件不存在
3.密码文件权限不对
4.没有创建data这个目录

[root 16:15 @ backup ~]# rsync -avz /etc/hosts rsync_backup@172.16.1.41::data
Password: 
@ERROR: auth failed on module data
rsync error: error starting client-server protocol (code 5) at main.c(1648) [sender=3.1.2]
原因:密码文件权限没有更改为600
[root 16:25 @ backup ~]# ll /etc/rsync.password 
-rw-r--r-- 1 root root 20 May 20 16:05 /etc/rsync.password

解决办法:更改文件权限位600
[root 16:25 @ backup ~]# chmod 600  /etc/rsync.password 
[root 16:25 @ backup ~]# ll /etc/rsync.password 
-rw------- 1 root root 20 May 20 16:05 /etc/rsync.password

5.Unknown module 'data' 未知的设备模块

没有权限

[17:45 root@nfs01 ~]# rsync -avz /etc/hostname rsync_backup@10.0.0.41::data --password-file=/etc/rsync.password
@ERROR: Unknown module 'data'
rsync error: error starting client-server protocol (code 5) at main.c(1648) [sender=3.1.2]

服务端查看rsyncd.conf ,准许哪些主机可以访问

hosts allow = 172.16.1.0/24
#hosts deny = 0.0.0.0/32

6.秘密文件

日志中
密码文件问题
查看日志的提示:

019/05/20 16:52:32 [15755] secrets file must be owned by root when running as root (see strict modes)
2019/05/20 16:52:32 [15755] auth failed on module data from backup (172.16.1.41) for rsync_backup: ignoring secrets file

 secrets file must be owned by root when running as root (see strict modes)

密码文件当root运行rsync的时候,必须属于root

[root@backup ~]# ll /etc/rsync.password 
-rw------- 1 rsync rsync 20 May 20 16:49 /etc/rsync.password

7.read错误:由对等方重置连接

配置文件错误

[root@backup ~]# rsync -avz /etc/hosts rsync_backup@172.16.1.41::data
sending incremental file list
rsync: read error: Connection reset by peer (104)
rsync error: error in socket IO (code 10) at io.c(785) [sender=3.1.2]

8.密码文件不能是其他可访问的

rsync -avz /etc/sysconfig/ rsync_backup@172.16.1.91::backup --password-file=/etc/rsync.password  
ERROR: password file must not be other-accessible
rsync error: syntax or usage error (code 1) at authenticate.c(196) [sender=3.1.2]

9.未知模块'数据'

@ERROR:未知模块'数据'

2019/05/20 17:45:46 [10514] rsync denied on module data from UNKNOWN (10.0.0.31)

10.@ERROR: chdir failed

没有创建data备份这个目录

[20:35 root@backup ~]# rsync -avz /etc/hosts rsync_backup@172.16.1.41::data
Password: 
@ERROR: chdir failed
rsync error: error starting client-server protocol (code 5) at main.c(1648) [sender=3.1.2

解决办法:

[20:35 root@backup ~]# mkdir -p /data
[20:38 root@backup ~]# chown rsync.rsync /data/
[20:39 root@backup ~]# ll -d /data/
drwxr-xr-x 2 rsync rsync 6 May 20 20:38 /data/
[20:39 root@backup ~]# rsync -avz /etc/hosts rsync_backup@172.16.1.41::data
Password: 
sending incremental file list
hosts

sent 140 bytes  received 43 bytes  52.29 bytes/sec
total size is 158  speedup is 0.86

11.invalid uid rsync 无效的uid rsync

推送到的接收端可能没有rsync这个虚拟用户

[09:40 root@nfs01 ~]# rsync -avz /etc/profile rsync_backup@172.16.1.41::data --password-file=/etc/rsync.password 
@ERROR: invalid uid rsync
rsync error: error starting client-server protocol (code 5) at main.c(1648) [sender=3.1.2]

去接收端服务器看一下:

[09:41 root@backup ~]# id rsync
id: rsync: no such user   \\没有这个用户

12.getcwd: cannot directories

getcwd 命令无法定位到当前工作目录。一般来说是因为 cd 到了某个目录之后 rm 了这个目录,这时去执行某些 service 脚本的时候就会报 getcwd 错误。只需要 cd 到任何一个实际存在的目录下在执行命令即可。

[root@nfs01 /backup/172.16.1.31]# sh /tmp/rsync.sh 
shellinit: error retrieving current directory: getcwd: cannot directories: No such file or directory
/usr/bin/tar: Removing leading `/' from member names

13.failed to create pid file /var/run/rsyncd.pid: File exists

Rsync 服务器启动错误

[13:25 root@backup ~]# rsync --daemon
[13:28 root@backup ~]# failed to create pid file /var/run/rsyncd.pid: File exists

解决方案:
rm -rf /var/run/rsyncd.pid;再重新启动Rsync服务(rsync --daemon)

[13:28 root@backup ~]# rm -rf /var/run/rsyncd.pid 
[13:29 root@backup ~]# rsync --daemon
[13:30 root@backup ~]# netstat -lutup|grep rsync
tcp        0      0 0.0.0.0:rsync           0.0.0.0:*               LISTEN      8585/rsync          
tcp6       0      0 [::]:rsync              [::]:*                  LISTEN      8585/rsync       

14.auth failed on module backup 身份验证模块备份失败

[13:36 root@backup ~]# rsync -avz /etc/hosts rsync_backup@172.16.1.41::backup
Password: 
@ERROR: auth failed on module backup
rsync error: error starting client-server protocol (code 5) at main.c(1648) [sender=3.1.2]

查看服务端和客户端的密码文件的权限是否为600
查看密码是否正确

还有一个深坑就是密码中有没有空格,把空格删除掉就可以了

image

二、nfs服务

1.权限拒绝

/etc/exports中指定的网段是172.16.1.31,这里是10.0.0.7外网段

[16:43 root@web01 ~]# mount -t nfs 10.0.0.7:/upload/ /video/
mount.nfs: access denied by server while mounting 10.0.0.7:/upload/

2.检查挂在信息失败

[16:51 root@nfs01 ~]# showmount -e 172.16.1.31
clnt_create: RPC: Program not registered

解决:nfs服务重启一下

[16:51 root@nfs01 ~]# systemctl restart nfs
[16:52 root@nfs01 ~]# showmount -e 172.16.1.31
Export list for 172.16.1.31:
/upload 172.16.1.0/24

3.wrong fs type

错误的文件系统类型 nfs文件系统无法识别
没有安装nfs-utils

[16:51 root@nfs01 ~]# mount -t nfs 172.16.1.31:/data /mnt/
mount: wrong fs type, bad option, bad superblock on 172.16.1.31:/data,
       missing codepage or helper program, or other error
       (for several filesystems (e.g. nfs, cifs) you might
       need a /sbin/mount.<type> helper program)
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

4.Read-only file system文件只读

在NFS服务挂载的/mnt/目录创建文件

[09:33 root@nfs01 /]# df -h
172.16.1.31:/data   19G  1.7G   18G   9% /opt
[09:33 root@nfs01 /]# touch /opt/1.txt
touch: cannot touch ‘/opt/1.txt’: Read-only file system

解决:/etc/exports的权限是只读访问

[09:33 root@nfs01 /]# vim /etc/exports
#share /data
/data           172.16.1.0/24(ro,sync,all_squash)

相关文章

网友评论

      本文标题:【综合架构故障集合】

      本文链接:https://www.haomeiwen.com/subject/fexqtctx.html