Linux

Linux-HA + dm-multipath:路徑刪除導致段錯誤、核心空指針取消引用和 STONITH

  • August 18, 2011

好吧,我正在設置一個正在執行的 Linux-HA 集群

*起搏器-1.1.5

*openais-1.1.4

*多路徑工具-0.4.9

*OpenSuSE 11.4,核心 2.6.37

集群配置通過了 LinBit 的健康檢查,所以我對此很有信心。

之所以使用多路徑,是因為我們有一個通過 2 個 HBA 連接到每個主機的 LSI SAS 陣列(每個主機總共 4 個路徑)。我現在想做的是通過從多路徑設置中刪除路徑來測試故障轉移功能。

多路徑路徑如下:

pgsql-data (360080e50001b658a000006874e398abe) dm-0 LSI,INF-01-00
size=6.0T features='0' hwhandler='1 rdac' wp=rw
|-+- policy='round-robin 0' prio=0 status=active
| |- 4:0:0:1 sda 8:0   active undef running
| `- 5:0:0:1 sde 8:64  active undef running
`-+- policy='round-robin 0' prio=0 status=enabled
|- 4:0:1:1 sdc 8:32  active undef running
`- 5:0:1:1 sdg 8:96  active undef running

為了模擬失去路徑,我將 1 回顯到 /sys/block/{path}/device/state 這會導致路徑出現多路徑失敗/故障,如下所示:

pgsql-data (360080e50001b658a000006874e398abe) dm-0 LSI,INF-01-00
size=6.0T features='0' hwhandler='1 rdac' wp=rw
|-+- policy='round-robin 0' prio=0 status=active
| |- 4:0:1:1 sdc 8:32  failed faulty offline
| `- 5:0:1:1 sdg 8:96  active undef  running
`-+- policy='round-robin 0' prio=0 status=enabled
|- 4:0:0:1 sda 8:0   active undef  running
`- 5:0:0:1 sde 8:64  active undef  running

但是,我通過觀看 /var/log/messages 注意到 rdac 檢查器說路徑仍在:

multipathd: pgsql-data: sdc - rdac checker reports path is up

另外,讓我們回到多路徑 -l 輸出——注意失敗的路徑如何仍在活動組中?它應該已經被移動到啟用組,並且啟用的活動/執行路徑應該已經取代它(處於活動狀態)。

現在,如果我們關閉另一個啟用的活動路徑 sdg,則 rdac 不僅報告該路徑已啟動,而且多路徑資源在集群中進入 FAILED 狀態,兩個活動/啟用路徑都不會取代它,並且結果是一個段錯誤,一個關於無法取消引用 NULL 點的核心錯誤,並且集群 STONITHs 節點。

db01-primary:/home/kendall/scripts # crm resource show
db01-secondary-stonith     (stonith:external/ipmi) Started 
db01-primary-stonith       (stonith:external/ipmi) Started 
Master/Slave Set: master_drbd [drbd_pg_xlog]
Masters: [ db01-primary ]
Slaves: [ db01-secondary ]
Resource Group: ha-pgsql
multipathd (lsb:/etc/init.d/multipathd) Started  FAILED
pgsql_mp_fs        (ocf::heartbeat:Filesystem) Started 
pg_xlog_fs (ocf::heartbeat:Filesystem) Started 
ha-DBIP-mgmt       (ocf::heartbeat:IPaddr2) Started 
ha-DBIP    (ocf::heartbeat:IPaddr2) Started 
postgresql (ocf::heartbeat:pgsql) Started 
incron     (lsb:/etc/init.d/incron) Started 
pgbouncer  (lsb:/etc/init.d/pgbouncer) Stopped 
pager-email    (ocf::heartbeat:MailTo) Stopped 

db01-primary:/home/kendall/scripts # multipath -l
pgsql-data (360080e50001b658a000006874e398abe) dm-0 LSI,INF-01-00
size=6.0T features='0' hwhandler='1 rdac' wp=rw
|-+- policy='round-robin 0' prio=0 status=enabled
| |- 4:0:1:1 sdc 8:32  failed faulty offline
| `- 5:0:1:1 sdg 8:96  failed faulty offline
`-+- policy='round-robin 0' prio=0 status=active
|- 4:0:0:1 sda 8:0   active undef  running
`- 5:0:0:1 sde 8:64  active undef  running

這是 /var/log/messages 的摘錄,顯示了核心錯誤

Aug 17 15:30:40 db01-primary multipathd: 8:96: mark as failed
Aug 17 15:30:40 db01-primary multipathd: pgsql-data: remaining active paths: 2
Aug 17 15:30:40 db01-primary kernel: [ 1833.424180] sd 5:0:1:1: rejecting I/O to    offline device
Aug 17 15:30:40 db01-primary kernel: [ 1833.424281] device-mapper: multipath: Failing path 8:96.
Aug 17 15:30:40 db01-primary kernel: [ 1833.428389] sd 4:0:0:1: rdac: array , ctlr 1, queueing MODE_SELECT command
Aug 17 15:30:40 db01-primary multipathd: dm-0: add map (uevent)
Aug 17 15:30:41 db01-primary kernel: [ 1833.804418] sd 4:0:0:1: rdac: array , ctlr 1, MODE_SELECT completed
Aug 17 15:30:41 db01-primary kernel: [ 1833.804437] sd 5:0:0:1: rdac: array , ctlr 1, queueing MODE_SELECT command
Aug 17 15:30:41 db01-primary kernel: [ 1833.808127] sd 5:0:0:1: rdac: array , ctlr 1, MODE_SELECT completed
Aug 17 15:30:42 db01-primary multipathd: pgsql-data: sda - rdac checker reports path is up
Aug 17 15:30:42 db01-primary multipathd: 8:0: reinstated
Aug 17 15:30:42 db01-primary kernel: [ 1835.639635] device-mapper: multipath: adding disabled device 8:32
Aug 17 15:30:42 db01-primary kernel: [ 1835.639652] device-mapper: multipath: adding disabled device 8:96
Aug 17 15:30:42 db01-primary kernel: [ 1835.640666] BUG: unable to handle kernel NULL pointer dereference at           (null)
Aug 17 15:30:42 db01-primary kernel: [ 1835.640688] IP: [<ffffffffa01408a3>] dm_set_device_limits+0x23/0x140 [dm_mod]

還有一個堆棧跟踪,位於http://pastebin.com/gifMj7gu

multipath.conf 位於 http://pastebin.com/dw9pqF3Z

任何人對此有任何見解,和/或如何進行?

我每次都可以重新創建它。

好的,事實證明,僅在 /sys/block/{dev}/device/state 中設置“離線”不足以使 rdac 將路徑報告為已關閉。昨晚我花了一些時間在設備上,拉動 SAS 電纜並觀察系統的行為。這可以正常工作。不太“像預期的那樣”,因為當活動路徑不存在時,它不會從啟用的組中被替換,但這是一個不同的問題。故障轉移也按預期工作;一旦最後一條路徑失去,集群就會關閉數據庫和相關資源,並將它們轉移到輔助節點。

如果您發現自己處於類似情況,您可以嘗試在 multipath.conf 中將多路徑 hwhandler 設置為“0”;您必須在 device{} 部分進行設置。這基本上禁用了路徑檢查,因此一旦設備離線,它就真的離線了。

引用自:https://serverfault.com/questions/302268