Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing JSON in HBase and query by Id

Tags:

hbase

Am I correct of storing JSON data in HBase?

 put 'messages', 123, 'cf:json', '{"foo":"bar"}'

Basically, I need to query it by ID, which is 123 in my example. And JSON is variable length string.

like image 592
Roman Newaza Avatar asked Jan 18 '23 07:01

Roman Newaza


1 Answers

There's no problem storing JSON in a cell value. Cell sizes of up to 5M are still reasonable. Generally speaking though it is recommended to keep key and column sizes small (http://hbase.apache.org/book.html#keysize) and JSON, while being more compact than XML, is still a wasteful format (vs. binary JSON, Thrift, Avro, MessagePack etc.). if you stay with JSON you might need to consider making the column family compressed

like image 185
Arnon Rotem-Gal-Oz Avatar answered Feb 27 '23 18:02

Arnon Rotem-Gal-Oz