下面是節(jié)點(diǎn)galera 節(jié)點(diǎn)197.3.155.152異常關(guān)閉之后,197.3.155.151節(jié)點(diǎn)的日志:
2016-07-07 11:05:49 1400117****4240 [Note] WSREP: (fb55d9c9, 'tcp://0.0.0.0:4567') turning message relay requesting on, nonlive peers: tcp://197.3.155.152:4567
發(fā)現(xiàn)nonlive的節(jié)點(diǎn)197.3.155.152
2016-07-07 11:05:51 1400117****4240 [Note] WSREP: (fb55d9c9, 'tcp://0.0.0.0:4567') reconnecting to 51f4c07a (tcp://197.3.155.152:4567), attempt 0
重新嘗試發(fā)送一個(gè)keepalived的鏈接。
2016-07-07 11:05:55 1400117****4240 [Note] WSREP: evs::proto(fb55d9c9, GATHER, view_id(REG,128a493c,122)) suspecting node: 51f4c07a
經(jīng)過(guò)5秒還沒(méi)有收到響應(yīng),懷疑節(jié)點(diǎn)已經(jīng)宕掉,51f4c07a即197.3.155.152。
2016-07-07 11:05:55 1400117****4240 [Note] WSREP: evs::proto(fb55d9c9, GATHER, view_id(REG,128a493c,122)) suspected node without join message, declaring inactive
宣判節(jié)點(diǎn)宕掉。declaring inactive
2016-07-07 11:05:55 1400117****4240 [Note] WSREP: declaring 128a493c at tcp://197.3.155.150:4567 stable
獲取存活的節(jié)點(diǎn)信息。
2016-07-07 11:05:55 1400117****4240 [Note] WSREP: Node 128a493c state prim
獲取存活的節(jié)點(diǎn)的狀態(tài)。
2016-07-07 11:05:55 1400117****4240 [Note] WSREP: view(view_id(PRIM,128a493c,123) memb {
128a493c,0
fb55d9c9,0
} joined {
} left {
} partitioned {
51f4c07a,0
})
對(duì)宕掉的節(jié)點(diǎn)進(jìn)行移除,即partitioned
2016-07-07 11:05:55 1400117****4240 [Note] WSREP: save pc into disk
2016-07-07 11:05:55 1400117****4240 [Note] WSREP: forgetting 51f4c07a (tcp://197.3.155.152:4567)
2016-07-07 11:05:55 1400117****1536 [Note] WSREP: New COMPONENT: primary = yes, bootstrap = no, my_idx = 1, memb_num = 2
打印新的primary COMPONENT 信息。
2016-07-07 11:05:55 1400117****1536 [Note] WSREP: STATE EXCHANGE: Waiting for state UUID.
2016-07-07 11:05:55 1400117****4240 [Note] WSREP: (fb55d9c9, 'tcp://0.0.0.0:4567') turning message relay requesting off
2016-07-07 11:05:55 1400117****1536 [Note] WSREP: STATE EXCHANGE: sent state msg: b8a08882-43ef-11e6-884e-2beaea270cdb
2016-07-07 11:05:55 1400117****1536 [Note] WSREP: STATE EXCHANGE: got state msg: b8a08882-43ef-11e6-884e-2beaea270cdb from 0 (node3)
2016-07-07 11:05:55 1400117****1536 [Note] WSREP: STATE EXCHANGE: got state msg: b8a08882-43ef-11e6-884e-2beaea270cdb from 1 (node2)
2016-07-07 11:05:55 1400117****1536 [Note] WSREP: Quorum results:
version = 4,
component = PRIMARY,
conf_id = 33,
members = 2/2 (joined/total),
act_id = 128****12,
last_appl. = 0,
protocols = 0/7/3 (gcs/repl/appl),
group UUID = afbfeed1-38e8-11e6-84b1-d20f5b484535
新的集群狀態(tài)信息在新的primary component 內(nèi)的節(jié)點(diǎn)進(jìn)行交換與確認(rèn)。
2016-07-07 11:05:55 1400117****1536 [Note] WSREP: Flow-control interval: [23, 23]
2016-07-07 11:05:55 1400119****1184 [Note] WSREP: New cluster view: global state: afbfeed1-38e8-11e6-84b1-d20f5b484535:128****12, view# 34: Primary, number of nodes: 2, my index: 1, protocol version 3
2016-07-07 11:05:55 1400119****1184 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.
2016-07-07 11:05:55 1400119****1184 [Note] WSREP: REPL Protocols: 7 (3, 2)
2016-07-07 11:05:55 1400118****6944 [Note] WSREP: Service thread queue flushed.
2016-07-07 11:05:55 1400119****1184 [Note] WSREP: Assign initial position for certification: 128****12, protocol version: 3
2016-07-07 11:05:55 1400118****6944 [Note] WSREP: Service thread queue flushed.
2016-07-07 11:05:58 1400117****4240 [Note] WSREP: cleaning up 51f4c07a (tcp://197.3.155.152:4567)
完全剔除197.3.155.152。
上面的日志中,涉及到進(jìn)行節(jié)點(diǎn)宕機(jī)檢查的timeout 時(shí)間,詳細(xì)信息請(qǐng)參考官方文檔,作者做了截圖,請(qǐng)查看!
幾個(gè)相關(guān)的參數(shù)有相對(duì)大小的關(guān)系,特殊設(shè)置時(shí)請(qǐng)注意:
順便提一下,在galera 集群中,執(zhí)行ddl會(huì)造成整個(gè)集群hang ,如果ddl只要執(zhí)行的時(shí)間較長(zhǎng),在交易頻率的系統(tǒng)上,則就造成了悲劇。下面的方式可以避免這種情況。
To run an ALTER statement in this manner, on each node run the following queries:
在galera集群的每一個(gè)節(jié)點(diǎn)上執(zhí)行下面的步驟:
1. Change the Schema Upgrade method to Rolling Schema Upgrade.
SET wsrep_OSU_method='RSU';
設(shè)置為滾動(dòng)schema變更模式。
2. Run the ALTER statement.
執(zhí)行alter 語(yǔ)句。
3. Reset the Schema Upgrade method back to Total Order Isolation.
SET wsrep_OSU_method='TOI';
將schema的變更模式重新設(shè)置為T(mén)OI。