將hbase中的RegionServer移除(1)

(問題)
如何將hbase中的RegionServer移除?

(方法)
在hbase中,RegionServer扮演提供Region存取的角色,
若是要關閉一個使用中的RegionServer應該怎麼做呢?

最簡單的作法,就是直接將RegionServer關閉,
在hbase的機制中,所有的RegionServer都是作為暫時ZooKeeper節點(ephemeral node),
而存在於hbase叢集中,當RegionServer離開時,
hbase能夠自動的發現RegionServer消失,並且標註為dead server.
詳細關於ZooKeeper節點的角色和機制,可以參考這一篇文章:
http://archive.cloudera.com/cdh/3/hbase/decommission.html

"The RegionServer will first close all regions and then shut itself down. On shutdown, the RegionServer's ephemeral node in ZooKeeper will expire. The master will notice the RegionServer gone and will treat it as a 'crashed' server; it will reassign the nodes the RegionServer was carrying."

直接關閉RegionServer將導致大量的Region找不到服務的RegionServer,
並不是一個好的做法,因此,hbase提供一個腳本(script),
讓我們能夠將RegionServer節點移除,操作方法如下:

/opt/hbase/bin/graceful_stop.sh [hostname]

透過此腳本,將會把hostname位址的RegionServer上的Region移出,
並在完成後,將HRegionServer這個程序關閉,
由於搬移Region的動作和Load Balancer相衝突,
在執行graceful_stop.sh時,將自動把Load Balancer關閉,
執行後輸出結果如下:

Disabling balancer!
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.94.2, r1395367, Sun Oct  7 19:11:01 UTC 2012

balance_switch false
true
0 row(s) in 0.9680 seconds

Unloading master.hbase.mbwcl.nctu.edu.tw region(s)
Valid region move targets:
192.168.2.132,60020,1421658663768
192.168.2.131,60020,1421658598750
Unloaded master.hbase.mbwcl.nctu.edu.tw region(s)
master.hbase.mbwcl.nctu.edu.tw: stopping regionserver.




留言

熱門文章

LTE筆記: RSRP, RSSI and RSRQ

[WiFi] WiFi 網路的識別: BSS, ESS, SSID, ESSID, BSSID

LTE筆記: 波束成型 (beamforming) 和天線陣列