The Hortonworks Community Connection is now live. A completely rebuilt Q&A forum, Knowledge Base, Code Hub and more, backed by the experts in the industry.

You will be redirected here in 10 seconds. If your are not redirected, click here to visit the new site.

The legacy Hortonworks Forum is now closed. You can view a read-only version of the former site by clicking here. The site will be taken offline on January 31,2016

HBase Forum

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

  • #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

  • Author
    Replies
  • #43902
    Peter Rudenko
    Moderator

    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");

    #43903
    Enis Soztutar
    Moderator

    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.

    #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

The forum ‘HBase’ is closed to new topics and replies.

Support from the Experts

A HDP Support Subscription connects you experts with deep experience running Apache Hadoop in production, at-scale on the most demanding workloads.

Enterprise Support »

Become HDP Certified

Real world training designed by the core architects of Hadoop. Scenario-based training courses are available in-classroom or online from anywhere in the world

Training »

Hortonworks Data Platform
The Hortonworks Data Platform is a 100% open source distribution of Apache Hadoop that is truly enterprise grade having been built, tested and hardened with enterprise rigor.
Get started with Sandbox
Hortonworks Sandbox is a self-contained virtual machine with Apache Hadoop pre-configured alongside a set of hands-on, step-by-step Hadoop tutorials.
Modern Data Architecture
Tackle the challenges of big data. Hadoop integrates with existing EDW, RDBMS and MPP systems to deliver lower cost, higher capacity infrastructure.