LoginSignup
8
6

More than 5 years have passed since last update.

zookeeper leader follower 確認 コマンド

Last updated at Posted at 2015-01-25

zookeeper は奇数単位でアンサンブルと呼ぶクラスタを組む。
3台のアンサンブルだろうが5台のアンサンブルだろうが、その中の1台が書き込みを調停・受理するリーダーとなる。他のサーバはフォロワーと呼ばれ、リーダーのリードオンリーレプリカとなる。

zookeeperの可用性は、アンサンブル中、過半数のサーバが生きていれば機能する。
ZAB(ZookeeperAtomicBroadcast)というプロトコルで実現してる。

つまりアンサンブル中にはリーダーとフォロワーがいる。
その確認コマンドが以下である。


echo stat | nc localhost 2181

※ほかにもstat,dump,enviなどがある

例:
●フォロワー


[root@server2]# echo srvr | nc localhost 2181
Zookeeper version: 3.4.3-cdh4.1.1--1, built on 1/1/2012 17:34 GMT
Latency min/avg/max: 0/0/33
Received: 1867
Sent: 1878
Outstanding: 0
Zxid: 0x100000092
Mode: follower
Node count: 16

●リーダー


[root@server1]# echo srvr | nc localhost 2181
Zookeeper version: 3.4.3-cdh4.1.1--1, built on 1/1/2012 17:34 GMT
Latency min/avg/max: 0/0/15
Received: 8104
Sent: 8124
Outstanding: 0
Zxid: 0x100000092
Mode: leader
Node count: 16

今が旬の分散システム、その調停役として、HBaseやSorlなどで大活躍だが影がうすい。。
かなり重要な役割を担ってるが影が薄い。。
バグった時だけ脚光を浴びるというインフラのような存在。。
zookeeperはロック、排他制御、同期、ウォッチャー(死活監視)等を行う。

8
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
6