歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> CentOS 6.3_ RSync實現文件備份同步配置排除故障

CentOS 6.3_ RSync實現文件備份同步配置排除故障

日期:2017/3/3 16:34:28   编辑:關於Linux

***************************

排除故障

***************************

1.@ERROR: auth failed on module xxxxx

rsync: connection unexpectedly closed (90 bytes read so far)

rsync error: error in rsync protocol data stream (code 12) at io.c(150)

這是因為密碼設錯了, 無法登入成功, 請檢查一下 rsyncd.scrt 中的密碼, 二端是否一致?

2.password file must not be other-accessible

continuing without password file

Password:

這表示 rsyncd.scrt 的檔案權限屬性不對, 應設為 600。

3.@ERROR: chroot failed

rsync: connection unexpectedly closed (75 bytes read so far)

rsync error: error in rsync protocol data stream (code 12) at io.c(150)   

這通常是您的 rsyncd.conf 中的 path 路徑所設的那個目錄並不存在所致.請先用 mkdir開設好要備份目錄

4.@ERROR: access denied to www from unknown (192.168.1.123)

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

rsync error: error in rsync protocol data stream (code 12) at io.c(359)

最後原因終於找到了。因為有兩個網段都需要同步該文件夾內容,但沒有在hosts allow 後面添加另一個IP段

hosts allow = 192.168.1.0/24

改為

hosts allow = 192.168.1.0/24 192.168.2.0/24

重新啟動rsync服務,問題解決

5.rsync: failed to connect to 172.21.50.8: No route to host (113)

rsync error: error in socket IO (code 10) at clientserver.c(104) [receiver=2.6.9]

對方沒開機、防火牆阻擋、通過的網絡上有防火牆阻擋,都有可能。關閉防火牆,其實就是把tcp udp 的873端口打開

啟動服務:rsync --daemon --config=/etc/rsyncd.conf

6.@ERROR: auth failed on module backup

rsync error: error starting client-server protocol (code 5) at main.c(1506) [Receiver=3.0.7]

client端沒有設置/etc/rsync.pas這個文件,而在使用rsync命令的時候,加了這個參數--password-file=/etc/rsync.scrt

7.rsync: recv_generator: mkdir "/teacherclubBackup/rsync……" failed: No space left on device (28)

*** Skipping any contents from this failed directory ***

磁盤空間滿了

8.rsync: opendir "/kexue" (in dtsChannel) failed: Permission denied (13)

同步目錄的權限設置不對,改為755

9.rsync: read error: Connection reset by peer (104)

rsync error: error in rsync protocol data stream (code 12) at io.c(759) [receiver=3.0.5]

未啟動xinetd守護進程

[root@CC02 /]# service xinetd start

10.rsync: unable to open configuration file "/etc/rsyncd.conf": No such file or directory

xnetid查找的配置文件位置默認是/etc下,在/etc下找不到rsyncd.conf文件

11.rsync: failed to connect to 203.100.192.66: Connection timed out (110)

rsync error: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.5]

連接服務器超時,檢查服務器的端口netstat –tunlp,遠程telnet測試

12.[root@client cron.daily.rsync]# sh root.sh

ERROR: password file must not be other-accessible

rsync error: syntax or usage error (code 1) at authenticate.c(175) [Receiver=3.0.9]

創建密碼文件,root用戶用的是 rsyncroot.password,權限是600

13.如何通過ssh進行rsync,而且無須輸入密碼?

可以通過以下幾個步驟

1. 通過ssh-keygen在server A上建立SSH keys,不要指定密碼,你會在~/.ssh下看到identity和identity.pub文件

2. 在server B上的home目錄建立子目錄.ssh

3. 將A的identity.pub拷貝到server B上

4. 將identity.pub加到~[user b]/.ssh/authorized_keys

5. 於是server A上的A用戶,可通過下面命令以用戶B ssh到server B上了。e.g. ssh -l userB serverB。這樣就使server A上的用戶A就可以ssh以用戶B的身份無需密碼登陸到server B上了。

14.如何通過在不危害安全的情況下通過防火牆使用rsync?

解答如下:

這通常有兩種情況,一種是服務器在防火牆內,一種是服務器在防火牆外。無論哪種情況,通常還是使用ssh,這時最好新建一個備份用戶,並且配置sshd 僅允許這個用戶通過RSA認證方式進入。如果服務器在防火牆內,則最好限定客戶端的IP地址,拒絕其它所有連接。如果客戶機在防火牆內,則可以簡單允許防 火牆打開TCP端口22的ssh外發連接就ok了。

15.我能將更改過或者刪除的文件也備份上來嗎?

當然可以。你可以使用如:rsync -other -options -backupdir = ./backup-2000-2-13 ...這樣的命令來實現。這樣如果源文件:/path/to/some/file.c改變了,那麼舊的文件就會被移到./backup- 2000-2-13/path/to/some/file.c,這裡這個目錄需要自己手工建立起來

16.我需要在防火牆上開放哪些端口以適應rsync?

視情況而定。rsync可以直接通過873端口的tcp連接傳文件,也可以通過22端口的ssh來進行文件傳遞,但你也可以通過下列命令改變它的端口:

rsync --port 8730 otherhost::

或者

rsync -e 'ssh -p 2002' otherhost:

17.我如何通過rsync只復制目錄結構,忽略掉文件呢? 

rsync -av --include '*/' --exclude '*' source-dir dest-dir

18.為什麼我總會出現"Read-only file system"的錯誤呢?

看看是否忘了設"read only = no"了

19.為什麼我會出現'@ERROR: invalid gid'的錯誤呢?

rsync使用時默認是用uid=nobody;gid=nobody來運行的,如果你的系統不存在nobody組的話,就會出現這樣的錯誤,可以試試gid = ogroup或者其它

20.綁定端口873失敗是怎麼回事?

如果你不是以root權限運行這一守護進程的話,因為1024端口以下是特權端口,會出現這樣的錯誤。你可以用--port參數來改變。

21.為什麼我認證失敗?

從你的命令行看來:你用的是

> bash$ rsync -a 144.16.251.213::test test

> Password:

> @ERROR: auth failed on module test

>

> I dont understand this. Can somebody explain as to how to acomplish this.

> All suggestions are welcome.

應該是沒有以你的用戶名登陸導致的問題,試試rsync -a [email protected]::test test

22.出現以下這個訊息, 是怎麼一回事?

@ERROR: auth failed on module xxxxx

rsync: connection unexpectedly closed (90 bytes read so far)

rsync error: error in rsync protocol data stream (code 12) at io.c(150)

這是因為密碼設錯了, 無法登入成功, 請再檢查一下 rsyncd.secrets 中的密碼設定, 二端是否一致?

23.出現以下這個訊息, 是怎麼一回事?

password file must not be other-accessible

continuing without password file

Password:

這表示 rsyncd.secrets 的檔案權限屬性不對, 應設為 600。請下 chmod 600 rsyncd.secrets

24.出現以下這個訊息, 是怎麼一回事?

@ERROR: chroot failed

rsync: connection unexpectedly closed (75 bytes read so far)

rsync error: error in rsync protocol data stream (code 12) at io.c(150)

這通常是您的 rsyncd.conf 中的 path 路徑所設的那個目錄並不存在所致.請先用 mkdir開設好備份目錄.

本文出自 “運維工作奮斗” 博客,請務必保留此出處http://yanghuawu.blog.51cto.com/2638960/994854

Copyright © Linux教程網 All Rights Reserved