hbase shell常用命令

hbase安装部署完成后,如果已经设置了hbase的环境变量(如HBASE_HOME=/home/david/cloudera/lib/hbase-1.2.5),则直接在命令行窗口下,执行命令:hbase shell,呼起shell环境。

HBase Shell; enter ‘help’ for list of supported commands.
Type “exit” to leave the HBase Shell
Version 1.2.5, rd7b05f79dee10e0ada614765bb354b93d615a157, Wed Mar 1 00:34:48 CST 2017

hbase(main):001:0>

接着执行help命令,则hbase将按group形式,分组列出所有该组下的命令。

分组名命令名
generalstatus, table_help, version, whoami
ddlalter, alter_async, alter_status, create, describe, disable, disable_all, drop, drop_all, enable, enable_all, exists, get_table, is_disabled, is_enabled, list, locate_region, show_filters
namespacealter_namespace, create_namespace, describe_namespace, drop_namespace, list_namespace, list_namespace_tables
dmlappend, count, delete, deleteall, get, get_counter, get_splits, incr, put, scan, truncate, truncate_preserve
toolsassign, balance_switch, balancer, balancer_enabled, catalogjanitor_enabled, catalogjanitor_run, catalogjanitor_switch, close_region, compact, compact_rs, flush, major_compact, merge_region, move, normalize, normalizer_enabled, normalizer_switch, split, trace, unassign, wal_roll, zk_dump
replicationadd_peer, append_peer_tableCFs, disable_peer, disable_table_replication, enable_peer, enable_table_replication, list_peers, list_replicated_tables, remove_peer, remove_peer_tableCFs, set_peer_tableCFs, show_peer_tableCFs
snapshotsclone_snapshot, delete_all_snapshot, delete_snapshot, list_snapshots, restore_snapshot, snapshot
configurationupdate_all_config, update_config
quotaslist_quotas, set_quota
securitygrant, list_security_capabilities, revoke, user_permission
proceduresabort_procedure, list_procedures
visibility labelsadd_labels, clear_auths, get_auths, list_labels, set_auths, set_visibility

常用命令如下

命令作用表达式
一。表的管理① 查看表的列表list
② 建表create ‘表名’,’列簇1’,’列簇2’,…,’列簇N’
③ 查看表结构describe ‘表名’
④ 修改表结构,删除表的某个列簇1. disable ‘表名’; 2.alter ‘表名’, {NAME=>’列簇名’,METHOD=>’delete’}
⑤ 删表1. disable ‘表名’; 2.drop ‘表名’;enable ‘表名’
二。权限管理① 分配权限grant ‘用户名’,’权限’,’表名’
② 查看权限user_permission ‘表名’
③ 收回权限revoke ‘用户名’,’表名’
三。表的CURD① 添加记录put ‘表名’,’行名’,’列簇名:列名’,’值’
②查询数据 a).查看rowKey全部列簇的记录get ‘表名’,’行名’
b).查看rowKey某一列簇的记录get ‘表名’,’行名’,’列簇名’
c).查看rowKey某一列簇的某一列记录get ‘表名’,’行名’,’列簇名:列名’
扫描表 a).扫描全表记录scan ‘member’
b).扫描全表前N条记录scan ‘member’, {LIMIT=>3}
查看表记录行数count ‘表名’
③ 删除记录 a).删除行中某一列delete ‘表名’,’行名’,’列簇名:列名’
b).删除行deleteall ‘表名’,’行名’
c).删除表中全部数据truncate ‘表名’
四。Region管理① 移动regionmove ‘encodeRegionName’, ‘ServerName’
② 开启/关闭regionbalance_switch (true|false)
③ 手动splitsplit ‘regionName’, ‘splitKey’
④ 手动触发major compaction #语法:#Compact all regions in a table:#hbase> major_compact ‘t1’#Compact an entire region:#hbase> major_compact ‘r1’#Compact a single column family within a region:#hbase> major_compact ‘r1’, ‘c1’#Compact a single column family within a table:#hbase> major_compact ‘t1’, ‘c1’
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值