rest - 如果行键是反向 URL,如何查找 HBase REST API (Stargate)

标签 rest hadoop hbase nutch stargate

我正在使用nutch2.2.1 + hbase0.90.4,并希望通过HBase REST API Stargate访问数据。如果我使用 url(例如 www.usatoday.com)播种 nutch,则反转的 url 将成为指定表(“网页”)中的 HBase 行键。我可以通过 hbase shell 查找数据,如下所示:

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' 之前的冒号,这给我带来了麻烦?

例如,当我尝试时,我收到 HTTP 404

curl http://localhost:8900/webpage/com.usatoday.www:http/

当我尝试时

curl http://localhost:8900/webpage/com.usatoday.www%3Ahttp/

我知道 REST API 工作正常,因为我可以在名为“test”的表中创建名为“row3”的行并进行查找

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>

感谢您的帮助!

最佳答案

还需要对正斜杠进行 URL 编码。以下作品。

curl http://localhost:8900/webpage/com.usatoday.www%3Ahttp%2F

关于rest - 如果行键是反向 URL,如何查找 HBase REST API (Stargate),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24734045/

相关文章:

java - 使用分布式缓存的新 api 的问题

java - 方言错误消息流口水

javascript - 我可以使用javascript调用delphi xe8 REST服务post吗?

java - 在Hadoop提取期间Druid空间维度加载数据错误

python - 8,000,000 条记录的高效内存存储 (Python)

hadoop - 基于部分HBase行创建RDD

hadoop - nutch查看存储在hbase中的hbase数据的方法

node.js - NodeJS 中的 HTTPS 请求

java - 在 Jersey 中显示图像 ExceptionMapper

hadoop - Hive 时间戳格式