HBase Shell命令学习

HBase Shell是基于JRuby的,确切地说,它是使用交互式的Ruby Shell,输入命令并快速得到响应。
通过命令”hbase shell”进行交互式终端,通过exit或quit退出。

[root@cent-1 ~]# hbase shell
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
16/12/13 17:06:46 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" to leave the HBase Shell
Version 1.0.0-cdh5.4.8, rUnknown, Thu Oct 15 08:59:42 PDT 2015

hbase(main):001:0> quit

HBase Shell提供了很多命令,详细参照下面列表,

普通命令

命令 描述
status 返回HBase集群的状态
version 返回HBase的版本信息

数据定义

命令 描述
alter 修改表结构,对应modifyTable()
create 创建新表,对应createTable()
describe 打印表描述信息
disable 禁用表,对应disableTable()
drop 删除表,对应deleteTable()
enable 启用表,对应enableTable()
exists 检查表是否存在,对应tableExists()
is_disabled 检查表是否已经禁用,对应isTableDisabled()
is_enabled 检查表是否已经启用,对应isTableEnabled()
list 返回所有表

数据操作

命令 描述
count 统计一张的行数
delete 删除一个单元格,对应Delete类
deleteall 类似于delete,但不仅仅删除一列,主要会删除一个列族或列,对应Delete类
get 获取一个单元格,对应Get类
get_counter 返回一个计数器数值
incr 给计数器加一 |
put 存储一个单元格,对应Put类
scan 扫描一个范围的数据,依赖于Scan类
truncate 清理一张表的数据,相当于disable、drop、create顺序执行

工具

命令 描述
assign 分配一个region到一台region服务器,对应assign()
balance_switch 切换负载均衡状态,对应balanceSwitch()
balancer 启动负载均衡,对应balancer()
close_region 关闭一个region,对应closeRegion()
compact 开启某个region或一张表的异步合并操作,对应compact()
flush 开启某个region或一张表的异步刷写操作,对应flush()
major_compact 开启某个region或一张表的异步强制合并操作,对应majorCompact()
move 移动一个region到不同的服务器中,对应move()
split 拆分一个region或一张表,对应split()
unassign 下线一个region,对应unassign()
zk_dump 转存zookeeper固有信息到HBase中

复制

命令 描述
add_peer 增加复制单元
disable_peer 禁用一个复制单元
enable_peer 启用一个复制单元
remove_peer 移除一个复制单元
start_replication 开户复制进程
stop_replication 关闭复制进程

你可能感兴趣的:(HBase,大数据)