简体   繁体   English

如何在HBase中存储和查询范围数据?

[英]How to store and query range data in HBase?

Presently, I am storing Ip mapping data in Solr and it's somewhat like this: 目前,我在Solr中存储Ip映射数据,它有点像这样:

Ip-From
Ip-To
Country

This forms a single record (document.) When I get a IP as an input, I query Solr to find out the region (country) that it belongs to. 这形成了一个记录(文档。)当我获得一个IP作为输入时,我查询Solr以找出它所属的区域(国家)。 The query is straight forward - ip >= ipFrom and ip <= ipTo. 查询是直截了当的 - ip> = ipFrom和ip <= ipTo。 The response time is pretty low (good) but still does not meet our requirement. 响应时间非常短(好),但仍不符合我们的要求。 Cannot cache this data in memory as it's very huge. 无法将此数据缓存在内存中,因为它非常庞大。

Hence, I was thinking of using some other storage for this type of data. 因此,我在考虑为这类数据使用其他存储空间。 Is HBase suitable, and if yes, what would be the ideal way of storing and querying such type of data? HBase是否合适,如果是,那么存储和查询此类数据的理想方式是什么?

My understanding : you want to pass Ip (either from or to) and you want to lookup country or region specific to that. 我的理解:你想传递Ip(来自或来自),你想查找特定于那个的国家或地区。

Yes. 是。 You an store data in Hbase and query with filters if you want to use Hbase as only data store. 如果要将Hbase用作数据存储,则在Hbase中存储数据并使用过滤器进行查询。

In my experience, Solr search is faster than Hbase and can use NRT or Batch indexer(in case you are using CDH) or some other tool to index Hbase data. 根据我的经验,Solr搜索比Hbase快,可以使用NRT或Batch索引器(如果您使用的是CDH)或其他工具来索引Hbase数据。

Further more, Whitefret raised the concern(which sounds logical to me). 此外, 怀特菲雷特提出了这个问题(这听起来对我来说很合乎逻辑)。 along with ipfrom , ipto and country , if you storing anything else in solr then hbase can work for you . ipfromiptocountry一起 ,如果你在solr中存储任何其他内容,那么hbase可以为你工作。 otherwise there is no need for intermediate storage like Hbase and you need to revisit your solr configuration. 否则不需要像Hbase那样的中间存储,你需要重新访问你的solr配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM