[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
进入hbase shell查询一个表的数据量时比较耗时且容易刷屏,使用hbase自带的工具可以直接查询
hbase org.apache.hadoop.hbase.mapreduce.RowCounter 'namespace名:表名'
hdfs数据导入hbase
hbase org.apache.hadoop.hbase.mapreduce.ImportTsv -Dimporttsv.separator=','
-Dimporttsv.columns=字段列表 namespace名:表名 hdfs路径
-Dimporttsv.separator是指定分割符,逗号时一般上传csv文件会比较好
-Dimporttsv.columns 后面跟字段列表,要写成 列簇名:列名,列簇名:列名,列簇名:列名.....的形式
其中要做主键的位置对应写为:HBASE_ROW_KEY
hbase根据时间戳查找数据
scan 'namespace名:表名', {COLUMN => '列簇:列', TIMERANGE => [开始时间戳,结束时间戳]}
Hbase倒叙查询记录
scan 'namespace名:列名',{REVERSED => TRUE}
hbase删除表
disable 表名(删除之前需要先禁用表)
drop 表名
hbase权限操作
读取(R) - 可以读取给定范围的数据。
写入(W) - 可以在给定范围写入数据。
执行(X) - 可以在给定范围内执行协处理器端点。
创建(C) - 可以在给定范围内创建表或删除表(甚至不创建它们)。
管理员(A) - 可以执行群集操作,例如在给定的范围内平衡群集或分配区域
赋予:grant 回收: revoke
例子:
给user1用户device表的读写权限
grant 'user1', 'RW', 'device'
收回user1的权限
revoke 'user1','device'