一、rsync服务
1.1 not a regular file 不是普通文件
scp跟cp类型,默认只能复制普通文件
复制目录,加上-r参数即可
[root@backup ~]# scp /etc/ 172.16.1.31:/tmp
root@172.16.1.31's password:
/etc: not a regular file
1.2 command not found 命令找不到
远程服务器没有rsync这个命令,rsync这个命令是默认安装的,检查如果没有,yum install -y rsync 安装即可
[root@backup ~]# rsync -av /etc 172.16.1.31:/tmp
root@172.16.1.31's password:
bash: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: remote command not found (code 127) at io.c(226) [sender=3.1.2]
1.3 Connection refused 连接拒绝
1>检查是否能ping通对应服务器。
2>检查对应服务器的rsync服务是否启动,如果没有,启动即可。
[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]
1.4 Unknown module 'backup'
未知模块“backup”
1>模块写错了,与rsync配置文件中配置的模块不一致,修改一致即可
2>书写的
[root@nfs01 ~]# rsync -avz /etc/hostname rsync_backup@172.16.1.41::backup
@ERROR: Unknown module 'backup'
rsync error: error starting client-server protocol (code 5) at main.c(1648) [sender=3.1.2]
[root@nfs01 ~]#
1.5 auth failed on module data 验证模块数据失败
1>密码写错
2>rsync服务/etc/rsyncd.conf配置文件中用户连接认证密码文件不存在,添加即可
3>密码文件的权限不对,修改600即可
[root@nfs01 ~]# rsync -avz /etc/hostname 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]
[root@nfs01 ~]#
1.6 password file must not be other-accessible
[root@web01 ~]# rsync -avz /etc/hostname rsync_backup@172.16.1.41::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]
[root@web01 ~]#
1.7 Connection reset by peer
[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]
1.8 chdir failed
备份服务上的/backup目录不存在,去服务端创建并修改所有者和所有属组即可
[root@web01 /]# rsync -az /backup rsync_backup@172.16.1.41::backup --password-file /etc/rsync.password
@ERROR: chdir failed
rsync error: error starting client-server protocol (code 5) at main.c(1648) [sender=3.1.2]
1.9 authentication failed 身份验证失败(发送邮件)
在/etc/mail.rc中配置可以使用外部SMTP服务器的配置时,配置错误,重新修改正确即可
[root@backup ~]# mail -s "dddddd" xinxiangyu_wwj@163.com </backup/172.16.1.7/web01.md5
[root@backup ~]# smtp-server: 535 Error: authentication failed
"/root/dead.letter" 12/473
. . . message not sent.
1.10 The --password-file option may only be used when accessing an rsync daemon
--password文件选项只能在访问rsync守护进程时使用
推送的格式书写错误::,修改即可
[root@web01 ~]# sh /server/scripts/client_rsync_backup.sh
tar: Removing leading `/' from member names
The --password-file option may only be used when accessing an rsync daemon.
rsync error: syntax or usage error (code 1) at main.c(1382) [sender=3.1.2]
[root@web01 ~]#
1.11 auth failed on module backup 模块认证错误
1>密码写错
2>密码文件不存在
3>密码文件权限不对
4>没有创建data这个目录
@ERROR: auth failed on module backup
rsync error: error starting client-server protocol (code 5) at main.c(1648) [sender=3.1.2]
二、NFS服务
2.1 Program not registered 程序未注册
服务端的nfs服务未重启,重启即可
[root@web01 ~]# showmount -e 10.0.0.31
clnt_create: RPC: Program not registered
[root@web01 ~]#
2.2 can't find /data/r in /etc/fstab
挂载的时候,mount -t 后面一定要指定文件系统类型
[root@web01 ~]# mount -t 172.16.1.31:/app/r /data/r
mount: can't find /data/r in /etc/fstab
2.3 Read-only file system 只读文件系统
只能查看,不能写入
[root@web01 ~]# touch /data/r/aa.txt
touch: cannot touch ‘/data/r/aa.txt’: Read-only file system
2.4 mount point /data/w does not exist
原因1:需要挂载的目录不存在,创建即可
原因2:共享的目录不能自己挂载自己
[root@backup ~]# mount -t nfs 172.16.1.31:/app/w /data/w
mount.nfs: mount point /data/w does not exist
[root@nfs01 ~]# mount -t nfs 172.16.1.31:/nfs /nfs
mount.nfs: mount point /nfs does not exist
2.5 Device or resource busy
资源设备正在使用中,不能删除,即已挂载
要删除目录,先umount卸载,再删除即可
[root@backup ~]# rm -rf /data/r
rm: cannot remove ‘/data/r’: Device or resource busy
[root@backup ~]#
2.6 access denied by server while mounting 挂载时服务端拒绝访问
原因:服务端共享目录自己挂载了自己
解决:卸载服务端的挂载,但服务端卸载报Device or resource busy的错,导致服务端无法卸载,这时用umount的-lt(强制卸载)或先将配置的共享目录注释掉,然后systemctl reload nfs之后,再用umount卸载;服务端卸载之后,客户端就可以正常挂载
[root@web01 ~]# mount -t nfs 172.16.1.31:/nfs /nfs/
mount.nfs: access denied by server while mounting 172.16.1.31:/nfs
2.7 not mounted 未挂载
因为/data/r这个目录并没有挂载信息,估卸载时报错
[root@backup ~]# umount /data/r
umount: /data/r: not mounted
2.8 Stale file handle 文件句柄错误
df -h 查询并没有nfs的挂载信息,但是grep /nfs /proc/mounts显示已经挂载
解决:umount -lf强制卸载即可
[root@web01 ~]# cp /bin/ls /nfs
cp: failed to access ‘/nfs’: Stale file handle
[root@web01 ~]# cp /bin/ls /nfs/
cp: failed to access ‘/nfs/’: Stale file handle
[root@web01 ~]# cd /nfs/
-bash: cd: /nfs/: Stale file handle
2.9 an incorrect mount option was specified 不正确的挂载参数
指定了1个错误的挂载参数,修改正确即可
[root@backup ~]# mount -o rsize=131072,wsize-131072,suid,exec 172.16.1.31:/app/r /data/r
mount.nfs: an incorrect mount option was specified
[root@backup ~]#
[root@backup ~]# mount -o rsize=131072,wsize=131072,suid,exec 172.16.1.31:/app/r /data/r
[root@backup ~]#
2.10 wrong fs type 错误的文件系统类型
nfs文件系统无法识别
因为没有安装nfs-utils,安装即可
>错误的文件系统类型 nfs文件系统无法识别
>没有安装nfs-utils
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
2.11 Connection refused 连接拒绝
[root@web01 ~]# showmount -e 172.16.1.31
clnt_create: RPC: Port mapper failure - Unable to receive: errno 111 (Connection refused)
三、批量管理
3.1 no action detected in task
[root@m01 ~]# ansible-playbook -C /server/ansible-playbook/nfs-deploy.yml
ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to be in '/server/ansible-playbook/nfs-deploy.yml': line 57, column 9, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: mount /upload
^ here
[root@m01 ~]#
3.1 There was an issue creating /upload as requested 根据要求创建是出错
playbook 创建目录时报错
TASK [make /upload] ******************************************************************************************************************
fatal: [172.16.1.7]: FAILED! => {"changed": false, "msg": "There was an issue creating /upload as requested: [Errno 17] File exists: '/upload'", "path": "/upload"}
网友评论