Mapping to HBase Table Namespaces
This section describes mapping table namespaces between Apache HBase tables and HPE Ezmeral Data Fabric Database binary tables.
The HPE Ezmeral Data Fabric implementations of the HBase Java API and
libhbase differentiate between Apache HBase tables and HPE Ezmeral Data Fabric Database
tables according to table names. In certain cases, such as migrating code from Apache HBase
tables to HPE Ezmeral Data Fabric Database tables, users need to force the API they are
using to access a HPE Ezmeral Data Fabric Database table, even though the table name
could map to an Apache HBase table. The hbase.table.namespace.mappings
property allows you to map Apache HBase table names to HPE Ezmeral Data Fabric Database
tables. This property is typically set in the configuration file
/opt/mapr/hadoop/hadoop-<version>/etc/hadoop/core-site.xml
.
In general, if a table name includes a slash (/
), the name is assumed to
be a path to a HPE Ezmeral Data Fabric Database table, because slash is not a valid character for Apache HBase table
names. In the case of "flat" table names without a slash, namespace conflict is possible,
and you might need to use table mappings.
Table Mapping Naming Conventions
A table mapping takes the form
name:map
, where
name
is the table name to redirect and
map
is the modification made to the name. The value in
name
can be a literal string or contain the *
wildcard. When
mapping a name with a wild card, the mapping is treated as a directory. Requests to
tables with names that match the wild card are sent to the directory in the mapping.
When mapping a name that is a literal string, you can choose from two different behaviors:
- End the mapping with a slash to indicate that this mapping is to a directory. For
example, the mapping
mytable1:/user/aaa/
sends requests for tablemytable1
to the full path/user/aaa/mytable1
. - End the mapping without a slash, which creates an alias and treats the mapping as a
full path. For example, the mapping
mytable1:/user/aaa
sends requests for tablemytable1
to the full path/user/aaa
.
Mappings and Table Listing Behaviors
When you use the list
command without specifying a directory, the
command's behavior depends on two factors:
- Whether a table mapping exists
- Whether Apache HBase is installed and running
list
command
behavior for each.- There is a table mapping for *, as in
*:/tables
. In this case, thelist
command lists the tables in the mapped directory. - There is no mapping for *, and Apache HBase is installed and running. In this
case, the
list
command lists the HBase tables. - There is no mapping for *, and Apache HBase is not installed or is not
running.
- For HBase 0.98.12, the shell will try to connect to an HBase cluster but it will return an error instead.
- For HBase 1.1 or above, if the
mapr.hbase.default.db
property in the hbase-site.xml is set tohbase
, the list command will return an error stating that HBase is not available. If themapr.hbase.default.db
property is set tomaprdb
, list command will list the HPE Ezmeral Data Fabric Database tables under the user's home directory.
Example 1: Map all HBase tables to HPE Ezmeral Data Fabric Database tables in a directory
In this example, any flat table name foo
is treated as a HPE Ezmeral Data Fabric Database table
in the directory /tables_dir/foo
.
<property>
<name>hbase.table.namespace.mappings</name>
<value>*:/tables_dir</value>
</property>
Example 2: Map specific Apache HBase tables to specific HPE Ezmeral Data Fabric Database tables
In this example, the Apache HBase table name mytable1
is treated as a
HPE Ezmeral Data Fabric Database table at /user/aaa/mytable1
. The Apache Hbase table name
mytable2
is treated as a HPE Ezmeral Data Fabric Database table at
/user/bbb/mytable2
. All other Apache HBase table names are treated
as stock Apache HBase tables.
<property>
<name>hbase.table.namespace.mappings</name>
<value>mytable1:/user/aaa/,mytable2:/user/bbb/</value>
</property>
Example 3: Combination of specific table names and wildcards
Mappings are evaluated in order. In this example, the flat table name
mytable1
is treated as a HPE Ezmeral Data Fabric Database table at
/user/aaa/mytable1
. The flat table name mytable2
is
treated as a HPE Ezmeral Data Fabric Database table at /user/bbb/mytable2
. Any other flat table
name foo
is treated as a HPE Ezmeral Data Fabric Database table at
/tables_dir/foo
.
<property>
<name>hbase.table.namespace.mappings</name>
<value>mytable1:/user/aaa/,mytable2:/user/bbb/,*:/tables_dir</value>
</property>