hbase查询

  get获取数据: 

//从 table_test 表中查 rowkey 为 rk01 的所有列簇的所有数据
get 'table_test','rk01    

//从 table_test 表中查 rowkey 为 rk01 的列为 cf1:name 的最新数据           
get 'table_test','rk01','cf1:name'   

//从 table_test 表中查 rowkey 为 rk01 的列为 cf1:name 的所有版本数据,3 个版本
get 'table_test','rk01',{COLUMNS => 'cf1:name', VERSIONS => 3}     

 scan查看某表的数据:                     

scan 'table_test'
scan 'table_test',{COLUMNS => 'cf1:name'}
scan 'table_test',{COLUMNS => 'cf1:name', TIMESTAMP => 1482018424571}                 
scan 'table_test',{LIMIT=>10,REVERSED => true }  查询最新的10条数据

scan 'user', {COLUMNS => 'info:name', VERSIONS => 5}

//查询 user 表中列族为 info 和 data 且列标示符中含有 a 字符的信息
scan 'user', {COLUMNS => ['info', 'data'], FILTER => "(QualifierFilter(=,'substring:a'))"}      
//查询 user 表中列族为 info, rk 范围是[rk0001, rk0003)的数据
scan 'people', {COLUMNS => 'info', STARTROW => 'rk0001', ENDROW => 'rk0003'}          
      
//查询 user 表中 row key 以 rk 字符开头的
scan 'user',{FILTER=>"PrefixFilter('rk')"} 
                                             
//查询 user 表中指定范围的数据
scan 'user', {TIMERANGE => [1392368783980, 1392380169184]}      

get和scan查看表中数据的区别:

        get:指定rowkey获取数据

        scan:指定条件获取一批数据

猜你喜欢

转载自blog.csdn.net/qq_24166417/article/details/106350921
今日推荐