免费注册
帮助文档(华北一、二)

  • Hbase shell是简单的,通过shell与HBase交互的方式,以下介绍使用方法:

    1.1 启动shell

     

    [root@uhadoop-******-master1 ~]# hbase shell

    2016-12-06 11:00:08,624 INFO  [main] 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:11:18 PDT 2016

    1.2 创建表格,并插入3条数据

     

    hbase(main):004:0> create 'test_inspurcloud', 'cf'

    0 row(s) in 1.2280 seconds

    => Hbase::Table - test_inspurcloud

    hbase(main):005:0> list 'test_ inspurcloud'

    TABLE

    test_inspurcloud

    1 row(s) in 0.0180 seconds

    => ["test_inspurcloud"]

    hbase(main):006:0> put 'test_ inspurcloud', 'row1', 'cf:a', 'value1'

    0 row(s) in 0.1780 seconds

    hbase(main):007:0> put 'test_ inspurcloud', 'row2', 'cf:b', 'value2'

    0 row(s) in 0.0060 seconds

    hbase(main):008:0> put 'test_ inspurcloud', 'row3', 'cf:c', 'value3'

    0 row(s) in 0.0060 seconds

    1.3 读取全部数据

     

    hbase(main):009:0> scan 'test_inspurcloud'

    ROW                                            COLUMN+CELL

     row1                                          column=cf:a, timestamp=1480993562401, value=value1

     row2                                          column=cf:b, timestamp=1480993575088, value=value2

     row3                                          column=cf:c, timestamp=1480993587152, value=value3

    3 row(s) in 0.0610 seconds

    1.4 get一行数据

     

    hbase(main):010:0> get 'test_inspurcloud', 'row1'

    COLUMN                                         CELL

     cf:a                                          timestamp=1480993562401, value=value1

    1 row(s) in 0.0090 seconds

    1.5 删除表

     

    hbase(main):011:0> disable 'test_isnpurcloud'

    0 row(s) in 2.3550 seconds

    hbase(main):012:0> drop 'test_inspurcloud'

    0 row(s) in 1.4980 seconds

    1.6 退出HBase shell

     hbase(main):013:0> exit


文档是否已解决您的问题?

  已解决   未解决

如您有其它疑问,您也可以与我们技术专家联系探讨。

联系技术专家