Suppose that for any reason you need to clean the OpenTSDB schema. There is an easy way, you can do:
[code]
$ hbase shell
hbase(main):001:0> disable ‘tsdb’
hbase(main):002:0> disable ‘tsdb-meta’
hbase(main):003:0> disable ‘tsdb-tree’
hbase(main):004:0> disable ‘tsdb-uid’
hbase(main):005:0> drop ‘tsdb’
hbase(main):006:0> drop ‘tsdb-meta’
hbase(main):007:0> drop ‘tsdb-tree’
hbase(main):008:0> drop ‘tsdb-uid’[/code]
hbase(main):001:0> list[/code]
ls /hbase[replication, meta-region-server, rs, splitWAL, backup-masters, table-lock, flush-table-proc, region-in-transition, online-snapshot, master, running, recovering-regions, draining, namespace, hbaseid, table] ls /hbase/table[tsdb, tsdb-uid, tsdb-meta, tsdb-tree, hbase:meta] rmr /hbase/table/tsdb
rmr /hbase/table/tsdb-uid
rmr /hbase/table/tsdb-meta
rmr /hbase/table/tsdb-tree
rmr /hbase/table/hbase:meta
quit[/code]
root@hb-nodeX:/# export HBASE_HOME=/usr/lib/hbase
root@hb-nodeX:/# export JAVA_HOME=/usr/lib/jvm/java-8-oracle
root@hb-nodeX:/# /usr/share/opentsdb/tools/create_table.sh[/code]
hbase(main):001:0> disable ‘tsdb’
hbase(main):002:0> disable ‘tsdb-meta’
hbase(main):003:0> disable ‘tsdb-tree’
hbase(main):004:0> disable ‘tsdb-uid’
hbase(main):005:0> drop ‘tsdb’
hbase(main):006:0> drop ‘tsdb-meta’
hbase(main):007:0> drop ‘tsdb-tree’
hbase(main):008:0> drop ‘tsdb-uid’[/code]
Ok, no problem. Just ‘disable’ and then ‘drop’ them.
This is the common procedure in standalone Hbase, also in consistent HDFS.
But, if you can’t see the tables when you do:
hbase(main):001:0> list[/code]
And you try to create the OpenTSDB tables and it fails telling you that the tables already exists. So you can’t create the tables but also can’t disable and drop them.
In this case you must use the zookeeper client, so you will need to:
ls /hbase[replication, meta-region-server, rs, splitWAL, backup-masters, table-lock, flush-table-proc, region-in-transition, online-snapshot, master, running, recovering-regions, draining, namespace, hbaseid, table] ls /hbase/table[tsdb, tsdb-uid, tsdb-meta, tsdb-tree, hbase:meta] rmr /hbase/table/tsdb
rmr /hbase/table/tsdb-uid
rmr /hbase/table/tsdb-meta
rmr /hbase/table/tsdb-tree
rmr /hbase/table/hbase:meta
quit[/code]
And now you can create the schema again (change the commands below according your system):
[code] root@hb-nodeX:/# export COMPRESSION=LZOroot@hb-nodeX:/# export HBASE_HOME=/usr/lib/hbase
root@hb-nodeX:/# export JAVA_HOME=/usr/lib/jvm/java-8-oracle
root@hb-nodeX:/# /usr/share/opentsdb/tools/create_table.sh[/code]
And OpenTSDB will work again!!
Reference:
Killing zombie tables