Configure the Default Database for HBase Clients
For HBase version 1.1 and later, a default database configuration determines whether clients connect to HBase tables or HPE Ezmeral Data Fabric Database tables. You can change the default setting for all HBase clients, or you can set the database for a particular job. This setting is ignored for HBase 0.98.12 client connections.
Set the Default Database using configure.sh
About this task
configure.sh
automatically sets the default database for a
node based on the presence of the following mapr
packages:mapr-hbase-master
mapr-hbase-regionserver
configure.sh
also provides a parameter that you can use to
set the default database. To explicitly set the default database to either
maprdb
or hbase
, run
configure.sh
with the -defaultdb
parameter. For
example:configure.sh -R -defaultdb maprdb
The
following table describes the effect of various
configure.sh
commands on the default database setting:If ... | And you run
configure.sh with the following
‑defaultdb parameter ... |
||
---|---|---|---|
No ‑defaultdb parameter
specified |
‑defaultdb hbase |
‑defaultdb maprdb |
|
hbasemaster or
hbaseregionserver is installed on a
node |
The default database is set to
hbase . |
The default database is set to
hbase |
The default database is set to hbase ,
and the maprdb setting is ignored. |
hbasemaster and
hbaseregionserver are NOT installed on
a node |
The default database is set to
maprdb . |
The default database is set to hbase .
However, this configuration does not work because HBase is
not running. |
The default database is set to
maprdb . |
For more information about configure.sh
, see
configure.sh.
Set the Default Database using hbase-site.xml
About this task
mapr.hbase.default.db
property in the
hbase-site.xml
to override the default database that is set for
the cluster:Procedure
-
In the
hbase-site.xml
, edit the default value ofmapr.hbase.default.db
, and set it to eitherhbase
ormaprdb
.For example:<property> <name>mapr.hbase.default.db</name> <value>hbase</value> </property>
-
Copy the property to the
hbase-site.xml
on each node that runs HBase, including any HBase client nodes.
Set the Database Type in the Job Configuration
Procedure
To set the database type in the job configuration you can add the following
code:
- To connect to HPE Ezmeral Data Fabric Database tables:
Configuration conf = HBaseConfiguration.create(); conf.set("mapr.hbase.default.db", "maprdb"); Connection connection = ConnectionFactory.createConnection(conf); Table table = connection.getTable(<TABLE_NAME>);
- To connect to HBase tables:
Configuration conf = HBaseConfiguration.create(); conf.set("mapr.hbase.default.db","hbase"); Connection connection = ConnectionFactory.createConnection(conf); Table table = connection.getTable(<TABLE_NAME>);