HBase Shell 备忘录For Myself ;P
status:5 servers, 0 dead, 300.6000 average load
version:0.90.4-cdh3u2, r, Thu Oct 13 20:32:26 PDT 2011
list:看看你有啥表
建表:create 'TestTable','cf1','cf2','cf3'
切分表建表:./bin/hbase org.apache.hadoop.hbase.util.RegionSplitter -c 500 TestTable -f cf1:cf2:cf3
修改表属性:
disable 'IndexInfo'(需要先disable)
alter 'IndexInfo', {NAME => 'Author', BLOOMFILTER => 'ROWCOL', REPLICATION_SCOPE => '0', VERSIONS => '2147483647', COMPRESSION => 'LZO', TTL => '2147483647', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}, {NAME => 'Board', BLOOMFILTER => 'ROWCOL', REPLICATION_SCOPE => '0', COMPRESSION => 'LZO', VERSIONS => '2147483647', TTL => '2147483647', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}, {NAME => 'Index', BLOOMFILTER => 'ROWCOL', REPLICATION_SCOPE => '0', VERSIONS => '2147483647', COMPRESSION => 'LZO', TTL => '2147483647', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}, {NAME => 'Tag', BLOOMFILTER => 'ROWCOL', REPLICATION_SCOPE => '0', COMPRESSION => 'LZO', VERSIONS => '2147483647', TTL => '2147483647', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}
enable 'IndexInfo'
可以看一下常用的设置;P
增加记录(如果重复会追加版本):put 'TestTable','r1','cf1:cf1_c,' v1'
获取记录(默认获取最新版本):get 'TestTable','r1'
按照不同版本获取记录:get 'blog','1',{COLUMN => 'author:nickname',VERSIONS => 2}
查看一张表:scan 'TestTable'
删除一个cell:delete 'TestTable','r1','cf1:cf1_c'
删除一行:delete 'TestTable','r1'
删除表:disable 'TestTable'
drop 'TestTable'