转载

HBase Rest客户端使用

REST Server默认监听8080端口,如果8080端口被占用,可以修改HBase的hbase-site.xml文件,添加下列属性:

<property>         <name>hbase.rest.port</name>         <value>8090</value>  </property>

启动rest server

bin/hbase-daemon.sh start rest

查看server是否正常

curl http://192.168.56.100:8080/version

实例查询

http://192.168.56.100:8080/xyz/rk1

返回json格式:

curl -H "Accept: application/json" http://192.168.56.100:8080/xyz/rk1

返回xml格式:

curl http://192.168.56.100:8080/xyz/rk1

Protocol Buffer (application/x-protobuf):

 curl -H "Accept: application/x-protobuf" http://192.168.56.100:8080/xyz/rk1 | hexdump -C

Raw binary (application/octet-stream): (一次request只能对一个column)

curl -H "Accept: application/octet-stream" http://192.168.56.100:8080/xyz/rk1/cf1:name
原文  http://www.adintellig.com/hbase-rest-client/
正文到此结束
Loading...