HBase 命令行使用

HBase 命令行使用方法 持续添加中……  未完待续


status 命令后面可以添加  'summary' , 'simple' 以及 'detailed'三个参数  

三种参数打印的信息逐步详细  推荐使用'simple'   'summary'太简单  'detailed' 基本不可读

hbase> status           
hbase> status 'simple'           
hbase> status 'summary'           
hbase> status 'detailed'


HBase shell 中还可以使用一些Java程序写法 其中引入jruby-complete-1.6.5.jar 如下:

hbase(main):001:0> import java.text.SimpleDateFormat
=> Java::JavaText::SimpleDateFormat

hbase(main):002:0> import java.text.ParsePosition
=> Java::JavaText::ParsePosition

hbase(main):003:0> SimpleDateFormat.new("yy/MM/dd HH:mm:ss")
                                   .parse("08/08/16 20:56:29", ParsePosition.new(0))
                                   .getTime()
=> 1218891389000

hbase(main):006:0* import java.util.Date
file:/hadoop/hbase-0.94.23/lib/jruby-complete-1.6.5.jar!/builtin/javasupport/core_ext/object.rb:99 warning: already initialized constant Date
hbase(main):007:0> Date.new(1218920189000).toString()
=> "Sun Aug 17 04:56:29 CST 2008"


HBase  建表命令:

hbase(main):010:0> create 'test',{NAME => 'cf0', VERSIONS => 5 ,BLOCKCACHE => true}
0 row(s) in 1.1780 seconds

hbase(main):011:0> put 'test', 'row1', 'cf0:a', 'value1'
0 row(s) in 0.1520 seconds

hbase(main):012:0> put 'test', 'row2', 'cf0:b', 'value2'
0 row(s) in 0.0090 seconds

hbase(main):013:0> put 'test', 'row3', 'cf0:c', 'value3'
0 row(s) in 0.0300 seconds

hbase(main):014:0> scan 'test'
ROW                                  COLUMN+CELL                                                                                            
 row1                                column=cf0:a, timestamp=1416984381502, value=value1                                                    
 row2                                column=cf0:b, timestamp=1416984388602, value=value2                                                    
 row3                                column=cf0:c, timestamp=1416984395268, value=value3                                                    
3 row(s) in 0.1030 seconds

hbase(main):015:0> get 'test','row1'
COLUMN                               CELL                                                                                                   
 cf0:a                               timestamp=1416984381502, value=value1                                                                  
1 row(s) in 0.0180 seconds


HDFS有一个同时处理文件数量上线 hdfs-site.xml 中至少需要设dfs.datanode.max.xcievers为 4096


exists 命令判断表是否存在 

hbase(main):103:0> exists 'test'
Table test does exist                                                                                                                       
0 row(s) in 0.0170 seconds

hbase(main):104:0> exists 'test1'
Table test1 does not exist                                                                                                                  
0 row(s) in 0.0110 seconds




参考文献:

http://blog.cloudera.com/blog/2012/03/hbase-hadoop-xceivers/



你可能感兴趣的:(command,hbase,line)