1

To get data from Hbase table using rest we can use:

http://ip:port/tablename/base64_encoded_key My key is byte array of

prefix + customer_id + timestamp

byte[] rowKey = Bytes.add(Bytes.toBytes(prefix),Bytes.toBytes(customer_id),Bytes.toBytes(timestamp));

My sample key

3\x00\x00\x00\x02I9\xB1\x8B\x00\x00\x01a\x91\x88\xEFp

  1. How do I get data from Hbase using rest?
  2. How do I get data from Hbase using customer_id and time range?
kinkajou
  • 3,402
  • 21
  • 68
  • 118

1 Answers1

1

You must send an HTTP request to get your value. For example if your are an Linux you can easily try a GET request to take a single value. This example retrieves from table users row with id row1 and column a from column family f

curl -vi -X GET \
         -H "Accept: text/xml" \
         "http://example.com:20550/users/row1/cf:a"

You can see more here including how to retrieve data with timestamp

Michail N
  • 3,055
  • 2
  • 24
  • 44
  • Actually , I want to get the row based on my key which is byte array – kinkajou Feb 15 '18 at 08:16
  • You can try to change row1 with your encoded key representation in BASE64. This example uses curl which is the simplest way to send an http request. If you want to use java you can send a HTTP GET and change the value for row1 to your key encoded to BASE64. So you can take your key representation and create the appropriate URL (with concatenation) and send a GET there. Look this example to see how to send a GET request : https://stackoverflow.com/questions/1359689/how-to-send-http-request-in-java – Michail N Feb 15 '18 at 08:43