Question

I followed the hbase quick start and have a local hbase instance running.

I would now like to query it via java, as shown here.

I have this right now:

Configuration configuration = HBaseConfiguration.create();
HTable table1 = new HTable(configuration, "table1");
table1.close();

But when I run it, the process starts, logs a bunch of stuff and never stops. How can I query my local instance from a standalone java app?

I've also tried adding this in, but it did not help:

configuration.set("zk-quorum", "127.0.0.1");
configuration.set("zk-port", "2181");

EDIT #1

It looks like if I'm a little more patient, I get this:

Exception in thread "main" org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to find region for table1,,99999999999999 after 10 tries.
    at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:936)
    at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:841)
    at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:943)
    at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:845)
    at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:810)
    at org.apache.hadoop.hbase.client.HTable.finishSetup(HTable.java:232)
    at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:172)
    at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:131)

I'm not using these properties:

configuration.set("hbase.zookeeper.property.clientPort", "2181");
configuration.set("hbase.zookeeper.quorum", "localhost");
configuration.set("hbase.master", "localhost:600000");

EDIT #2 This is my latest hbase-site.xml:

<configuration>
  <property>
    <name>hbase.rootdir</name>
    <value>file:///data/hbase</value>
  </property>
  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/data/zookeeper</value>
  </property>
  <property>
    <name>hbase.cluster.distributed</name>
    <value>true</value>
  </property>
</configuration>

No correct solution

OTHER TIPS

Please make sure your RegionServer is running fine. Do a quick jps to verify that. Also, in a local setup setting zk host and port is not required. But using it won't do any harm. Use

configuration.set("hbase.zookeeper.property.clientPort", "2181");
configuration.set("hbase.zookeeper.quorum", "localhost");

The third property is no longer required.

If the problem still persists please show me your log files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top