Skip to content

Useful commands for debugging

YUKI "Piro" Hiroshi edited this page Apr 17, 2015 · 5 revisions

Serfクラスタの様子を見る

$ sudo -u droonga-engine -H /home/droonga-engine/droonga/serf \
    members -rpc-addr node0:7373
node0/protocol-adapter  192.168.100.50:8946  alive  role=protocol-adapter
node0:10031/droonga     192.168.100.50:7946  alive  role=engine,cluster_id=f52d474afd2c34511cddaf5bc92243b017670e6b
node1/protocol-adapter  192.168.100.51:8946  alive  role=protocol-adapter
node1:10031/droonga     192.168.100.51:7946  alive  role=engine,cluster_id=29a2f18f5a7f6c2f0d471ef618ed9d4369f56750
  • -rpc-addr(hostname):7373にすると、Engineから見た時のクラスタの様子が見える。
  • -rpc-addr(hostname):8373にすると、Protocol Adapterから見た時のクラスタの様子が見える。
  • -format jsonを加えると、結果をJSON形式で見ることができる。

コマンドの異常終了などで変わってしまったroleを元に戻す

$ sudo -u droonga-engine -H /home/droonga-engine/droonga/serf \
    tags -rpc-addr node0:7373 -set role=service-provider
$ sudo -u droonga-engine -H /home/droonga-engine/droonga/serf \
    tags -rpc-addr node1:7373 -set role=service-provider
$ sudo -u droonga-engine -H /home/droonga-engine/droonga/serf \
    tags -rpc-addr node2:7373 -set role=service-provider

Protocol Adapterを通して、クラスタの構成を見る

$ curl "http://node0:10041/droonga/system/status?" | jq "."
{
  "nodes": {
    "node0:10031/droonga": {
      "live": true
    }
  }
}

Protocol Adapterを通さずに、Engineが認識しているクラスタの構成を見る

$ droonga-system-status --host node0 --receiver-host node1 --pretty
{
  "nodes": {
    "node0:10031/droonga": {
      "live": false
    },
    "node1:10031/droonga": {
      "live": true
    }
  }
}

Protocol Adapterが接続しているEngineの一覧を見る

$ curl "http://node0:10041/engines" | jq "."                                                      
{
  "hostNames": [
    "node1",
    "node0"
  ],
  "clusterId": "29a2f18f5a7f6c2f0d471ef618ed9d4369f56750"
}