开发者

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 m开发者_运维技巧y 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?


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.


In the newer versions such as 0.96 the command is:

deleteall 'hbase:meta', 'YOUR_ROW'


Hbase rowkeys can be removed by deleting the all columnfamilies present for the table. If there is no data against a rowkey in hbase the key is removed from hbase. This can be done using the Alter command in the Hbase shell.

Though these rowkeys do not show up in the table the regions for the deleted rowkeys are present in the .META. with no data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜