欢迎投稿

今日深度:

Hbase Shell,

Hbase Shell,


Scan

  • 查询某个表某个列的数据:
scan 'tableName',{COLUMN=>列族:列,LIMIT=>需要查看条数}
  • 指定开始Rowkey查询 
scan 'tableName',{STARTROW=>'0693482750769917',LIMIT=>10}
  •  指定时间范围查询
 scan 'tableName', { TIMERANGE => [1303668804, 1303668904]}
  • 指定多列
 scan 'tableName', {COLUMNS => ['c1','c2'], TIMERANGE => [1303668804, 1303668904]}

 创建表

  • 创建表,snappy压缩,版本1
create 'tableName', {NAME => 'fn', VERSIONS=>1,COMPRESSION=>'snappy'}

 Count

  • INTERVAL:每10000条显示一次,CACHE 每次读取的缓存区大小,调整该参数可提高查询速度
count 'tableName',{INTERVAL=>10000,CACHE=>10000}

 清空表数据

truncate 'table_name'

删除数据

#删除rowkey为temp的记录的'info:age'字段 
delete 'member','temp','info:age' 
#删除整行 
deleteall 'member','temp'

删除表

hbase(main)> disable 't1'
hbase(main)> drop 't1'

 删除列簇

disable ‘table1’
alter ‘table1’, {NAME=>’tab1_add’, METHOD=>’delete’}
enable ‘table1’

判断表是否为‘enable’

is_enabled 'table1'

 插入

put 表名 ,rowkey,列名(列族:列名),value

Region管理 

 

  • 移动Region
# 语法:move 'encodeRegionName', 'ServerName'
 # encodeRegionName指的regioName后面的编码,ServerName指的是master-status的Region Servers列表
 # 示例
 hbase(main)>move '4343995a58be8e5bbc739af1e91cd72d', 'db-41.xxx.xxx.org,60020,1390274516739'

encodeRegionName

ServerName 

 

  • 开启/关闭Region
# 语法:balance_switch true|false
 hbase(main)> balance_switch
  • 手动Split
# 语法:split 'regionName', 'splitKey'
  •  手动触发major compaction
#语法:
 #Compact all regions in a table:
 hbase> major_compact 't1'
 #Compact an entire region:
 hbase> major_compact 'r1'
 #Compact a single column family within a region:
 hbase> major_compact 'r1', 'c1'
 #Compact a single column family within a table:
 hbase> major_compact 't1', 'c1'

 

www.htsjk.Com true http://www.htsjk.com/hbase/41967.html NewsArticle Hbase Shell, Scan 查询某个表某个列的数据: scan 'tableName',{COLUMN=列族:列,LIMIT=需要查看条数} 指定开始Rowkey查询  scan 'tableName',{STARTROW='0693482750769917',LIMIT=10}  指定时间范围查询 scan 'tab...
相关文章
    暂无相关文章
评论暂时关闭