Reputation: 889
I want to do a quick connection check with Zookeeper after creating my configurations and before establishing connection to my HBase master from Java code. Which HBase API method is good for checking the Zookeeper connection status in my cluster?
Upvotes: 0
Views: 1640
Reputation: 7742
Try the following code
Configuration config = HBaseConfiguration.create();
config.set("hbase.zookeeper.quorum", "hbase");
config.set("hbase.zookeeper.property.clientPort","2181");
After you configured the connection, you can test it, using
HBaseAdmin.checkHBaseAvailable(config);
It will test the connection to your database, if Zookeeper doesn't work you will get an error printed saying there is a problem with Zookeeper.
Upvotes: 2