Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

HBase - alter table - add pre-splits

avatar
Champion Alumni

Hello,

 

I would like to change my HBase table and add some splits for the keys that don't exists yet.

 

I tried the folowings without success :

split 'table_name', 'key_that_dont_exists_yet'
alter 'table_name', {SPLITS=>['my_new_split1','my_new_split2']}

However, I have the felling that is not working. When I check the splits, I have the same splits as before in the browser and when I do a

hdfs dfs -ls /hbase/data/default/table_name

I also have no additional folders...

 

 

Note: I'm using CDH 5.3

 

 

Thank you!

 

 

 

 

GHERMAN Alina
1 ACCEPTED SOLUTION

avatar
Champion Alumni

What's strange is that it worked when I did

 

cat file_with_all_split_cmmands|hbase shell

...

 

 

Alina

GHERMAN Alina

View solution in original post

3 REPLIES 3

avatar
Champion Alumni

What's strange is that it worked when I did

 

cat file_with_all_split_cmmands|hbase shell

...

 

 

Alina

GHERMAN Alina

avatar
Super Collaborator

Hi,

 

I'm using CDH 5.5.2. So my version of HBase is not the same.

I did try the | thing into the hbase shell command.

 

I'm trying to "pre-split" an existing empty table. But the following command seems to not be correct for this version of HBase :

alter '<namespace>:<table_name>',{ SPLITS => ['value1','value2'] }

 

I get the following message, so I guess the "SPLITS" part is not taken into account  :

Unknown argument ignored: SPLITS
Updating all regions with the new schema...
1/2 regions updated.
2/2 regions updated.
Done.
0 row(s) in 2.4780 seconds

 

Does someone knows the syntax for pre-splitting and already existing table (empty table) ?

For CDH 5.5.2, it use HBase 1.0.0 I think.

 

 

avatar
Super Collaborator

After some more testing I found that the following command is working:

split '<namespace>:<table_name>', 'NEW_SPLIT_VALUE'

 

I just need to call it once per "pre-split" value I need.