If you want to connect to an HBase server, first you need to make sure that the IP of the server is in your /etc/hosts file for example add the line
Then you can use the Java API to connect to zookeeper, you only have to specify the client port and the zookeeper address
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
If you have a problem with your HBase configuration, an exception will be thrown.
Finally to connect to the server, just use
Connection connection = ConnectionFactory.createConnection(config);