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’.
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
‘
Let’s check if the table disabled by using describe
Once the table is disabled, you can not perform regular manipulation commands. for example running a scan
on the disable table results below error.
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.
Now, let’s confirmed by running describe. try yourself by running a scan on this table to confirm.
Next, Let’s learn how to truncate and delete a table.