获取hbase版本
curl -vi -X GET -H "Accept: text/xml" http://10.8.4.46:20550/version/cluster
1.2.6获取集群状态:
curl -vi -X GET -H "Accept: text/xml" http://10.8.4.46:20550/status/cluster
4 live servers, 0 dead servers, 1.0000 average load4 live servers
..........获取hbase非系统表表名列表
curl -vi -X GET -H "Accept: text/xml" http://10.8.4.46:20550/
hbase_testhbase_yarnlog获取hbase所有的命名空间
curl -vi -X GET -H "Accept: text/xml" http://10.8.4.46:20550/namespaces
defaulthbase某个命名空间下表名
curl -vi -X GET -H "Accept: text/xml" http://10.8.4.46:20550/namespaces/namespace/tables
eg:curl -vi -X GET -H "Accept: text/xml" http://10.8.4.46:20550/namespaces/default/tables
hbase_testhbase_yarnlog
获取表结构:
curl -vi -X GET -H "Accept: text/xml" http://10.8.4.46:20550/hbase_yarnlog/schema
{ NAME=> 'hbase_yarnlog', IS_META => 'false', COLUMNS => [ { NAME => 'yarnlog', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => '2147483647', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true' } ] }
获取表区域:
curl -vi -X GET -H "Accept: text/xml" http://10.8.4.46:20550/hbase_yarnlog/regions
hbase_yarnlog,,1519360842078.cb06e1f05268947e9598702137918f0e. [ id=1519360842078 startKey='' endKey='' location='108443.server.bigdata.com.cn:60020']
获取单个行的所有列,编码格式是 Base-64 encoded,需要再解码
curl -vi -X GET -H "Accept: text/xml" http://10.8.4.46:20550/table/row
eg:
curl -vi -X GET -H "Accept: text/xml" http://10.8.4.46:20550/hbase_yarnlog/application_1516606659120_0211
* About to connect() to 10.8.4.46 port 20550 (#0)* Trying 10.8.4.46... connected* Connected to 10.8.4.46 (10.8.4.46) port 20550 (#0)> GET /hbase_yarnlog/application_1516606659120_0211 HTTP/1.1> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.3.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2> Host: 10.8.4.46:20550> Accept: text/xml> < HTTP/1.1 200 OKHTTP/1.1 200 OK< Content-Type: text/xmlContent-Type: text/xml< Content-Length: 4645Content-Length: 4645<
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><CellSet><Row key="YXBwbGljYXRpb25fMTUxNjYwNjY1OTEyMF8wMjEx"><Cell column="eWFybmxvZzpkdXJUaW1l" timestamp="1519717201909">NTMwMDA=</Cell><Cell column="eWFybmxvZzplcnJtc2c=" timestamp="1519717184359">PEVSUk9SPklORk86IFN0ZXAxX05vZGU4IGhGaWxlVG9IYmFzZSBUUkFDRTog5YWl5Y+CMD0iaGRmczovLzEwLjguNC43NDo4MDIwL3VzZXIvbHl5L2RhdGEvaGZpbGUiIFRSQUNFOiDlhaXlj4IxPUNvbmZpZ3VyYXRpb246IGNvcmUtZGVmYXVsdC54bWwsIGNvcmUtc2l0ZS54bWwsIHlhcm4tZGVmYXVsdC54bWwsIHlhcm4tc2l0ZS54bWwsIG1hcHJlZC1kZWZhdWx0LnhtbCwgbWFwcmVkLXNpdGUueG1sLCBoZGZzLWRlZmF1bHQueG1sLCBoZGZzLXNpdGUueG1sLCBoYmFzZS1kZWZhdWx0LnhtbCwgaGJhc2Utc2l0ZS54bWwgVFJBQ0U6IOWFpeWPgjI9ImhiYXNlX3Rlc3QiIElORk86IOmAu+i+kei/lOWbnuWAvD0xIElORk86IFN0ZXAxX05vZGUyIOato+W4uOe7k+adnyBJTkZPOiDnu5PmnZ/kuqTmmJMgPC9FUlJPUj4K</Cell><Cell column="eWFybmxvZzppZG1hcA==" timestamp="1519717194545">YXBwbGljYXRpb25fMTUxNjYwNjY1OTEyMF8wMjEyIA==</Cell><Cell column="eWFybmxvZzptYXhUaW1l" timestamp="1519717201909">MjAxOC0wMi0wOSAwOTo1Njo0Mw==</Cell><Cell column="eWFybmxvZzptaW5UaW1l" timestamp="1519717201909">MjAxOC0wMi0wOSAwOTo1NTo1MA==</Cell><Cell column="eWFybmxvZzpvb3ppZWFjdGlvbmlk" timestamp="1519717191278">MDAwMDAwOS0xODAyMDgxMjU0MjYyMjEtb296aWUtb296aS1XQHNwYXJr</Cell><Cell column="eWFybmxvZzpvb3ppZWpvYmlk" timestamp="1519717191278">MDAwMDAwOS0xODAyMDgxMjU0MjYyMjEtb296aWUtb296aS1X</Cell><Cell column="eWFybmxvZzpzcGFya3lhcm50YWdz" timestamp="1519717191278">b296aWUtY2Q4ZWE3MmE5YTdmNGFhOGVjMjhjMTRkMzRiNTdhYzA=</Cell><Cell column="eWFybmxvZzp0cmFkZWxvZw==" timestamp="1519717177817">SU5GTzogbG9nIHN0YXJ0OiBJTkZPOiDlvIDlp4vkuqTmmJMgIG9wSGJhc2U6b3BIYmFzZSBJTkZPOiBTdGVwMSBvcEhiYXNlIElORk86IFN0ZXAxX05vZGUxIOW8gOWniyBJTkZPOiBTdGVwMV9Ob2RlMyBTcGFya+WIneWni+WMliBUUkFDRTog5YWl5Y+CMD1fX1JFUV9fIERFQlVHOiDlvIDlp4vov57mjqVzcGFya+mbhue+pC4uLiAgREVCVUc6IEFwcE5hbWUgPSBudWxsIERFQlVHOiBzcGFya+mbhue+pOW3sui/nuaOpeWujOaIkCEgIElORk86IOmAu+i+kei/lOWbnuWAvD0xIFRSQUNFOiDlh7rlj4IwPW9yZy5hcGFjaGUuc3BhcmsuYXBpLmphdmEuSmF2YVNwYXJrQ29udGV4dEA3Y2E3OTU1MCBUUkFDRTog5Ye65Y+CMT1vcmcuYXBhY2hlLnNwYXJrLnNxbC5TcGFya1Nlc3Npb25AMjlmNGMzYzYgSU5GTzogU3RlcDFfTm9kZTQgaW5pdEhiYXNlIFRSQUNFOiDlhaXlj4IwPSIxMDg0NDcuc2VydmVyLmJpZ2RhdGEuY29tLmNuLDEwODQxOS5zZXJ2ZXIuYmlnZGF0YS5jb20uY24sMTA4NDE4LnNlcnZlci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aXRlLnhtbCwgaGJhc2UtZGVmYXVsdC54bWwsIGhiYXNlLXNpdGUueG1sIFRSQUNFOiDlhaXlj4IyPSJoYmFzZV90ZXN0IiBJTkZPOiDpgLvovpHov5Tlm57lgLw9MSBJTkZPOiBTdGVwMV9Ob2RlMiDmraPluLjnu5PmnZ8gSU5GTzog57uT5p2f5Lqk5piTIDwvRVJST1I+b3BIYmFzZSBJTkZPOiDohJrmnKzmiafooYzml7bpl7TvvJoxMDQ3NOavq+enkiBJTkZPOiBsb2cgZW5kOgo=</Cell></Row></CellSet>
获取单个列某个时间戳下的值。 值为Base-64编码。
curl -vi -X GET -H "Accept: text/xml" http://10.8.4.46:20550/hbase_yarnlog/application_1516606659120_0211/yarnlog:errmsg/1519717201909
* About to connect() to 10.8.4.46 port 20550 (#0)* Trying 10.8.4.46... connected* Connected to 10.8.4.46 (10.8.4.46) port 20550 (#0)> GET /hbase_yarnlog/application_1516606659120_0211/yarnlog:errmsg/1519717201909 HTTP/1.1> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.3.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2> Host: 10.8.4.46:20550> Accept: text/xml> < HTTP/1.1 200 OKHTTP/1.1 200 OK< Content-Type: text/xmlContent-Type: text/xml< Content-Length: 745Content-Length: 745<
* Connection #0 to host 10.8.4.46 left intact* Closing connection #0<?xml version="1.0" encoding="UTF-8" standalone="yes"?><CellSet><Row key="YXBwbGljYXRpb25fMTUxNjYwNjY1OTEyMF8wMjEx"><Cell column="eWFybmxvZzplcnJtc2c=" timestamp="1519717184359">PEVSUk9SPklORk86IFN0ZXAxX05vZGU4IGhGaWxlVG9IYmFzZSBUUkFDRTog5YWl5Y+CMD0iaGRmczovLzEwLjguNC43NDo4MDIwL3VzZXIvbHl5L2RhdGEvaGZpbGUiIFRSQUNFOiDlhaXlj4IxPUNvbmZpZ3VyYXRpb246IGNvcmUtZGVmYXVsdC54bWwsIGNvcmUtc2l0ZS54bWwsIHlhcm4tZGVmYXVsdC54bWwsIHlhcm4tc2l0ZS54bWwsIG1hcHJlZC1kZWZhdWx0LnhtbCwgbWFwcmVkLXNpdGUueG1sLCBoZGZzLWRlZmF1bHQueG1sLCBoZGZzLXNpdGUueG1sLCBoYmFzZS1kZWZhdWx0LnhtbCwgaGJhc2Utc2l0ZS54bWwgVFJBQ0U6IOWFpeWPgjI9ImhiYXNlX3Rlc3QiIElORk86IOmAu+i+kei/lOWbnuWAvD0xIElORk86IFN0ZXAxX05vZGUyIOato+W4uOe7k+adnyBJTkZPOiDnu5PmnZ/kuqTmmJMgPC9FUlJPUj4K</Cell></Row></CellSet>
获取单个列的值。 值为Base-64编码。
curl -vi -X GET -H "Accept: text/xml" http://10.8.4.46:20550/hbase_yarnlog/application_1516606659120_0211/yarnlog:errmsg
* About to connect() to 10.8.4.46 port 20550 (#0)* Trying 10.8.4.46... connected* Connected to 10.8.4.46 (10.8.4.46) port 20550 (#0)> GET /hbase_yarnlog/application_1516606659120_0211/yarnlog:errmsg HTTP/1.1> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.3.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2> Host: 10.8.4.46:20550> Accept: text/xml> < HTTP/1.1 200 OKHTTP/1.1 200 OK< Content-Type: text/xmlContent-Type: text/xml< Content-Length: 745Content-Length: 745<
* Connection #0 to host 10.8.4.46 left intact* Closing connection #0<?xml version="1.0" encoding="UTF-8" standalone="yes"?><CellSet><Row key="YXBwbGljYXRpb25fMTUxNjYwNjY1OTEyMF8wMjEx"><Cell column="eWFybmxvZzplcnJtc2c=" timestamp="1519717184359">PEVSUk9SPklORk86IFN0ZXAxX05vZGU4IGhGaWxlVG9IYmFzZSBUUkFDRTog5YWl5Y+CMD0iaGRmczovLzEwLjguNC43NDo4MDIwL3VzZXIvbHl5L2RhdGEvaGZpbGUiIFRSQUNFOiDlhaXlj4IxPUNvbmZpZ3VyYXRpb246IGNvcmUtZGVmYXVsdC54bWwsIGNvcmUtc2l0ZS54bWwsIHlhcm4tZGVmYXVsdC54bWwsIHlhcm4tc2l0ZS54bWwsIG1hcHJlZC1kZWZhdWx0LnhtbCwgbWFwcmVkLXNpdGUueG1sLCBoZGZzLWRlZmF1bHQueG1sLCBoZGZzLXNpdGUueG1sLCBoYmFzZS1kZWZhdWx0LnhtbCwgaGJhc2Utc2l0ZS54bWwgVFJBQ0U6IOWFpeWPgjI9ImhiYXNlX3Rlc3QiIElORk86IOmAu+i+kei/lOWbnuWAvD0xIElORk86IFN0ZXAxX05vZGUyIOato+W4uOe7k+adnyBJTkZPOiDnu5PmnZ/kuqTmmJMgPC9FUlJPUj4K</Cell></Row></CellSet>创建scanner 扫描对象,batch="100"即每批次扫描100行,值为Base-64编码
curl -vi -X PUT -H "Accept: text/xml" -H "Content-Type: text/xml" -d '<Scanner batch="100"/>' http://10.8.4.46:20550/hbase_yarnlog/scanner/
* About to connect() to 10.8.4.46 port 20550 (#0)* Trying 10.8.4.46... connected* Connected to 10.8.4.46 (10.8.4.46) port 20550 (#0)> PUT /hbase_yarnlog/scanner/ HTTP/1.1> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.3.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2> Host: 10.8.4.46:20550> Accept: text/xml> Content-Type: text/xml> Content-Length: 22> < HTTP/1.1 201 CreatedHTTP/1.1 201 Created< Location: http://10.8.4.46:20550/hbase_yarnlog/scanner/1520413092046101ffa12Location: http://10.8.4.46:20550/hbase_yarnlog/scanner/1520413092046101ffa12< Content-Length: 0Content-Length: 0<
* Connection #0 to host 10.8.4.46 left intact* Closing connection #0curl -vi -X GET -H "Accept: text/xml" http://10.8.4.46:20550/hbase_yarnlog/scanner/1520413092046101ffa12
* About to connect() to 10.8.4.46 port 20550 (#0)* Trying 10.8.4.46... connected* Connected to 10.8.4.46 (10.8.4.46) port 20550 (#0)> GET /hbase_yarnlog/scanner/1520413092046101ffa12 HTTP/1.1> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.3.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2> Host: 10.8.4.46:20550> Accept: text/xml> < HTTP/1.1 200 OKHTTP/1.1 200 OK< Cache-Control: no-cacheCache-Control: no-cache< Content-Type: text/xmlContent-Type: text/xml< Content-Length: 17834Content-Length: 17834<
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><CellSet><Row key="YXBwbGljYXRpb25fMTUxNjYwNjY1OTEyMF8wMjEx"><Cell column="eWFybmxvZzpkdXJUaW1l" timestamp="1519717201909">NTMwMDA=</Cell><Cell column="eWFybmxvZzplcnJtc2c=" timestamp="1519717184359">PEVSUk9SPklORk86IFN0ZXAxX05vZGU4IGhGaWxlVG9IYmFzZSBUUkFDRTog5YWl5Y+CMD0iaGRmczovLzEwLjguNC43NDo4MDIwL3VzZXIvbHl5L2RhdGEvaGZpbGUiIFRSQUNFOiDlhaXlj4IxPUNvbmZpZ3VyYXRpb246IGNvcmUtZGVmYXVsdC54bWwsIGNvcmUtc2l0ZS54bWwsIHlhcm4tZGVmYXVsdC54bWwsIHlhcm4tc2l0ZS54bWwsIG1hcHJlZC1kZWZhdWx0LnhtbCwgbWFwcmVkLXNpdGUueG1sLCBoZGZzLWRlZmF1bHQueG1sLCBoZGZzLXNpdGUueG1sLCBoYmFzZS1kZWZhdWx0LnhtbCwgaGJhc2Utc2l0ZS54bWwgVFJBQ0U6IOWFpeWPgjI9ImhiYXNlX3Rlc3QiIElORk86IOmAu+i+kei/lOWbnuWAvD0xIElORk86IFN0ZXAxX05vZGUyIOato+W4uOe7k+adnyBJTkZPOiDnu5PmnZ/kuqTmmJMgPC9FUlJPUj4K</Cell><Cell column="eWFybmxvZzppZG1hcA==" timestamp="1519717194545">YXBwbGljYXRpb25fMTUxNjYwNjY1OTEyMF8wMjEyIA==
删除scanner 扫描对象,释放资源
curl -vi -X DELETE -H "Accept: text/xml" http://10.8.4.46:20550/hbase_yarnlog/scanner/1520413092046101ffa12
* About to connect() to 10.8.4.46 port 20550 (#0)
* Trying 10.8.4.46... connected* Connected to 10.8.4.46 (10.8.4.46) port 20550 (#0)> DELETE /hbase_yarnlog/scanner/1520413092046101ffa12 HTTP/1.1> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.3.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2> Host: 10.8.4.46:20550> Accept: text/xml> < HTTP/1.1 200 OKHTTP/1.1 200 OK< Content-Length: 0Content-Length: 0<
* Connection #0 to host 10.8.4.46 left intact* Closing connection #0