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.

Command Description

status

Shows a status of the HBase cluster

table_help

Displays help on such data operations, as scan, put, get, disable, drop, etc.

whoami

Displays the current user details

version

Displays the HBase version

processlist

Displays tasks of Region Servers

Data definition commands (DDL)

These commands are used to create table schemas and work with them.

Command Description

create

Creates a new table

describe

Displays a table schema

list

Displays tables matching the given regex

exists

Checks the table existence

locate_region

Locates a Region by the given table name and the row key

list_regions

Returns all Regions for the particular table

alter

Allows users to add/modify/delete column families and to change the table configuration

alter_async

Performs the same as alter command, but does not wait for all Regions to receive the schema changes

alter_status

Gets the status of the alter command

disable

Disables a table

disable_all

Disables tables matching the given regex

is_disabled

Checks whether the table is disabled or not

enable

Enables the table which might be currently disabled

enable_all

Enables tables matching the given regex

is_enabled

Checks whether the table is enabled or not

get_table

Returns the given table as an object to be manipulated by the user

drop

Deletes a table permanently

drop_all

Deletes all tables matching the given regex

show_filters

Shows all filters in HBase

Namespace commands

These commands allow users to work with namespaces — logical groups of tables.

Command Description

create_namespace

Creates a new namespace

describe_namespace

Returns the namespace description

list_namespace

Returns a list of namespaces — all or matching the given regex

list_namespace_tables

Returns tables included into the namespace

alter_namespace

Changes a namespace

drop_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

put

Inserts a cell value at the specified table/row/column and optionally timestamp coordinates

append

Appends a cell value at the specified table/row/column coordinates

incr

Increments a cell value at the specified table/row/column coordinates

get_counter

Returns a counter cell value at the specified table/row/column coordinates

get

Fetches the row/cell contents

scan

Scans the table and returns all the rows matching the given specifications

count

Returns a number of rows in the table

delete

Deletes a cell value at the specified table/row/column and optionally timestamp coordinates

deleteall

Deletes all cells in the specified row

truncate

Disables, drops, and recreates the specified table

truncate_preserve

Disables, drops, and recreates the specified table, maintaining the previous Region boundaries

get_splits

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

assign

Assigns a Region

unassign

Unassigns a Region

close_region

Deprecated. Use unassign instead

compact

Runs compaction for the defined table/Region/column family

compact_rs

Compacts all Regions within the defined Region Server

major_compact

Runs Major compaction for the defined table/Region/column family

compaction_state

Gets the table compaction status

splitormerge_enabled

Checks whether split or merge operations are enabled

splitormerge_switch

Enables/disables split or merge operations

merge_region

Merges two Regions

split

Splits the entire table or the specified Region

move

Moves a Region

flush

Flushes all Regions for the table/Region Server or all Regions with the specified name

wal_roll

Rolls the WAL writer

list_deadservers

Lists all dead Region Servers

clear_deadservers

Clears all/specified dead Region Servers

clear_block_cache

Clears blocks of the specified table from BlockCache

clear_compaction_queues

Clears compaction queues at the Region Server

balance_switch

Enables/disables the cluster Balancer

balancer_enabled

Checks the Balancer state

balancer

Triggers the cluster Balancer

catalogjanitor_switch

Enables/disables the CatalogJanitor

catalogjanitor_enabled

Checks the CatalogJanitor state

catalogjanitor_run

Runs the CatalogJanitor

cleaner_chore_switch

Enables/disables the Cleaner chore

cleaner_chore_enabled

Checks the Cleaner chore state

cleaner_chore_run

Runs the Cleaner chore

normalizer_switch

Enables/disables the Region Normalizer

normalizer_enabled

Checks the Region Normalizer state

normalize

Runs the Region Normalizer

is_in_maintenance_mode

Checks whether the Master is in maintenance mode

zk_dump

Shows the dump status of the HBase cluster, as seen by ZooKeeper

trace

Starts/stops/checks tracing via HTrace

Replication commands

These commands are used for configuring replication.

Command Description

add_peer

Adds a replication relationship (peer)

append_peer_namespaces

Appends replicable namespaces to the replication peer

append_peer_tableCFs

Appends replicable tables/column families to the replication peer

set_peer_namespaces

Sets all replicable namespaces for the replication peer

set_peer_tableCFs

Sets all replicable tables/column families for the replication peer

set_peer_bandwidth

Sets the source bandwidth for the replication peer (per Region Server)

set_peer_replicate_all

Sets the REPLICATE_ALL flag for the replication peer

set_peer_exclude_namespaces

Sets not replicable namespaces for the replication peer

set_peer_exclude_tableCFs

Sets not replicable tables/column families for the replication peer

disable_table_replication

Disables replication for all column families of the table

enable_table_replication

Enables replication for all column families of the table

disable_peer

Disables a replication peer

enable_peer

Enables the previously disabled replication peer

get_peer_config

Lists configuration parameters of the replication peer

update_peer_config

Updates configuration parameters of the replication peer

list_peer_configs

Lists configuration parameters of all replication peers

list_peers

Lists all replication peers

list_replicated_tables

Lists all tables and column families replicated from the cluster

show_peer_tableCFs

Shows replicable tables/column families for the replication peer

remove_peer_namespaces

Removes namespaces from the replication peer configuration

remove_peer_tableCFs

Removes tables/column families from the replication peer configuration

remove_peer

Disables and removes a replication peer

Snapshots commands

These commands allow users to work with table snapshots.

Command Description

snapshot

Takes a snapshot of the specified table

list_snapshots

Returns a list of snapshots — all or matching the given regex

list_table_snapshots

Returns snapshots of the specified table

restore_snapshot

Restores the specified snapshot

clone_snapshot

Creates a new table by cloning the specified snapshot

delete_snapshot

Deletes a snapshot with the specified name

delete_all_snapshot

Deletes all snapshots with the name matching the given regex

delete_table_snapshots

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

update_all_config

Reloads a subset of configuration parameters on all cluster servers

update_config

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.

Configuration
<property>
   <name>hbase.quota.enabled</name>
   <value>true</value>
</property>
Command Description

set_quota

Sets a new quota for the defined user/table/namespace

list_quotas

Returns quotas added to HBase — all or matching the given regex

list_quota_table_sizes

Returns the computed size of each table in the cluster

list_quota_snapshots

Returns information about tables with defined space quotas

list_snapshot_sizes

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.

Configuration
<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

grant

Grants a user the specific rights

list_security_capabilities

Returns supported security capabilities

revoke

Revokes a user access rights

user_permission

Returns permissions for the specified user

Procedures commands

These commands are used to work with HBase procedures.

Command Description

list_procedures

Returns all the procedures in HBase

abort_procedure

Aborts running of the procedure with the specified ID

list_locks

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.

Configuration
<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

add_labels

Adds a set of visibility labels

list_labels

Returns a list of available visibility labels

set_auths

Assigns a set of visibility labels to the defined user or group

get_auths

Gets visibility labels assigned to the defined user or group

clear_auths

Clears visibility labels assigned to the defined user or group

set_visibility

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.

Configuration
<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

add_rsgroup

Creates a new Region Server group

list_rsgroups

Returns all Region Server groups

move_servers_rsgroup

Assigns the given servers to the specified Region Server group

move_tables_rsgroup

Assigns the given tables to the specified Region Server group

move_servers_tables_rsgroup

Assigns the given servers and tables to the specified Region Server group

move_namespaces_rsgroup

Assigns the given namespaces to the specified Region Server group

move_servers_namespaces_rsgroup

Assigns the given servers and namespaces to the specified Region Server group

balance_rsgroup

Balances a Region Server group

get_rsgroup

Gets the Region Server group information

get_server_rsgroup

Gets a name of the group, which the given Region Server is a member of

get_table_rsgroup

Gets a name of the group, which the given table is a member of

remove_servers_rsgroup

Removes decommissioned servers from the Region Server group

remove_rsgroup

Removes the Region Server group

Found a mistake? Seleсt text and press Ctrl+Enter to report it