I'm trying to interact with a MapR-DB table from a simple Java application that is running within a node of an M3 MapR cluster. It seems that I am able to connect to the cluster but apparently I am not able to connect to the table properly. This is a snippet from the code:
Configuration configuration = new Configuration();
configuration.set("hbase.zookeeper.quorum", "192.168.2.1,192.168.2.2,192.168.2.3");
configuration.set("hbase.zookeeper.property.clientPort", "5181");
configuration.set("mapr.htable.impl", "com.mapr.fs.MapRHTable");
configuration.set("hbase.table.namespace.mappings", "*:/user/mapr/");
configuration = HBaseConfiguration.create(configuration);
HConnection connection = HConnectionManager.createConnection(configuration);
System.out.println("Is Master running? " + connection.isMasterRunning());
String tableName = args[0];
HTable table = (HTable) connection.getTable(tableName.getBytes());
for (HColumnDescriptor columnFamily : table.getTableDescriptor().getColumnFamilies()) {
System.out.println("Column family: " + columnFamily.getNameAsString());
}
I have a table that is called "/user/mapr/test_table" (I see it in the MapR Web Console and I can access it through hbase shell). Running the code with any reasonable parameter for the table name just returns this exception:
org.apache.hadoop.hbase.TableNotFoundException: /user/mapr/test_table
at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getHTableDescriptor(HConnectionManager.java:2750)
at org.apache.hadoop.hbase.client.HTable.getTableDescriptor(HTable.java:701)
at it.noovle.bigdata.hadoop.MaprDBLocalTest.main(MaprDBLocalTest.java:49)
- In several places I read that with MapR-DB it is not necessary to connect through Zookeeper. Is it true in general or only for M7? I am running M3 at the moment.
- Is there a specific way to address MapR-DB tables from the Java HBase API? In
hbase shellI simply use '/user/mapr/test_table'. - Someone can share a decent example of a running example for an M3 cluster?