代码拉取完成,页面将自动刷新
注意的事项 windows 下使用需要先装 hadoop 的环境变量 windows 下的导入导出orc Parquet需要删除 hadoop目录下的 hadoop.dll
mvn clean install package -Dmaven.test.skip=true
<artifactId>hbase-common</artifactId>
<groupId>paas.storage</groupId>
<version>1.0.0</version>
之后生成在 ./hbase-common/target/hbase-common.jar
配置使用扩展参数传递 参考 IConnectionTest 类 expendParams参数
IConnectionTest 创建连接
ITableTest 操作表
IDataTest 操作数据
IManagementTest 测试导入导出 需要把exportfile下文件放d盘
每个类里面有个all方法 执行就可以了
打包text模块
外部配置文件
jar包目录下放置test.json
jar包同目录 放置 text.csv
运行jar 输入日志到目录
nohup java -jar hbase-test.jar >log.log & 启动
测试截图
创建表参数
5.2.2.1创建表参数,database=database,table=test1,columnFamilyList=[{
"Name": "user1",
"Version": 5,
"Compression": "SNAPPY",
"TimeToLive": 5184000,
"BlockCache": "True"
}, {
"Name": "userhouse1",
"Version": 5,
"Compression": "SNAPPY",
"TimeToLive": 5184000,
"BlockCache": "True"
}
],numRegions2,splitMethodHexStringSplit,regionReplicatio1
5.2.2.1创建表返回结果,"TableCreateResponse(super=Response(super=paas.storage.result.TableCreateResponse@6924e1a, taskStatus=1, errorCode=0, errorMsg=null), table=test1)"
5.2.2.2删除创建的表参数,参数database=database,table=test1
5.2.2.2删除表结果,{}TableDeleteResponse(super=Response(super=paas.storage.result.TableDeleteResponse@6924e39, taskStatus=1, errorCode=0, errorMsg=null), tableList=[test1])
5.2.2.3修改表参数,database=database,table=test1,columnFamilyList=[{
"Name": "user",
"Version": 3,
"Compression": "SNAPPY",
"TimeToLive": 5184000,
"BlockCache": "True"
}, {
"Name": "userhouse",
"Version": 3,
"Compression": "SNAPPY",
"TimeToLive": 4184000,
"BlockCache": "True"
}
],numRegions2,splitMethodHexStringSplit,regionReplicatio1
5.2.2.3更新表结果,TableUpdateResponse(super=Response(super=paas.storage.result.TableUpdateResponse@6924e1a, taskStatus=1, errorCode=0, errorMsg=null), table=test1)
idea测试
####hbaseweb控制台
5.2.2.4获取数据库下所有表列表参数,database = database,table=
5.2.2.4返回数据库下所有表列表,TableListResponse(super=Response(super=paas.storage.result.TableListResponse@26022b7a, taskStatus=1, errorCode=0, errorMsg=null), tableList=[database:test1])
5.2.2.4根据表名正则获取匹配表参数,database = database,table=test[0-9]*
5.2.2.4根据表名正则获取所有表列表,TableListResponse(super=Response(super=paas.storage.result.TableListResponse@26022b7a, taskStatus=1, errorCode=0, errorMsg=null), tableList=[database:test1])
5.2.2.5获取表信息参数,database = database,table=test1
5.2.2.4获取表信息返回结果,TableQueryResponse(tableInfo=[{"database:test1":[{"BlockCache":true,"Compression":"snappy","Name":"database:test1","TimeToLive":2147483647,"Version":3},{"$ref":"$[0].database:test1[0]"}]}])
判断表是否存在参数,database = database,table=test
判断表是否存在,TableExistResponse(super=Response(super=paas.storage.result.TableExistResponse@3b, taskStatus=1, errorCode=0, errorMsg=null), result=0)
这个地方的列簇参数 不是正确的json 沟通后改成正确的json格式
与数据修改接口字段保持一致
正确格式[{"row_key":value, "columnfamily":value, "column":value, "value":value_new}]
5.2.3.1数据插入参数,ca13c291-801a-481c-bd7e-7afd23fa2d89,database,test1,[{
"row_key": "1",
"columnfamily": "user: username ",
"value": "用户11"
},
{
"row_key": "2",
"columnfamily": "user: username ",
"value": "用户22"
},
{
"row_key": "3",
"columnfamily": "user: username ",
"value": "用户33"
},
{
"row_key": "4",
"columnfamily": "user: age ",
"value": "20"
},
{
"row_key": "5",
"columnfamily": "user: age ",
"value": "30"
},
{
"row_key": "6",
"columnfamily": "user: age ",
"value": "40"
},
{
"row_key": "7",
"columnfamily": "user: age ",
"value": "60"
},
{
"row_key": "1",
"columnfamily": "user: age ",
"value": "1888"
}
]
5.2.3.1插入结果,DataInsertResponse(super=Response(super=paas.storage.result.DataInsertResponse@1, taskStatus=1, errorCode=0, errorMsg=null))
5.2.3.1插入查询结果DataQueryResponse(super=Response(super=paas.storage.result.DataQueryResponse@4d4ec202, taskStatus=1, errorCode=0, errorMsg=null), result=[{"column":" age ","columnfamily":"user","row_key":"1","value":"1888","version":"1614322464309"},{"column":" username ","columnfamily":"user","row_key":"1","value":"用户11","version":"1614322464309"},{"column":" username ","columnfamily":"user","row_key":"2","value":"用户22","version":"1614322464309"},{"column":" username ","columnfamily":"user","row_key":"3","value":"用户33","version":"1614322464309"},{"column":" age ","columnfamily":"user","row_key":"4","value":"20","version":"1614322464309"},{"column":" age ","columnfamily":"user","row_key":"5","value":"30","version":"1614322464309"},{"column":" age ","columnfamily":"user","row_key":"6","value":"40","version":"1614322464309"},{"column":" age ","columnfamily":"user","row_key":"7","value":"60","version":"1614322464309"}]),
5.2.3.2删除数据参数ca13c291-801a-481c-bd7e-7afd23fa2d89,database,test1,1,["user:username"],,
5.2.3.2删除结果Response(super=paas.storage.result.Response@33007, taskStatus=1, errorCode=0, errorMsg=null),
5.2.3.2删除查询结果DataQueryResponse(super=Response(super=paas.storage.result.DataQueryResponse@79e3c17c, taskStatus=1, errorCode=0, errorMsg=null), result=[{"column":"username","columnfamily":"user","row_key":"2","value":"张三","version":"1614322847853"}]),
更新数据rowkey2 的用户列=张三
5.2.3.3修改数据参数c5da89dc-1d89-4449-bbb4-543586087648,database,test1,1,[{
"version": "1614323408221",
"row_key": "2",
"columnfamily": "user",
"column": "username",
"value": "张三"
}],,
5.2.3.3修改结果Response(super=paas.storage.result.Response@33007, taskStatus=1, errorCode=0, errorMsg=null),
数据查询参数78cc5a6d-82ad-4c30-b3de-de15231126f4,database,test1,{
"MaxVersions": 2,
"TimeRange": "[1609552608000,1614326605491]",
"filter": {
"SingleColumnValueFilter": {
"family": "user",
"qualifier": "age",
"compareOp": "LESS_OR_EQUAL",
"value": "50"
}
}
},2,,,["user:age"]
查询结果"[{\"column\":\"age\",\"columnfamily\":\"user\",\"row_key\":\"4\",\"value\":\"20\",\"version\":\"1614326605126\"},{\"column\":\"age\",\"columnfamily\":\"user\",\"row_key\":\"4\",\"value\":\"20\",\"version\":\"1614326497083\"},{\"column\":\"age\",\"columnfamily\":\"user\",\"row_key\":\"5\",\"value\":\"30\",\"version\":\"1614326605126\"},{\"column\":\"age\",\"columnfamily\":\"user\",\"row_key\":\"5\",\"value\":\"30\",\"version\":\"1614326497083\"},{\"column\":\"age\",\"columnfamily\":\"user\",\"row_key\":\"6\",\"value\":\"40\",\"version\":\"1614326605126\"},{\"column\":\"age\",\"columnfamily\":\"user\",\"row_key\":\"6\",\"value\":\"40\",\"version\":\"1614326497083\"}]",
根据rowkey查询数据参数78cc5a6d-82ad-4c30-b3de-de15231126f4,database,test1,2,,,
返回结果["DataQueryVo(row_key=2, columnfamily=user, column= username , value=用户22, info=null, version=1614325259848)","DataQueryVo(row_key=2, columnfamily=user, column=username, value=张三, info=null, version=1614326605197)"]
根据范围查询多过滤器参数faab3953-bc75-4a3d-8635-bd723d69a71a,database,test1, {
"SingleColumnValueFilter": {
"family": "user",
"qualifier": "age",
"compareOp": "GREATER_OR_EQUAL",
"value": "30"
},
"FamilyFilter": {
"familyCompareOp": "EQUAL",
"familyComparator": "user"
}
},
从hbase 导入到hadoop
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。