This section describes mapping table namespaces between Apache HBase tables and HPE Ezmeral Data Fabric Database binary tables.
The MapR 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.
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:
mytable1:/user/aaa/ sends requests for table
mytable1 to the full path
/user/aaa/mytable1.mytable1:/user/aaa sends
requests for table mytable1 to the full path
/user/aaa.When you use the list command without specifying a directory, the
command's behavior depends on two factors:
list command
behavior for each.*:/tables. In this case,
the list command lists the tables in the mapped directory.list command lists the HBase tables.mapr.hbase.default.db
property in the hbase-site.xml is set to hbase, the list
command will return an error stating that HBase is not available. If
the mapr.hbase.default.db property is set to
maprdb, list command will list the HPE Ezmeral Data Fabric Database tables under
the user's home 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>
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>
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>