Define and drop namespaces
You can create and drop namespaces in the HBase shell.
Note | |
---|---|
You can assign a table to only one namespace, and you should ensure that the table correctly belongs to the namespace before you make the association in HBase. You cannot change the namespace that is assigned to the table later. |
The HBase shell has a set of straightforward commands for creating and dropping namespaces. You can assign a table to a namespace when you create the table.
- create_namespace 'my_ns'
-
Creates a namespace with the name
my_ns
. - create 'my_ns:my_table', 'fam1'
Creates
my_table
with a column family identified asfam1
in themy_ns
namespace.- drop_namespace 'my_ns'
-
Removes the
my_ns
namespace from the system. The command only functions when there are no tables with data that are assigned to the namespace.