配置DRBD出現錯誤總結

Q1.’ha’ ignored, since this host (node2.centos.bz) is not mentioned with an ‘on’ keyword.?

Error Meaage:

執行指令 drbdadm create-md ha 時出現如下錯誤信息

'ha' ignored, since this host (node2.centos.bz) is not mentioned with an 'on' keyword.
Ans:

因爲在 drbd 設定 drbd.conf 中 on 本來寫的是 node1、node2 而以,將node1和node2分別改爲node1.centos.bz,node2.centos.bz。

Q2.drbdadm create-md ha: exited with coolcode 20?

Error Meaage:

執行指令 drbdadm create-md ha 時出現如下錯誤信息

open(/dev/hdb1) failed: No such file or directory
 Command 'drbdmeta 0 v08 /dev/hdb1 internal create-md' terminated with exit coolcode 20
 drbdadm create-md ha: exited with coolcode 20

Ans:

因爲忘了執行 fdisk /dev/hdb 指令建立分割區所造成,如下將 /dev/hdb 建立分割區後指令即可正常執行

fdisk /dev/hdb //準備爲 hdb 建立分割區

The number of cylinders for this disk is set to 20805.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): n //鍵入 n 表示要建立分割區
Command action
e extended
p primary partition (1-4)
p //鍵入 p 表示建立主要分割區
Partition number (1-4): 1 //鍵入 1 爲此主要分割區代號
First cylinder (1-20805, default 1): //開始磁柱值,按下 enter 即可
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-20805, default 20805): //結束磁柱值,按下 enter 即可
Using default value 20805
Command (m for help): w //鍵入 w 表示確定執行剛纔設定
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@node1 yum.repos.d]# partprobe //使剛纔的 partition table 變更生效

Q3.drbdadm create-md ha: exited with coolcode 40?

Error Meaage:

執行指令 drbdadm create-md ha 時出現如下錯誤信息

    Device size would be truncated, which
     would corrupt data and result in
     'access beyond end of device' errors.
     You need to either
        * use external meta data (recommended)
        * shrink that filesystem first
        * zero out the device (destroy the filesystem)
     Operation refused.
     Command 'drbdmeta 0 v08 /dev/hdb1 internal create-md' terminated with exit coolcode 40
     drbdadm create-md ha: exited with coolcode 40

Ans:

使用 dd 指令將一些資料塞到 /dev/hdb 後再執行 drbdadm create-md ha 指令即可順利執行

dd if=/dev/zero of=/dev/hdb1 bs=1M count=100

Q4.DRBD 狀態始終是 Secondary/Unknown?

Error Meaage:

Node1、Node2 主機啓動 DRBD 後狀態始終是 Secondary/Unknown
\#service drbd status
drbd driver loaded OK; device status:
version: 8.3.8 (api:88/proto:86-94)
GIT-hash: d78846e52224fd00562f7c225bcc25b2d422321d build by mockbuild@builder10.centos.org, 2010-06-04 08:04:16
m:res cs ro ds p mounted fstype
0:ha WFConnection Secondary/Unknown Inconsistent/DUnknown C
Ans:

1、Node1、Node2 沒有打開相對應的 Port,請開啓相對應的 Port 或先把 IPTables 服務關閉即可。
2、可能發生了腦裂行爲,一般出現在ha切換時,解決方法:
在一節點執行:

drbdadm secondary resource
drbdadm connect –discard-my-data resource

另一節點執行:

drbdadm connect resource

Q5.1: Failure: (104) Can not open backing device

Error Meaage:
執行drbdadm up r0時出現:

    1: Failure: (104) Can not open backing device.
    Command 'drbdsetup attach 1 /dev/sdb1 /dev/sdb1 internal' terminated with exit code 10

Ans:
可能因爲你掛載了/dev/sdb1,執行umount /dev/sdb1即可。

轉載於https://www.centos.bz/2012/02/drbd-erros-faq/

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章