HBaseShellGet操作常用小技巧
在工作中,有时候只是想简单看下HBase表某些关键指标的值,这个时候总不能现写Java代码去查看,以下几个小技巧你可能会经常用到。
1. 某行有许多列,只想获取指定2~3列的数据
hbase> get "t1", "r1", ["f:c1", "f:c2", "f:c3"]
2. 想看某个字段多个版本的数据
hbase> get "t1", "r1", {COLUMN => "f:c1", VERSIONS => 4}
3. 想看被16进制化的中文或数字
hbase> put "t1","r1","f:c1","中国"hbase> get "t1","r1","f:c1:toString"
COLUMN CELL
f:c1 timestamp=1585635275771, value=中国
1 row(s) in 0.0180 seconds
对于Int型、Long型数值,支持toInt|toLong语法。
4. 快速获取一个列族下的所有列
使用列族过滤器:1. 精确匹配列族
hbase> get "t1,"r1",FILTER=>"FamilyFilter(=,"binary:f")"
2. 模糊匹配列族
hbase> get "t1,"r1",FILTER=>"FamilyFilter(=,"substring:f")"
5. 根据列名前缀获取数据
hbase> get "t1","r1",FILTER=>"ColumnPrefixFilter("c")"
不常用的语法不再论述。
转载请注明出处!
以上是 HBaseShellGet操作常用小技巧 的全部内容, 来源链接: utcz.com/z/532990.html