简体   繁体   English

MapR-DB HBase Java客户端代码

[英]MapR-DB HBase java client code

I need to connect MapR-DB (HBase) via Java code. 我需要通过Java代码连接MapR-DB(HBase)。 I have binary tables 'Table01' inside "/mapr/root/main/database"(path). 我在“ / mapr / root / main / database”(路径)中有二进制表“ Table01”。 maprcli referring to this path "/mapr/root" and my full table name is "/main/database/Table01". maprcli引用此路径“ / mapr / root”,我的完整表名是“ / main / database / Table01”。

below hbase shell command works fine, but when I run java code it stopped at 4th line even not showing any error message and terminate also. 下面的hbase shell命令可以正常工作,但是当我运行Java代码时,它停止在第4行,甚至不显示任何错误消息并终止。

scan '/main/database/Table01'

my java scan code: 我的Java扫描代码:

1.Connection con = ConnectionFactory.createConnection(conf);
2.Table table = con.getTable(TableName.valueOf("/main/database/Table01"));
3.Scan scan = new Scan();
4.ResultScanner rs = table.getScanner(scan);

my Config Code : I got this config values from 'conf/hbase-site.xml' 我的配置代码:我从conf / hbase-site.xml获取了此配置值

static Configuration conf = HBaseConfiguration.create();
conf.set("hbase.zookeeper.quorum", "XXXX");
conf.set("hbase.zookeeper.property.clientPort", "XXXX");
conf.set("hbase.cluster.distributed","true");
conf.set("hbase.rootdir", "maprfs:///hbase");
  1. Have you installed and configured the MapR Client? 您是否已安装并配置了MapR客户端? The client is used to indicate to your code to which cluster it must be connected. 客户端用于向您的代码指示必须将其连接到哪个群集。

You can find the installation instruction: * MapR Client Setup 您可以找到安装说明:* MapR Client安装程序

  1. Do you have any exception that could help us to debug your issue? 您是否有任何例外情况可以帮助我们调试问题?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM