HBase shell commands
This topic describes the main commands available while working with HBase shell.
General commands
These commands are useful for general purposes, such as displaying the current cluster and user information, getting help, etc.
Data definition commands (DDL)
These commands are used to create table schemas and work with them.
Command | Description |
---|---|
Creates a new table |
|
Displays a table schema |
|
Displays tables matching the given regex |
|
Checks the table existence |
|
Locates a Region by the given table name and the row key |
|
Returns all Regions for the particular table |
|
Allows users to add/modify/delete column families and to change the table configuration |
|
Performs the same as alter command, but does not wait for all Regions to receive the schema changes |
|
Gets the status of the alter command |
|
Disables a table |
|
Disables tables matching the given regex |
|
Checks whether the table is disabled or not |
|
Enables the table which might be currently disabled |
|
Enables tables matching the given regex |
|
Checks whether the table is enabled or not |
|
Returns the given table as an object to be manipulated by the user |
|
Deletes a table permanently |
|
Deletes all tables matching the given regex |
|
Shows all filters in HBase |
Namespace commands
These commands allow users to work with namespaces — logical groups of tables.
Command | Description |
---|---|
Creates a new namespace |
|
Returns the namespace description |
|
Returns a list of namespaces — all or matching the given regex |
|
Returns tables included into the namespace |
|
Changes a namespace |
|
Drops a namespace |
Data manipulation commands (DML)
These commands are useful for working with data stored in HBase tables: reading, writing, deleting, etc.
Command | Description |
---|---|
Inserts a cell value at the specified table/row/column and optionally timestamp coordinates |
|
Appends a cell value at the specified table/row/column coordinates |
|
Increments a cell value at the specified table/row/column coordinates |
|
Returns a counter cell value at the specified table/row/column coordinates |
|
Fetches the row/cell contents |
|
Scans the table and returns all the rows matching the given specifications |
|
Returns a number of rows in the table |
|
Deletes a cell value at the specified table/row/column and optionally timestamp coordinates |
|
Deletes all cells in the specified row |
|
Disables, drops, and recreates the specified table |
|
Disables, drops, and recreates the specified table, maintaining the previous Region boundaries |
|
Returns split points for the given table |
Tools commands
These commands are intended for experts only. They help to perform operations with Regions, such as: split, merge, compaction, etc. Use them carefully.
Command | Description |
---|---|
Assigns a Region |
|
Unassigns a Region |
|
Deprecated. Use unassign instead |
|
Runs compaction for the defined table/Region/column family |
|
Compacts all Regions within the defined Region Server |
|
Runs Major compaction for the defined table/Region/column family |
|
Gets the table compaction status |
|
Checks whether split or merge operations are enabled |
|
Enables/disables split or merge operations |
|
Merges two Regions |
|
Splits the entire table or the specified Region |
|
Moves a Region |
|
Flushes all Regions for the table/Region Server or all Regions with the specified name |
|
Rolls the WAL writer |
|
Lists all dead Region Servers |
|
Clears all/specified dead Region Servers |
|
Clears blocks of the specified table from BlockCache |
|
Clears compaction queues at the Region Server |
|
Enables/disables the cluster Balancer |
|
Checks the Balancer state |
|
Triggers the cluster Balancer |
|
Enables/disables the CatalogJanitor |
|
Checks the CatalogJanitor state |
|
Runs the CatalogJanitor |
|
Enables/disables the Cleaner chore |
|
Checks the Cleaner chore state |
|
Runs the Cleaner chore |
|
Enables/disables the Region Normalizer |
|
Checks the Region Normalizer state |
|
Runs the Region Normalizer |
|
Checks whether the Master is in maintenance mode |
|
Shows the dump status of the HBase cluster, as seen by ZooKeeper |
|
Starts/stops/checks tracing via HTrace |
Replication commands
These commands are used for configuring replication.
Command | Description |
---|---|
Adds a replication relationship (peer) |
|
Appends replicable namespaces to the replication peer |
|
Appends replicable tables/column families to the replication peer |
|
Sets all replicable namespaces for the replication peer |
|
Sets all replicable tables/column families for the replication peer |
|
Sets the source bandwidth for the replication peer (per Region Server) |
|
Sets the |
|
Sets not replicable namespaces for the replication peer |
|
Sets not replicable tables/column families for the replication peer |
|
Disables replication for all column families of the table |
|
Enables replication for all column families of the table |
|
Disables a replication peer |
|
Enables the previously disabled replication peer |
|
Lists configuration parameters of the replication peer |
|
Updates configuration parameters of the replication peer |
|
Lists configuration parameters of all replication peers |
|
Lists all replication peers |
|
Lists all tables and column families replicated from the cluster |
|
Shows replicable tables/column families for the replication peer |
|
Removes namespaces from the replication peer configuration |
|
Removes tables/column families from the replication peer configuration |
|
Disables and removes a replication peer |
Snapshots commands
These commands allow users to work with table snapshots.
Command | Description |
---|---|
Takes a snapshot of the specified table |
|
Returns a list of snapshots — all or matching the given regex |
|
Returns snapshots of the specified table |
|
Restores the specified snapshot |
|
Creates a new table by cloning the specified snapshot |
|
Deletes a snapshot with the specified name |
|
Deletes all snapshots with the name matching the given regex |
|
Deletes snapshots of the specified table |
Configuration commands
These commands are used to reload configuration parameters without restarting a cluster.
The set of configuration parameters that can be currently changed by this command is limited. See more details in the HBase documentation.
Command | Description |
---|---|
Reloads a subset of configuration parameters on all cluster servers |
|
Reloads a subset of configuration parameters on the specified cluster servers |
Quotas commands
These commands are used to work with quotas — resource and other restrictions applied to database objects.
Before using the commands from this group, add the following property to hbase-site.xml and restart your cluster.
<property>
<name>hbase.quota.enabled</name>
<value>true</value>
</property>
Command | Description |
---|---|
Sets a new quota for the defined user/table/namespace |
|
Returns quotas added to HBase — all or matching the given regex |
|
Returns the computed size of each table in the cluster |
|
Returns information about tables with defined space quotas |
|
Returns the size of snapshots made for tables with defined space quotas |
Security commands
These commands are useful for security configuring needs.
Before using the commands from this group, add the following properties to hbase-site.xml and restart your cluster. If properties hbase.coprocessor.master.classes
or hbase.coprocessor.region.classes
already have another values, use comma-separated lists for keeping several values for them.
<property>
<name>hbase.coprocessor.master.classes</name>
<value>org.apache.hadoop.hbase.security.access.AccessController</value>
</property>
<property>
<name>hbase.coprocessor.region.classes</name>
<value>org.apache.hadoop.hbase.security.access.AccessController</value>
</property>
<property>
<name>hbase.rpc.engine</name>
<value>org.apache.hadoop.hbase.ipc.SecureRpcEngine</value>
</property>
<property>
<name>hbase.security.authorization</name>
<value>true</value>
</property>
Command | Description |
---|---|
Grants a user the specific rights |
|
Returns supported security capabilities |
|
Revokes a user access rights |
|
Returns permissions for the specified user |
Procedures commands
These commands are used to work with HBase procedures.
Command | Description |
---|---|
Returns all the procedures in HBase |
|
Aborts running of the procedure with the specified ID |
|
Returns all the locks in HBase |
Visibility labels commands
These commands are used to control visibility labels, which permit users, associated with the given label, to read or access cells with that label.
Before using the commands from this group, add the following properties to hbase-site.xml and restart your cluster. If properties hbase.coprocessor.master.classes
or hbase.coprocessor.region.classes
already have another values, use comma-separated lists for keeping several values for them.
<property>
<name>hbase.coprocessor.master.classes</name>
<value>org.apache.hadoop.hbase.security.visibility.VisibilityController</value>
</property>
<property>
<name>hbase.coprocessor.region.classes</name>
<value>org.apache.hadoop.hbase.security.visibility.VisibilityController</value>
</property>
<property>
<name>hbase.security.authorization</name>
<value>true</value>
</property>
<property>
<name>hfile.format.version</name>
<value>3</value>
</property>
Command | Description |
---|---|
Adds a set of visibility labels |
|
Returns a list of available visibility labels |
|
Assigns a set of visibility labels to the defined user or group |
|
Gets visibility labels assigned to the defined user or group |
|
Clears visibility labels assigned to the defined user or group |
|
Sets the visibility expression on one or more existing table cells |
Rsgroup commands
These commands allow users to manage Region Server groups — logical unions of Region Servers. Each group can mount different tables, if necessary. Thus, each group is equivalent to a logical subcluster. It helps to achieve resource isolation and to reduce management costs. The default Region Server group is called default
.
Before using the commands from this group, add the following properties to hbase-site.xml and restart your cluster. If properties hbase.coprocessor.master.classes
or hbase.coprocessor.region.classes
already have another values, use comma-separated lists for keeping several values for them.
<property>
<name>hbase.coprocessor.master.classes</name>
<value>org.apache.hadoop.hbase.rsgroup.RSGroupAdminEndpoint</value>
</property>
<property>
<name>hbase.master.loadbalancer.class</name>
<value>org.apache.hadoop.hbase.rsgroup.RSGroupBasedLoadBalancer</value>
</property>
Command | Description |
---|---|
Creates a new Region Server group |
|
Returns all Region Server groups |
|
Assigns the given servers to the specified Region Server group |
|
Assigns the given tables to the specified Region Server group |
|
Assigns the given servers and tables to the specified Region Server group |
|
Assigns the given namespaces to the specified Region Server group |
|
Assigns the given servers and namespaces to the specified Region Server group |
|
Balances a Region Server group |
|
Gets the Region Server group information |
|
Gets a name of the group, which the given Region Server is a member of |
|
Gets a name of the group, which the given table is a member of |
|
Removes decommissioned servers from the Region Server group |
|
Removes the Region Server group |