You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "Kevin Minder (JIRA)" <ji...@apache.org> on 2013/06/07 21:58:20 UTC
[jira] [Commented] (KNOX-8) Support HBase via HBase/Stargate
[ https://issues.apache.org/jira/browse/KNOX-8?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13678365#comment-13678365 ]
Kevin Minder commented on KNOX-8:
---------------------------------
The examples below illustrate the set of basic operations with HBase instance using Stargate REST API.
Use following link to get more more details about HBase/Stargate API: http://wiki.apache.org/hadoop/Hbase/Stargate.
# 1 Get software version
Set Accept Header to "text/plain", "text/xml", "application/json" or "application/x-protobuf"
% curl -i -k -u hbase:hbase-password\
-H "Accept: application/json"\
-X GET 'https://localhost:8443/gateway/sample/hbase/api/version'
# 2 Get version information regarding the HBase cluster backing the Stargate instance
Set Accept Header to "text/plain", "text/xml", "application/json" or "application/x-protobuf"
% curl -i -k -u hbase:hbase-password\
-H "Accept: text/xml"\
-X GET 'https://localhost:8443/gateway/sample/hbase/api/version/cluster'
# 3 Get detailed status on the HBase cluster backing the Stargate instance.
Set Accept Header to "text/plain", "text/xml", "application/json" or "application/x-protobuf"
% curl -i -k -u hbase:hbase-password\
-H "Accept: text/xml"\
-X GET 'https://localhost:8443/gateway/sample/hbase/api/status/cluster'
# 4 Get the list of available tables.
Set Accept Header to "text/plain", "text/xml", "application/json" or "application/x-protobuf"
% curl -i -k -u hbase:hbase-password\
-H "Accept: text/xml"\
-X GET 'https://localhost:8443/gateway/sample/hbase/api'
# 5. Create table with two column families using xml input
% curl -i -k -u hbase:hbase-password\
-H "Accept: text/xml" -H "Content-Type: text/xml"\
-d '<?xml version="1.0" encoding="UTF-8"?><TableSchema name="table1"><ColumnSchema name="family1"/><ColumnSchema name="family2"/></TableSchema>'\
-X PUT 'https://localhost:8443/gateway/sample/hbase/api/table1/schema'
# 6 Create table "table2" with column families "family3" and "family4" using JSON input
% curl -i -k -u hbase:hbase-password\
-H "Accept: application/json" -H "Content-Type: application/json"\
-d '{"name":"table2","ColumnSchema":[{"name":"family3"},{"name":"family4"}]}'\
-X PUT 'https://localhost:8443/gateway/sample/hbase/api/table2/schema'
# 7 Get table metadata
% curl -i -k -u hbase:hbase-password\
-H "Accept: text/xml"\
-X GET 'https://localhost:8443/gateway/sample/hbase/api/table1/regions'
# 8 Insert single row table
% curl -i -k -u hbase:hbase-password\
-H "Content-Type: text/xml"\
-H "Accept: text/xml"\
-d '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><CellSet><Row key="cm93MQ=="><Cell column="ZmFtaWx5MTpjb2wx" >dGVzdA==</Cell></Row></CellSet>'\
-X POST 'https://localhost:8443/gateway/sample/hbase/api/table1/row1'
# 9 Insert multiple rows into table
% curl -i -k -u hbase:hbase-password\
-H "Content-Type: text/xml"\
-H "Accept: text/xml"\
-d '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><CellSet><Row key="cm93MA=="><Cell column=" ZmFtaWx5Mzpjb2x1bW4x" >dGVzdA==</Cell></Row><Row key="cm93MQ=="><Cell column=" ZmFtaWx5NDpjb2x1bW4x" >dGVzdA==</Cell></Row></CellSet>'\
-X POST 'https://localhost:8443/gateway/sample/hbase/api/table2/false-row-key'
# 10 Get all data from table
Set Accept Header to "text/plain", "text/xml", "application/json" or "application/x-protobuf"
% curl -i -k -u hbase:hbase-password\
-H "Accept: text/xml"\
-X GET 'https://localhost:8443/gateway/sample/hbase/api/table1/*'
# 11 Execute cell or row query
Set Accept Header to "text/plain", "text/xml", "application/json" or "application/x-protobuf"
% curl -i -k -u hbase:hbase-password\
-H "Accept: text/xml"\
-X GET 'https://localhost:8443/gateway/sample/hbase/api/table1/row0/family1:col1'
# 12 Delete entire row from table
% curl -i -k -u hbase:hbase-password\
-H "Accept: text/xml"\
-X DELETE 'https://localhost:8443/gateway/sample/hbase/api/table2/row0'
# 13 Delete column family from row
% curl -i -k -u hbase:hbase-password\
-H "Accept: text/xml"\
-X DELETE 'https://localhost:8443/gateway/sample/hbase/api/table2/row0/family3'
# 14 Delete specific column from row
% curl -i -k -u hbase:hbase-password\
-H "Accept: text/xml"\
-X DELETE 'https://localhost:8443/gateway/sample/hbase/api/table2/row0/family3'
# 15 Create scanner
Scanner URL will be in Location response header
% curl -i -k -u hbase:hbase-password\
-H "Content-Type: text/xml"\
-d '<Scanner batch="1"/>'\
-X PUT https://localhost:8443/gateway/sample/hbase/api/table1/scanner
#16 Get the values of the next cells found by the scanner
% curl -i -k -u hbase:hbase-password\
-H "Accept: application/json"\
https://localhost:8443/gateway/sample/hbase/api/usertable/scanner/13705290446328cff5ed
# 17 Delete scanner
% curl -i -k -u hbase:hbase-password\
-H "Accept: text/xml"\
-X DELETE https://localhost:8443/gateway/sample/hbase/api/table1/scanner/13705290446328cff5ed
> Support HBase via HBase/Stargate
> --------------------------------
>
> Key: KNOX-8
> URL: https://issues.apache.org/jira/browse/KNOX-8
> Project: Apache Knox
> Issue Type: New Feature
> Components: Server
> Reporter: Kevin Minder
> Attachments: KNOX-8.patch
>
>
> The goal of this new feature is to allow access to HBase through the Knox gateway. The Stargate subproject of HBase appears to provide REST APIs for HBase.
> http://wiki.apache.org/hadoop/Hbase/Stargate
> We should evaluate supporting access to HBase via Stargate through Knox.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira