Site icon Spark By {Examples}

HBase Disable and Enable Table with Examples

This tutorial describes how to disable and enable existing table using the HBase shell and will practice with some examples.

Disabling Table using HBase Shell

Use ‘disable‘ to disable a table. Prior to delete a table or change its setting, first, you need to disable the table.The syntax to disable the table is as follows.

Syntax: disable ‘<namespace>:<table_name>’

Examples:

This disables the table ’emp’.

hbase disable table command

In the next section, let’s see how to check status of the table.

Checking Disabled Table

Use is_disabled to check if the table is disabled. When it disabled it returns ‘true

hbase disable table command

 Let’s check if the table disabled by using describe

hbase disable table command

Once the table is disabled, you can not perform regular manipulation commands. for example running a scan on the disable table results below error.

hbase disable table command

Enabling Table using HBase Shell

Use ‘enalbe‘ to enable a disabled table. You need to enable a disabled table first to perform any regular commands., The syntax to enable the table is as follows.

Syntax: enable ‘<namespace>:<table_name>’

Examples:

This enables a table ’emp’ which was disabled in the previous section.

hbase enable table command

Now, let’s confirmed by running describe. try yourself by running a scan on this table to confirm.

hbase enable table command

Next, Let’s learn how to truncate and delete a table.

Exit mobile version