A script that deletes all tables in Hbase

Vlad the Impala picture Vlad the Impala · Oct 21, 2010 · Viewed 18.1k times · Source

I can tell hbase to disable and delete particular tables using:

disable 'tablename'
drop 'tablename'

But I want to delete all the tables in the database without hardcoding the names of any of the tables. Is there a way to do this? I want to do this through the command-line utility ./hbase shell, not through Java or Thrift.

Answer

eclark picture eclark · Nov 15, 2012

disable_all and drop_all have been added as commands in the HBase ruby shell. These commands were added in jira HBASE-3506 These commands take a regex of tables to disable/drop. And they will ask for confirmation before continuing. That should make droping lots of tables pretty easy and not require outside libraries or scripting.