在HBase中存储JSON并通过Id查询

发布于 2024-12-14 18:56:06 字数 156 浏览 1 评论 0原文

我在 HBase 中存储 JSON 数据正确吗?

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

基本上,我需要通过ID来查询它,在我的例子中是123。而 JSON 是变长字符串。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别忘他 2024-12-21 18:56:08

将 JSON 存储在单元格值中没有问题。单元大小高达 5M 仍然是合理的。一般来说,虽然建议保持键和列的大小较小(http://hbase.apache.org/book.html#keysize),而 JSON 虽然比 XML 更紧凑,但仍然是一种浪费的格式(与二进制 JSON 相比) 、Thrift、Avro、MessagePack 等)。如果您继续使用 JSON,您可能需要考虑压缩列族

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文