hbase 命令总结

来源:互联网 发布:git 安装使用centos 编辑:程序博客网 时间:2024/06/16 01:34

集群状态:

   hbase> status
  hbase> status ‘simple’
 hbase> status ‘summary’ 默认
  hbase> status ‘detailed’

hbase版本

hbase> version

显示当前用户:

hbase> whoami


修改:

alter ‘t1′, NAME => ‘f1′, VERSIONS => 5

alter ‘t1′, ‘f1′, {NAME => ‘f2′, IN_MEMORY => true}, {NAME => ‘f3′, VERSIONS => 5}

 alter ‘t1′, ‘delete’ => ‘f1′

 alter ‘t1′, MAX_FILESIZE => ’134217728′

alter 't1','coprocessor'=>'hdfs:///foo.jar|com.foo.FooRegionObserver|1001|arg1=1,arg2=2'
alter 't1', CONFIGURATION => {'hbase.hregion.scan.loadColumnFamiliesOnDemand' => 'true'}
alter 't1', METHOD => 'table_att_unset', NAME => 'coprocessor$1'


alter 't1', { NAME => 'f1', VERSIONS => 3 },{ MAX_FILESIZE => '134217728' }, { METHOD => 'delete', NAME => 'f2' },OWNER => 'johndoe', METADATA => { 'mykey' => 'myvalue' }


创建:

create ‘t1′, {NAME => ‘f1′, VERSIONS => 5}
 create ‘t1′, {NAME => ‘f1′}, {NAME => ‘f2′}, {NAME => ‘f3′}
create ‘t1′, ‘f1′, ‘f2′, ‘f3′
 create ‘t1′, {NAME => ‘f1′, VERSIONS => 1, TTL => 2592000, BLOCKCACHE => true}
create ‘t1′, {NAME => ‘f1′, CONFIGURATION => {‘hbase.hstore.blockingStoreFiles’ => ’10′}}


describe ‘t1′


disable ‘t1′

 disable_all ‘t.*’


 is_disabled ‘t1′

 drop ‘t1′

drop_all ‘t.*’

enable ‘t1′

enable_all ‘t.*’

 is_enabled ‘t1′

 exists ‘t1′

list

list ‘abc.*’

how_filters

alter_status ‘t1′

 alter_async ‘t1′, NAME => ‘f1′, METHOD => ‘delete’or a shorter version:hbase> alter_async ‘t1′, ‘delete’ => ‘f1′

 alter ‘t1′, METHOD => ‘table_att’, MAX_FILESIZE => ’134217728′

alter ‘t1′, {NAME => ‘f1′}, {NAME => ‘f2′, METHOD => ‘delete’}


count:

 count ‘t1′, INTERVAL => 100000

count ‘t1′, CACHE => 1000

count ‘t1′, INTERVAL => 10, CACHE => 1000


t.count INTERVAL => 100000

 t.count CACHE => 1000

 t.count INTERVAL => 10, CACHE => 1000


delete ‘t1′, ‘r1′, ‘c1′, ts1

 deleteall ‘t1′, ‘r1′, ‘c1′

 deleteall ‘t1′, ‘r1′, ‘c1′, ts1

 t.deleteall ‘r1′, ‘c1′

 t.deleteall ‘r1′, ‘c1′, ts1


get:

get ‘t1′, ‘r1′

get ‘t1′, ‘r1′, {TIMERANGE => [ts1, ts2]}

 get ‘t1′, ‘r1′, {COLUMN => ‘c1′}

 get ‘t1′, ‘r1′, {COLUMN => ['c1', 'c2', 'c3']}

get ‘t1′, ‘r1′, {COLUMN => ‘c1′, TIMESTAMP => ts1}

get ‘t1′, ‘r1′, {COLUMN => ‘c1′, TIMERANGE => [ts1, ts2], VERSIONS => 4}

 get ‘t1′, ‘r1′, {COLUMN => ‘c1′, TIMESTAMP => ts1, VERSIONS => 4}

get ‘t1′, ‘r1′, {FILTER => “ValueFilter(=, ‘binary:abc’)”}

 get ‘t1′, ‘r1′, ‘c1′

get ‘t1′, ‘r1′, ‘c1′, ‘c2′

get ‘t1′, ‘r1′, ['c1', 'c2']


hbase> t.get ‘r1′
hbase> t.get ‘r1′, {TIMERANGE => [ts1, ts2]}
hbase> t.get ‘r1′, {COLUMN => ‘c1′}
hbase> t.get ‘r1′, {COLUMN => ['c1', 'c2', 'c3']}
hbase> t.get ‘r1′, {COLUMN => ‘c1′, TIMESTAMP => ts1}
hbase> t.get ‘r1′, {COLUMN => ‘c1′, TIMERANGE => [ts1, ts2], VERSIONS => 4}
hbase> t.get ‘r1′, {COLUMN => ‘c1′, TIMESTAMP => ts1, VERSIONS => 4}
hbase> t.get ‘r1′, {FILTER => “ValueFilter(=, ‘binary:abc’)”}
hbase> t.get ‘r1′, ‘c1′
hbase> t.get ‘r1′, ‘c1′, ‘c2′
hbase> t.get ‘r1′, ['c1', 'c2']


get_counter:

get_counter ‘t1′, ‘r1′, ‘c1′

t.get_counter ‘r1′, ‘c1′


incr:

incr ‘t1′, ‘r1′, ‘c1′

 incr ‘t1′, ‘r1′, ‘c1′, 1

 incr ‘t1′, ‘r1′, ‘c1′, 10

hbase> t.incr ‘r1′, ‘c1′, 1
hbase> t.incr ‘r1′, ‘c1′, 10


put ‘t1′, ‘r1′, ‘c1′, ‘value’, ts1

 t.put ‘r1′, ‘c1′, ‘value’, ts1


scan ‘.META.’, {COLUMNS => ‘info:regioninfo’}

 scan ‘t1′, {COLUMNS => ['c1', 'c2'], LIMIT => 10, STARTROW => ‘xyz’}

 scan ‘t1′, {COLUMNS => ‘c1′, TIMERANGE => [1303668804, 1303668904]}

scan ‘t1′, {FILTER => “(PrefixFilter (‘row2′) AND (QualifierFilter (>=, ‘binary:xyz’))) AND (TimestampsFilter ( 123, 456))”}

 scan ‘t1′, {RAW => true, VERSIONS => 10}


truncate ‘t1′


 assign ‘REGION_NAME’


 balancer


balance_switch true

 balance_switch false


close_region ‘REGIONNAME’, ‘SERVER_NAME’


 compact ‘t1′

 compact ‘r1′

 compact ‘r1′, ‘c1′

 compact ‘t1′, ‘c1′


flush ‘REGIONNAME’


major_compact ‘t1′

 major_compact ‘r1′

major_compact ‘r1′, ‘c1′

 major_compact ‘t1′, ‘c1′


move ‘ENCODED_REGIONNAME’, ‘SERVER_NAME’


split ‘tableName’
split ‘regionName’ # format: ‘tableName,startKey,id’
split ‘tableName’, ‘splitKey’
split ‘regionName’, ‘splitKey’


 unassign ‘REGIONNAME’, true


hlog_roll

zk_dump


 add_peer ’2′, “zk1,zk2,zk3:2182:/hbase-prod”

remove_peer ’1′

 list_peers

enable_peer ’1′

disable_peer ’1′


start_replication


 stop_replication


grant ‘bobsmith’, ‘RW’, ‘t1′, ‘f1′, ‘col1′


 revoke ‘bobsmith’, ‘t1′, ‘f1′, ‘col1′


user_permission ‘table1′



http://learnhbase.wordpress.com/2013/03/02/hbase-shell-commands/

0 0
原创粉丝点击