learn and grow up

habse中使用shell模相关命令

字数统计: 156阅读时长: 1 min
2020/08/29 Share

写在前面

​ 最近使用hbase进行相关业务日志的存储和搜索,学到了不少新东西,所以记录下

正文

进入:hbase shell。

  • 建表语句

如:

create 'resource_data_gather:resource_complete_log',{NAME => 't', VERSIONS => 1, COMPRESSION => 'SNAPPY', BLOOMFILTER => 'ROW', DATA_BLOCK_ENCODING => 'DIFF', TTL => 'FOREVER'},***\*SPLITS => ['\x01','\x02','\x03','\x04','\x05','\x06','\x07','\x08']\****

  • 模糊scan

import org.apache.hadoop.hbase.filter.RegexStringComparator
import org.apache.hadoop.hbase.filter.CompareFilter
import org.apache.hadoop.hbase.filter.SubstringComparator
import org.apache.hadoop.hbase.filter.RowFilter
scan 'resource_data_gather:device_resource_complete_log', {FILTER => RowFilter.new(CompareFilter::CompareOp.valueOf('EQUAL'),RegexStringComparator.new('^.*pj.734852916810883072\|.*\|.*\|.*\|(548a39cd1187.1imul)\|.*$'))}

CATALOG
  1. 1. 写在前面
  2. 2. 正文