Search code examples
hbase

HBase REST API - Data Issue, Browser Issue, Doesn't seem to work


​I am running through some issues related to HBase REST API.

Let me give you a little background first: I built an HBase table in my company's CDH cluster. The row key is "|" . column family is "d" and the column qualifier is the date which is also string (e.g., 2012-01-27). In order to provide access to the table data to other interested people in the company, I built a Django API and it works great. Somebody in my team suggested that Hbase comes with a built-in API and I could use it directly to get access to the data. I read the online HBase documentation and indeed looks like there is something already off-the-shelf that comes with HBase. But I haven't been successful using it and therefore I am here seeking for help.

Here is a list of issues that I am running through:

  1. Chrome Browser In the Chrome browser, I typed in the following url: http://< ip address>:20550/namespace:tablename/ #00003|313001098/d I was expecting that it will render the data specific to the provided row key in the browser, but instead it downloads an html file that contains data for only one column qualifier and it doesn't have any information on which column qualifier the data pertains to.

  2. Curl I did the same with curl command in unix shell. curl -i http://< ip address>:20550/namespace:tablename/%2300003%7C313001098/d Please note that %23 is an encoding for # and %7C is an encoding for | (pipe). The above command only gives me the data for one column qualifier.

I double checked my data using HBase shell using the following command:

 get 'namespace:tablename', '#00003|313001098'

and I get the data from multiple column qualifiers. Therefore, I can confirm that either I am missing something or the HBase built-in API is not built for doing the things I am trying to do.

Thanks in advance.


Solution

  • Your need to specify the exact column you want. Looks like the Rest API does not allow you to fetch more than 1 column.

    If you refer to the Table 14 at this link : - http://hbase.apache.org/book.html#_rest , you would see that following endpoints are exposed to perform a get operation using Hbase Rest API :-

    1) /table/row/column:qualifier/timestamp

    2) /table/row/column:qualifier

    3) /table/row/column:qualifier/?v=number_of_versions

    All of these require a column:qualifier

    Your query needs to be of the format :-

    http://< ip address>:20550/namespace:tablename/#00003|313001098/d:20160202