简体   繁体   中英

MapR-DB HBase java client code

I need to connect MapR-DB (HBase) via Java code. I have binary tables 'Table01' inside "/mapr/root/main/database"(path). maprcli referring to this path "/mapr/root" and my full table name is "/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.

scan '/main/database/Table01'

my java scan code:

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'

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? 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

  1. Do you have any exception that could help us to debug your issue?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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