登录
[sparkadmin@Sit-Spark-02 ~]$ hbase shell
16 /09 /27 14 :35 :05 INFO Configuration .deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
HBase Shell; enter 'help <RETURN >' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 1.2 .0 -cdh5.8 .0 , rUnknown, Tue Jul 12 16 :09 :11 PDT 2016
表是否存在
hbase(main):001 :0 > exists 'tmp'
Table tmp does not exist
0 row(s) in 0.5420 seconds
创建表
create 'tablename' ,'col1' ,'col2' ,... ,'colN'
hbase(main):002 :0 > create 'tmp' ,'col1' ,'col2'
0 row(s) in 2.4920 seconds
=> Hbase ::Table - tmp
=> Hbase::Table - tmp
hbase(main):003 :0 > list 'tmp'
TABLE
tmp
1 row(s) in 0.0240 seconds
=> ["tmp" ]
hbase(main):004 :0 > desc 'tmp'
Table tmp is ENABLED
tmp
COLUMN FAMILIES DESCRIPTION
{NAME => 'col1' , DATA_BLOCK_ENCODING => 'NONE' , BLOOMFILTER => 'ROW' , REPLICATION_SCOPE => '0' , VERSIONS => '1' , COMPRESSION => 'N
ONE' , MIN_VERSIONS => '0' , TTL => 'FOREVER' , KEEP_DELETED_CELLS => 'FALSE' , BLOCKSIZE => '65536' , IN_MEMORY => 'false' , BLOCKCACHE
=> 'true' }
{NAME => 'col2' , DATA_BLOCK_ENCODING => 'NONE' , BLOOMFILTER => 'ROW' , REPLICATION_SCOPE => '0' , VERSIONS => '1' , COMPRESSION => 'N
ONE' , MIN_VERSIONS => '0' , TTL => 'FOREVER' , KEEP_DELETED_CELLS => 'FALSE' , BLOCKSIZE => '65536' , IN_MEMORY => 'false' , BLOCKCACHE
=> 'true' }
2 row(s) in 0.0770 seconds
修改表
hbase(main):005 :0 > exists 'tmp'
Table tmp does exist
0 row(s) in 0.0340 seconds
hbase(main):006 :0 > disable 'tmp'
0 row(s) in 2.3600 seconds
hbase(main):007 :0 > alter 'tmp' , name=>'col2' , method =>'delete '
NameError : undefined local variable or method `name ' for #<Object :0 xe014c4e>
hbase(main):008 :0 > alter 'tmp' ,NAME=>'col2' ,METHOD =>'delete '
Updating all regions with the new schema ...
1/1 regions updated .
Done .
0 row (s) in 2.8110 seconds
hbase(main):046 :0 > alter 'tmp' ,NAME='col3' ,METHOD ='add '
Updating all regions with the new schema ...
0/1 regions updated .
1/1 regions updated .
Done .
Updating all regions with the new schema ...
0/1 regions updated .
1/1 regions updated .
Done .
0 row (s) in 7.5210 seconds
hbase(main):010 :0 > is_enabled 'tmp'
false
0 row(s) in 0.0490 seconds
hbase(main):012 :0 > enable 'tmp'
0 row(s) in 2.3990 seconds
hbase(main):013 :0 > is_enabled 'tmp'
true
0 row(s) in 0.0400 seconds
hbase(main):014 :0 > desc 'tmp'
Table tmp is ENABLED
tmp
COLUMN FAMILIES DESCRIPTION
{NAME => 'col1' , DATA_BLOCK_ENCODING => 'NONE' , BLOOMFILTER => 'ROW' , REPLICATION_SCOPE => '0' , VERSIONS => '1' , COMPRESSION => 'N
ONE' , MIN_VERSIONS => '0' , TTL => 'FOREVER' , KEEP_DELETED_CELLS => 'FALSE' , BLOCKSIZE => '65536' , IN_MEMORY => 'false' , BLOCKCACHE
=> 'true' }
1 row(s) in 0.0530 seconds
删除表
hbase(main):011 :0 > is_disabled 'tmp'
true
0 row(s) in 0.0440 seconds
hbase(main):015 :0 > disable 'tmp'
0 row(s) in 4.3440 seconds
hbase(main):016 :0 > drop 'tmp'
0 row(s) in 2.3410 seconds