如何通过REST API获取表内容



我想知道如何通过HbaseREST API获取表内容?

示例:如果我有表"users",并且我想要所有用户,那么我将执行

scan "users" 

我如何通过RESTApi做到这一点?

我在文档中找不到http://hbase.apache.org/book.html#_rest有可能吗?

不能使用REST API直接查询整个表
首先,您需要调用具有批量大小的/table/scanner,它将返回扫描仪ID。

接下来,将扫描仪ID传递给/table/scanner/<scanner-id>端点,它每次都会返回行数(=批大小(,您调用它直到用完

curl -vi -X PUT 
-H "Accept: text/xml" 
-H "Content-Type: text/xml" 
-d '<Scanner batch="1"/>' 
"http://example.com:8000/users/scanner/"

它将在HTTP响应中返回一个LOCATION作为扫描程序端点:http://example.com:8000/users/scanner/123

然后呼叫:

curl -vi -X GET 
-H "Accept: text/xml" 
"http://example.com:8000/users/scanner/123"

它将分批返回数据。

最新更新