[英]how to query a local hbase instance
I followed the hbase quick start and have a local hbase instance running. 我遵循了hbase快速入门,并运行了本地hbase实例。
I would now like to query it via java, as shown here . 我现在想通过Java来查询,如图所示这里 。
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?
如何从独立的Java应用程序查询本地实例?
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 编辑#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: 编辑#2这是我最新的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>
Please make sure your RegionServer is running fine. 请确保您的RegionServer运行正常。 Do a quick jps to verify that.
快速进行jps验证。 Also, in a local setup setting zk host and port is not required.
另外,在本地设置中,不需要zk主机和端口。 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. 如果问题仍然存在,请向我显示您的日志文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.