Search code examples
hbaseregion

HBase: How to delete region


Due to legal issues I need to delete old data from HBase.

I found a way to split the region using my criteria and by that moving the old data to the new region, but is there a way to delete that region?

any other idea how to achieve by goal?


Solution

  • Try

    delete '.META.', 'ROW_FROM_META_WITH_YOUR_TABLE'
    

    If you are not sure what the row you want to delete run a scan on the ".META." or dump its value into a file:

    echo "scan '.META.'"| hbase shell &> dump.txt
    

    then find your row and delete it.

    Since this will leave your regions with a "hole", make sure you run hbase hbck PlatformData -repair to fix those.

    Here is a small java code snippet that does just that, and deletes files from underlying HDFS.