Home Forums HBase Problem simple with Java client from OSX – HDP 2 Sandbox under VBox

This topic contains 3 replies, has 3 voices, and was last updated by  Kieran Beltran 9 months, 2 weeks ago.

  • Creator
    Topic
  • #43898

    I am trying to get a simple Java client application running to test a HDP 2.0 Sandbox on OSX.

    I am invoking the following client under OSX to test with command line args: horton, 2181

    public class TestHortonSandbox {
    public static void main(String[] args) throws IOException {
    Configuration config = HBaseConfiguration.create();
    config.set(“hbase.zookeeper.quorum”, args[0]);
    config.set(“hbase.zookeeper.property.clientPort”, args[1]);
    try {
    HBaseAdmin.checkHBaseAvailable(config);
    } catch (MasterNotRunningException e) {
    System.out.println(“HBase is not running.”);
    System.exit(1);
    } catch (ServiceException e) {
    e.printStackTrace();
    System.out.println(“Service Exception”);
    System.exit(1);
    }
    System.out.println(“*** Things look healthy ***”);
    }
    }

    I am receiving the following error:

    2013-11-17 06:55:28,952 INFO [main] zookeeper.ZooKeeper (ZooKeeper.java:(438)) – Initiating client connection, connectString=192.168.56.3:2181 sessionTimeout=90000 watcher=hconnection-0x5f8fb0ca
    2013-11-17 06:55:28,967 INFO [main] zookeeper.RecoverableZooKeeper (RecoverableZooKeeper.java:(120)) – Process identifier=hconnection-0x5f8fb0ca connecting to ZooKeeper ensemble=192.168.56.3:2181
    2013-11-17 06:55:29,002 INFO [main-SendThread(horton:2181)] zookeeper.ClientCnxn (ClientCnxn.java:logStartConnect(966)) – Opening socket connection to server horton/192.168.56.3:2181. Will not attempt to authenticate using SASL (unknown error)
    2013-11-17 06:55:29,007 INFO [main-SendThread(horton:2181)] zookeeper.ClientCnxn (ClientCnxn.java:primeConnection(849)) – Socket connection established to horton/192.168.56.3:2181, initiating session
    2013-11-17 06:55:29,014 INFO [main-SendThread(horton:2181)] zookeeper.ClientCnxn (ClientCnxn.java:onConnected(1211)) – Session establishment complete on server horton/192.168.56.3:2181, sessionid = 0x14265e8aa4f0007, negotiated timeout = 40000
    2013-11-17 06:55:29,018 INFO [main] client.ZooKeeperRegistry (ZooKeeperRegistry.java:getClusterId(85)) – ClusterId read in ZooKeeper is null
    2013-11-17 06:55:29,058 INFO [main] client.HConnectionManager$HConnectionImplementation (HConnectionManager.java:makeStub(1602)) – getMaster attempt 1 of 1 failed; no more retrying.
    java.io.IOException: Can’t get master address from ZooKeeper; znode data == null

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

  • Author
    Replies
  • #43913

    Enis / Peter,

    I was able to get to Hue via http://192.168.56.3:8000 and was able to run Hbase shell commands…so Hbase appears up and healthy

    Went back to my java program (with the added config.set(“zookeeper.znode.parent”, “/hbase-unsecure”) in lieu of the classpath change…

    I added the line qualified name sandbox.hortonworks.com (rather than simply sandbox) to the /etc/hosts on the OSX and that did it!

    Thanks much.
    Kieran

    Collapse
    #43903

    Enis Soztutar
    Participant

    Hi Kieran,

    As Peter points out, you should also set the zookeeper.znode.parent property to “/hbase-unsercure”. However, the recommended practice for hbase clients is to not set the config properties, but add hbase conf dir (/etc/hbase/conf/) to classpath, and let HBaseConfiguration take care reading the necessary configuration. You can also copy the conf files from /etc/hbase/conf to your classpath as well.

    Collapse
    #43902

    1. You need to start HBase (it’s disabled by default on Sandbox). You can do it either from hue about page (http://127.0.0.1:8000/about/) or from ambari.
    2. You need to make dns alias in /etc/hosts to :
    sandbox.hortonworks.com 127.0.0.1
    3. Whether copy /etc/hbase/conf/hbase-site.xml from sandbox to your classpath or add one more setting to your code:

    config.set("zookeeper.znode.parent", "/hbase-unsecure");

    Collapse
Viewing 3 replies - 1 through 3 (of 3 total)