Hbase REST API
-- rest api-- http://wiki.apache.org/hadoop/Hbase/Stargatecurl-H "Accept: text/xml" http://itr-hbasetest01:20550/version-vcurl-H "Accept: text/xml" http://itr-hbasetest01:20550/version/cluster-vcurl-H "Accept: application/json" http://itr-hbasetest01:20550/status/cluster | python-mjson.toolcurl-X PUT-H "Content-Type: application/json" http://itr-hbasetest01:20550/tbl _ rest/schema-d'{"ColumnSchema": [{"name": "cf"}]}'- vcurl-H "Accept: application/json" http://itr-hbasetest01:20550/tbl_rest/regions | python-mjson.tool./hbase_put_rest_json.sh tbl_rest cf test sku_1 123./hbase_put_rest_xml.sh tbl_rest cf test1 sku_2 789curl-H "Accept: application/json" http://itr-hbasetest01:20550/tbl_rest / sku_2 | python-mjson.toolecho-n "c2t1XzII =" | base64-decho-n "Nzg5" | base64-d curl-H "Accept: application/octet-stream" http://itr-hbasetest01:20550/tbl_rest/sku2/cf:test1curl-X DELETE-H "Accept: application/json" http://itr-hbasetest01:20550/tbl_rest/schema-VMI-JRuby script-alter 'test1' NAME = > 'cf', METHOD = >' delete'alter 'test1',' delete' = > 'cf'alter' test1', NAME = > 'cf'put' test1', 'user1',' cf:1399999999', "\ x00\ x09" put 'test1',' user1', 'cf:1400000000', "\ x00\ x00\ x08" put' test1', 'user1',' cf:1400000001', "\ X00\ x00\ x07" put 'test1',' user1' " 'cf:1400000002', "\ x00\ x00\ x20\ xFB" put' test1', 'user2',' cf:1500000000', "\ x00\ x11" put 'test1',' user2', 'cf:1500000001', "\ x00\ x00\ x20\ xFC" require' / home/hduser/hbase/scan_binary_values'scan_binary_values' test1', 'cf'scan_binary_values' test1', 'lf'
Shell script
Hbase_put_rest_json.sh
Table=$1cf=$2column=$3key=$4value=$5cq_enc= `echo-ne $cf:$column | Base64`key _ enc= `echo-ne $key | Base64`value _ enc= `echo-ne $value | Base64`data ='{"Row": [{"key": "'$key_enc'", "Cell": [{"column": "'$cq_enc'" "$": "'$value_enc'"}]} 'echo $datacurl-H "Content-Type: application/json"-data "$data" http://itr-hbasetest01.zalando:20550/$table/$key-v
Hbase_put_rest_xml.sh
Table=$1cf=$2column=$3key=$4value=$5cq_enc= `echo-ne $cf:$column | Base64`key _ enc= `echo-ne $key | base64`value _ enc= `echo-ne $value | base64`xml =''$value_enc''echo $echo-H "Content-Type: text/xml"-data "$xml" echo-v