Configure the Default Database for AsyncHBase
For AsynchHBase 1.7 and above, you can configure whether AsyncHBase accesses HBase tables or MapR-DB tables by default. If this value is not configured, AsyncHBase will determine the table type.
The default database can be configured in the asynchbase.conf file and the client application. A default database setting in the client application will override the default database configuration in the aynchbase.conf file.
- When the default database is HBase, AsyncHBase accesses the table using the HBase port that was used to initialize the AsyncHBase client and the table name provided to the application.
- When when default database is MapR-DB, the table name provided to the application is translated to the MapR-DB table path and then AsyncHBase accesses the table.
- When a default database is not configured, AsyncHBase first tries to access the table as a MapR-DB table. Then, if that fails, it tries to access the table as an HBase table.
Set the Default Database using asynchbase.conf
- Add the
mapr.hbase.default.db
parameter in the asynchbase.conf (/opt/mapr/asynchbase/asynchbase-<version>/conf/asynchbase.conf) file. - Set the value of
mapr.hbase.default.db
to one of the following values which will indicate the default database:hbase
maprdb
Set the Default Database in the Client Application
- To access MapR-DB tables:
Config config = new Config(); String dbString = "maprdb"; config.overrideConfig(HBaseClient.CONFIG_PARAM_DEFAULT_DB,dbString); HBaseClient client = new HBaseClient(config);
- To access HBase tables:
Config config = new Config(); String dbString = "hbase"; config.overrideConfig(HBaseClient.CONFIG_PARAM_DEFAULT_DB,dbString); HBaseClient client = new HBaseClient(config);