2

In the HBase shell, it's possible to delete a column family using:

alter 'tablename', NAME => 'familyname', METHOD => 'delete'

It's also possible to create a new column family using:

alter 'tablename', NAME => 'newfamilyname'

So it's possible to delete a column family and create a new one, but if I have existing data, deleting the column family deletes the data within that family as well.

How do I rename an HBase column family in an existing table without losing the existing data?

Alfredo Gimenez
  • 2,174
  • 1
  • 14
  • 19
  • 2
    You can check my answer to same question here : http://stackoverflow.com/questions/35024620/how-to-change-the-name-of-column-family-in-the-hbase-table/35030749#35030749 – halil Feb 16 '16 at 07:49
  • Thanks, I searched for duplicate questions but never came across that one. It's really strange there is no 'rename' method for the `alter` command. Can you possibly elaborate on the method using remote coprocessors? – Alfredo Gimenez Feb 16 '16 at 17:28
  • if there were an alter command, it would do unexpected performance damages to live systems if user don't know how it works behind the scenes. It did not think in detail, not sure how to do it with coprocessors. If your table is small, just do it with java api. – halil Feb 17 '16 at 07:02
  • Yea that makes sense. It's unfortunately too big for the Java API but we have Spark running too, so I'll try to go that route. Thanks! – Alfredo Gimenez Feb 17 '16 at 18:19

0 Answers0