如果行键被颠倒过来,如何查找HBase REST API(Stargate) [英] How to lookup HBase REST API (Stargate) if the row-keys are reversed urls
问题描述
我正在使用nutch2.2.1 + hbase0.90.4,并希望通过 HBase访问数据REST API Stargate 。如果我使用url(例如www.usatoday.com)种子nutch,则反向链接将成为指定表('网页')中的HBase行键。我可以通过hbase shell查找数据,如下所示:
I am using nutch2.2.1 + hbase0.90.4, and wanting to access the data via the HBase REST API Stargate. If I seed nutch with a url (eg. www.usatoday.com), the reversed url becomes the HBase row-key in the designated table ('webpage'). I can lookup the data via the hbase shell as follows:
hbase(main):001:0> get 'webpage', 'com.usatoday.www:http/'
COLUMN CELL
f:fi timestamp=1404762373394,value=\x00'\x8D\x00
f:ts timestamp=1404762373394, value=\x00\x00\x01G\x12\\xB5\xB3
mk:_injmrk_ timestamp=1404762373394, value=y
mk:dist timestamp=1404762373394, value=0
mtdt:_csh_ timestamp=1404762373394, value=?\x80\x00\x00
s:s timestamp=1404762373394, value=?\x80\x00\x00
但是,我在使用REST API时遇到问题。据推测,我需要做一些非常简单的URL编码在'http'之前抑制冒号对我造成麻烦?
However, I am having trouble using the REST API. Presumably I need to do some pretty simple URL encoding to suppress the colon before 'http' that is making trouble for me?
例如,我得到一个HTTP 404我尝试
For eg., I get a HTTP 404 when I try
curl http://localhost:8900/webpage/com.usatoday.www:http/
当我尝试时
curl http://localhost:8900/webpage/com.usatoday.www%3Ahttp/
我知道REST API工作正常,因为我可以在名为'test'的表中创建一个名为'row3'的行并查找
I know that the REST API is working fine as I can create a row called 'row3' into a table called 'test' and lookup
curl http://localhost:8900/test/row3
查看以下预期结果:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><CellSet><Row key="cm93Mw=="><Cell timestamp="1404761922130" column="Y2Y6Yw==">dGhpcyBpcyBzb3J0YSB3b3JraW5nIG5vdw==</Cell></Row></CellSet>
感谢您的帮助!
Thanks for the help!
推荐答案
URL也需要编码正斜杠。以下工作。
Needed to URL encode the forward slash as well. The following works.
curl http://localhost:8900/webpage/com.usatoday.www%3Ahttp%2F
这篇关于如果行键被颠倒过来,如何查找HBase REST API(Stargate)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!