问题描述:

I have data format

timestame (long), useid (long) ,value(String)

I want to put data to Hbase.And i have to scan this table daily.So i intent to set rowkey is timestame.

If i want to scan in date 1 and date 2 , i will scan rowkey r > date 1 and rowkey r < date2.

But rowkey is increased steadily (ex:1352029502000, 1352029502001 , 1352029502003 ... ) that insert is very slow.

What is the best hbase table schema in this case ?

Thanks.

网友答案:

The common way to avoid a hot-spot when handling timestamp or other monotonously increasing keys is to add some prefix before it (see for example OpenTSDB schema.

you can also add arbitrary key (say the last digit from the timestamp) and get arbitrary partitions (10 in the example).

Note, however, that when you add a prefix you have to scan all the prefixes so your reads become more complicated (but actually map-reduce will also work better)

相关阅读:
Top