Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add new column family to an existing HBase table?

Tags:

I created a table by

create 'tablename', 'columnfamily1'

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

like image 731
proutray Avatar asked Mar 27 '15 00:03

proutray


People also ask

Can we add column family to existing HBase table?

Simply press the "+" button in the "Alter table" page and add your new column family with all settings you need.

Which command is applied for adding new column family in a table along with versions for an existing table?

Alter is the command used to make changes to an existing table. Using this command, you can change the maximum number of cells of a column family, set and delete table scope operators, and delete a column family from a table.

What is column family in HBase?

An HBase table contains column families , which are the logical and physical grouping of columns. There are column qualifiers inside of a column family, which are the columns. Column families contain columns with time stamped versions. Columns only exist when they are inserted, which makes HBase a sparse database.

How many column families does HBase have?

Technically, HBase can manage more than three of four column families. However, you need to understand how column families work to make the best use of them.


2 Answers

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.
like image 62
proutray Avatar answered Sep 20 '22 09:09

proutray


alter 'tablename', NAME => 'newcolumnfamily', VERSIONS => 50

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

like image 37
nikoo28 Avatar answered Sep 19 '22 09:09

nikoo28