写在前面
最近使用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)\|.*$'))}