HBase Shell 命令——Quick Start

The Apache HBase Shell is JRuby's IRB with some HBase particular commands added. Anything you can do in IRB, you should be able to do in the HBase Shell.

Apache HBase Shell 命令在Ruby的IRB命令的基础上加入了一些特殊的HBase命令。任何在IRB中使用的命令,你都可以在HBase Shell中使用。

1、在启动HBase之后,通过shell命令连接HBase

bin/hbase shell

hbase(main):001:0>
2、显示HBase 帮助文本

hbase(main):002:0>help

3、创建表,创建表的时候必须写出表名(test)和列族名(cf)

hbase(main):003:0>create 'test','cf'

4、列出HBase中的表

hbase(main):004:0>list 'test'

5、向test表中插入数据,在插入数据时,可以定义行名(row1)列族名下的列名(a),并赋值(value1)

hbase(main):005:0>put 'test','row1','cf:a','value1'

6、扫描全表

hbase(main):006:0>scan 'test'

7、获得单个行的数据

hbase(main):007:0>get 'test','row1'

8、获得某个行键,某个列族中具体列名的信息。

hbase(main):008:0>get 'test','row1','cf:a'

9、在删除表或修改表之前,首先要是表失效。

hbase(main):009:0>disable 'test'
使表有效:

hbase(main):010:0>enable 'test'

10、修改表

1)删除列族(cf)

hbase(main):011:0>alter 'test',NAME=>'cf',METHOD=>'delete'

2)改变或添加一个列族

hbase(main):012:0>alter 'test',NAME=>'cf',VERSIONS=>5

11、删除行列(不需要表离线)

1)删除指定的行健字段

hbase(main):013:0>delete 'test','row1','cf:a'
2)删除整行

hbase(main):014:0>deleteall 'test','row1'

12、删除整表

hbase(main):015:0>drop 'test'

13、查看集群状态status

14、查看版本号version

15、检查表是否存在

hbase(main):016:0>exists 'test'
16、判断表是否离线

hbase(main):017:0>is_enabled 'test'
hbase(main):018:0>is_disabled 'test'

17、统计表的行数

hbase(main):019:0>count 'test'
18、清空表

hbase(main):020:0>trancate 'test'

19、退出shell命令

hbase(main):021:0>quit

参考资料:1、点击打开链接

                    2、 http://itlab.idcquan.com/linux/set/939223_2.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值