MapR - Rest API list命令没有提供正确的输出

时间:2015-07-03 14:39:48

标签: rest hadoop mapr

MapR DB的MapR REST API看起来无法正常工作。我只是尝试列系列列表命令作为过滤器,但它没有给我正确的输出,但它完全适用于maprcli选项。这是我做的操作列表。

使用maprcli命令

maprcli table cf list -path / user / hbase / testShashi

readperm appendperm inmemory versionperm cfname writeperm compressperm memoryperm compression ttl maxversions minversions u:mapr u:mapr false u:mapr f1 u:mapr u:mapr u:mapr off 2147483647 1 0 u:mapr u:mapr false u:mapr f2 u:mapr u:mapr u:mapr off 2147483647 1 0

maprcli table cf list -path / user / hbase / testShashi -cfname f1

readperm appendperm inmemory versionperm cfname writeperm compressperm memoryperm compression ttl maxversions minversions u:mapr u:mapr false u:mapr f1 u:mapr u:mapr u:mapr off 2147483647 1 0

使用maprcli选项当我将cfname作为f1传递时,它只给我一条记录,但似乎不会发生REST API

使用REST API 在应用过滤器之前

curl -k -u mapr:mapr https://hostname:8443/rest/table/cf/list?path=/user/hbase/testShashi

enter image description here

以cfname作为选项

curl -k -u mapr:mapr https://hostname:8443/rest/table/cf/list?path=/user/hbase/testShashi&cfname=f1

enter image description here

如果我在这里犯了任何错误,请告诉我。

1 个答案:

答案 0 :(得分:0)

沙市,

我不知道你是否粘贴了确切的命令行,但是如果你这样做了,你可能需要在网址周围添加引号以便&不是由shell解释的。​​

在MapR 4.1上,这对我有用:

[mapr@ip-172-16-2-19 ~]$ curl -k -u mapr:mapr 'https://ip-172-16-2-17:8443/rest/table/cf/list?path=/tmp/mytable&cfname=cf1' | jq .
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   345  100   345    0     0   1638      0 --:--:-- --:--:-- --:--:--  1642
{
  "timestamp": 1436384780597,
  "timeofday": "2015-07-08 07:46:20.597 GMT+0000",
  "status": "OK",
  "total": 1,
  "data": [
    {
      "cfname": "cf1",
      "maxversions": 1,
      "minversions": 0,
      "ttl": 2147483647,
      "inmemory": false,
      "compression": "lz4",
      "appendperm": "u:mapr",
      "compressionperm": "u:mapr",
      "memoryperm": "u:mapr",
      "readperm": "u:mapr",
      "versionperm": "u:mapr",
      "writeperm": "u:mapr"
    }
  ]
}

但是,如果我在示例中删除引号,请查看cfname参数如何被忽略 - 这是因为当shell到达&时,它将命令放入后台,而cfname参数永远不会由服务器考虑,因为它没有到达那里;所以maprcli列出了所有的cfs:

[mapr@ip-172-16-2-19 ~]$ curl -k -u mapr:mapr https://ip-172-16-2-17:8443/rest/table/cf/list?path=/tmp/mytable&cfname=cf1 | jq .
[1] 18868
[mapr@ip-172-16-2-19 ~]$ {"timestamp":1436384975909,"timeofday":"2015-07-08 07:49:35.909 GMT+0000","status":"OK","total":2,"data":[{"cfname":"cf1","maxversions":1,"minversions":0,"ttl":2147483647,"inmemory":false,"compression":"lz4","appendperm":"u:mapr","compressionperm":"u:mapr","memoryperm":"u:mapr","readperm":"u:mapr","versionperm":"u:mapr","writeperm":"u:mapr"},{"cfname":"cf2","maxversions":1,"minversions":0,"ttl":2147483647,"inmemory":false,"compression":"lz4","appendperm":"u:mapr","compressionperm":"u:mapr","memoryperm":"u:mapr","readperm":"u:mapr","versionperm":"u:mapr","writeperm":"u:mapr"}]}