hbaseRESTAPI-创新互联
-- rest api --
http://wiki.apache.org/hadoop/Hbase/Stargate
curl -H "Accept: text/xml" http://itr-hbasetest01:20550/version -v
curl -H "Accept: text/xml" http://itr-hbasetest01:20550/version/cluster -v
curl -H "Accept: application/json" http://itr-hbasetest01:20550/status/cluster | python -mjson.tool
curl -X PUT -H "Content-Type: application/json" http://itr-hbasetest01:20550/tbl_rest/schema -d '{"ColumnSchema":[{"name":"cf"}]}' -v
curl -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 789
curl -H "Accept: application/json" http://itr-hbasetest01:20550/tbl_rest/sku_2 | python -mjson.tool
echo -n "c2t1XzI=" | base64 -d
echo -n "Nzg5" | base64 -d
curl -H "Accept: application/octet-stream" http://itr-hbasetest01:20550/tbl_rest/sku2/cf:test1
curl -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脚本

hbase_put_rest_json.sh
table=$1
cf=$2
column=$3
key=$4
value=$5
cq_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 -vhbase_put_rest_xml.sh
table=$1 cf=$2 column=$3 key=$4 value=$5 cq_enc=`echo -ne $cf:$column | base64` key_enc=`echo -ne $key | base64` value_enc=`echo -ne $value | base64` xml='' echo $xml curl -H "Content-Type: text/xml" --data "$xml" http://itr-hbasetest01.zalando:20550/$table/$key -v |
'$value_enc' |
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
网站标题:hbaseRESTAPI-创新互联
链接URL:http://www.jxjierui.cn/article/edsph.html


咨询
建站咨询
