-
故障索引
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 無法定位到目前目錄 |
NFS網絡檔案系統: | |
---|---|
1.access denied by server | 權限拒絕 |
2.Program not registered | 檢查挂載資訊失敗沒有注冊 |
3.wrong fs type | 錯誤的檔案系統類型 |
1. not a regular file 不是普通的檔案
scp預設隻能複制普通檔案 與cp類似
scp加一個 -r 參數就好了
[12:37 [email protected] ~]# scp /etc 172.16.1.31:nfs01/tmp/
[email protected]'s password:
/etc: not a regular file
2.cannot delete non-empty directory 無法删除非空目錄
symlink: 軟連結 導緻報錯,可能已經備份過了
[12:39 [email protected] ~]# rsync -av /etc 172.16.1.31:/tmp/
[email protected]'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 [email protected] ~]# 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 [email protected]::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 [email protected] ~]# rsync -avz /etc/hostname [email protected]::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
密碼檔案當root運作rsync的時候,必須屬于root
[[email protected] ~]# ll /etc/rsync.password
-rw------- 1 rsync rsync 20 May 20 16:49 /etc/rsync.password
7.read錯誤:由對等方重置連接配接
配置檔案錯誤
[[email protected] ~]# rsync -avz /etc/hosts [email protected]::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/ [email protected]::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:未知子產品’資料’
[email protected]: chdir failed
沒有建立data備份這個目錄
[20:35 [email protected] ~]# rsync -avz /etc/hosts [email protected]::data
Password:
@ERROR: chdir failed
rsync error: error starting client-server protocol (code 5) at main.c(1648) [sender=3.1.2
解決辦法:
[20:35 [email protected] ~]# mkdir -p /data
[20:38 [email protected] ~]# chown rsync.rsync /data/
[20:39 [email protected] ~]# ll -d /data/
drwxr-xr-x 2 rsync rsync 6 May 20 20:38 /data/
[20:39 [email protected] ~]# rsync -avz /etc/hosts [email protected]::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 [email protected] ~]# rsync -avz /etc/profile [email protected]::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 [email protected] ~]# id rsync
id: rsync: no such user \\沒有這個使用者
12.getcwd: cannot directories
getcwd 指令無法定位到目前工作目錄。一般來說是因為 cd 到了某個目錄之後 rm 了這個目錄,這時去執行某些 service 腳本的時候就會報 getcwd 錯誤。隻需要 cd 到任何一個實際存在的目錄下在執行指令即可。
[[email protected] /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
#二、nfs
1.權限拒絕
/etc/exports中指定的網段是172.16.1.31,這裡是10.0.0.7外網段
[16:43 [email protected] ~]# 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 [email protected] ~]# showmount -e 172.16.1.31
clnt_create: RPC: Program not registered
解決:nfs服務重新開機一下
[16:51 [email protected] ~]# systemctl restart nfs
[16:52 [email protected] ~]# 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 [email protected] ~]# 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