HBase REST API

Source: Internet
Author: User


-- 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  "c2t1xzi="  | 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 -v-- jruby script --alter  ' test1 ', name =>  ' CF ',  METHOD =>  ' delete ' alter  ' test1 ',  ' delete '  =>  ' CF ' alter  ' test1 ',  NAME =>  ' CF ' put  ' test1 ',  ' user1 ',  ' cf:1399999999 ',  ' \x00\x00\x00\x09 ' put  ' test1 ',  ' user1 ',  ' cf:1400000000 ',  "\x00\x00\x00\x08," put  ' test1 ',,  ' user1 ',   ' cf:1400000001 ',  "\x00\x00\x00\x07" put  ' test1 ',  ' user1 ',  ' cf:1400000002 ',  ' \x00 \X00\X20\XFB ' put  ' test1 ',  ' user2 ',  ' cf:1500000000 ',  "\x00\x00\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 $data Curl-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= ' <?xml version= "1.0" encoding= "UTF-8" standalone= "yes"? ><cellset><row key= "' $key _enc '" ><cell column= "' $cq _enc ' > ' $value _enc ' </Cell></Row></CellSet> ' echo $xmlcurl-h ' Content-type:text/xml "--data" $xml "http://itr-hbasetest01.zalando:20550/$table/$key-V


This article is from the "thick, thin hair, ax" blog, please be sure to keep this source http://tianxingzhe.blog.51cto.com/3390077/1717615

HBase REST API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.