How to add new column family to an existing HBase table?
Asked Answered
S

3

20

I created a table by

create 'tablename', 'columnfamily1'

Now is it possible to add another column family 'columnfamily2'? What is the method?

Sihon answered 27/3, 2015 at 0:29 Comment(1)
Take a look of this: hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/…Taishataisho
S
39

It seems

alter 'tablename', 'columnfamily2'

does the trick. One may, disable 'tablename' first. However, it works fine even if enabled.

hbase(main):015:0> alter 'tablename', {NAME=> 'columnfamily2'}
Updating all regions with the new schema...
0/1 regions updated.
1/1 regions updated.
Done.
Sihon answered 27/3, 2015 at 0:45 Comment(1)
Disabling & Enabling the table is required if "base.online.schema.update.enable" not set to "true"Underact
P
9
alter 'tablename', NAME => 'newcolumnfamily', VERSIONS => 50

you can specify various properties of the new column family separated by a comma (,)

Poon answered 19/9, 2015 at 11:7 Comment(0)
B
1

If you consider some GUI solutions than you can easily do it with HAdmin. Simply press the "+" button in the "Alter table" page and add your new column family with all settings you need. enter image description here

Bremerhaven answered 25/2, 2019 at 8:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.