COMMAND GROUPS: Group name: general Commands: processlist, status, table_help, version, whoami Group name: ddl Commands: alter, alter_async, alter_status, create, describe, disable, disable_all, drop, drop_all, enable, enable_all, exists, get_table, is_disabled, is_enabled, list, list_regions, locate_region, show_filters Group name: namespace Commands: alter_namespace, create_namespace, describe_namespace, drop_namespace, list_namespace, list_namespace_tables Group name: dml Commands: append, count, delete, deleteall, get, get_counter, get_splits, incr, put, scan, truncate, truncate_preserve Group name: tools Commands: assign, balance_switch, balancer, balancer_enabled, catalogjanitor_enabled, catalogjanitor_run, catalogjanitor_switch, cleaner_chore_enabled, cleaner_chore_run, cleaner_chore_switch, clear_deadservers, close_region, compact, compact_rs, compaction_state, flush, is_in_maintenance_mode, list_deadservers, major_compact, major_compact_rs, merge_region, move, normalize, normalizer_enabled, normalizer_switch, split, splitormerge_enabled, splitormerge_switch, trace, unassign, wal_roll, zk_dump Group name: replication Commands: add_peer, append_peer_tableCFs, disable_peer, disable_table_replication, enable_peer, enable_table_replication, get_peer_config, list_peer_configs, list_peers, list_replicated_tables, remove_peer, remove_peer_tableCFs, set_peer_bandwidth, set_peer_tableCFs, show_peer_tableCFs, update_peer_config Group name: snapshots Commands: clone_snapshot, delete_all_snapshot, delete_snapshot, delete_table_snapshots, list_snapshots, list_table_snapshots, restore_snapshot, snapshot Group name: configuration Commands: update_all_config, update_config Group name: quotas Commands: list_quotas, set_quota Group name: security Commands: grant, list_security_capabilities, revoke, user_permission Group name: procedures Commands: abort_procedure, list_procedures Group name: visibility labels Commands: add_labels, clear_auths, get_auths, list_labels, set_auths, set_visibility Group name: rsgroup Commands: add_rsgroup, balance_rsgroup, get_rsgroup, get_server_rsgroup, get_table_rsgroup, list_rsgroups, move_servers_rsgroup, move_servers_tables_rsgroup, move_tables_rsgroup, remove_rsgroup, remove_servers_rsgroupGroup name: general
Commands: processlist, status, table_help, version, whoami
Processlist: 目前运行的task状态,可以根据host进行过滤,详细可见help 'processlist'
status, table_help, version, whoami敲一次就知道了;第一个是集群主备master的状态,第二个是获取table并且进行get Scan disable等操作的便捷手段,不用每次都键入表名,第三个是当前节点的版本;最后一个是当前shell用户(对表操作是有权限问题的,如果没有对应权限可能会操作不了)
Group name: ddlCommands: alter, alter_async, alter_status, create, describe, disable, disable_all, drop, drop_all, enable, enable_all, exists, get_table, is_disabled, is_enabled, list, list_regions, locate_region, show_filters
alter:变更表属性,或者变更列族属性,或者删除列族,具体help直接键入alter即可;
注意,修改表属性的时候先disable,虽然参数hbase.online.schema.update.enable可以通过online的时刻就进行变更,但是出现过类似问题,在生产环境进行操作的时候务必先disable
alter_async: 上述方法的异步方法,不需要等待所有region更新完毕,可以通过alter_status进行观察状态
create: 创建表并且指定表的各项初始属性
describe:获取表描述符并且parse成字符串,包括了表的列族以及表属性(简写为desc)
Disable:将表disable,不允许进行读写,同时region会被offline
disable_all:根据正则表达式获取表名来进行disable,务必先看help之后进行操作
drop:disable后的表进行删除,没有disable无法进行drop
drop_all: 根据正则表达式进行drop,可以配合disable_all一起食用(没有错字)
enable:disable后的表,进行alter操作之后需要enable;比如说表已经很久没人使用将其先disable,之后有人需要访问了再进行enable;
enable_all:通过正则表达式进行enable table
exists:这样的table是真实存在的吗?
get_table: 获取table object,然后就像ruby对象一样使用这个table对象即可(不需要每次键入表名了耶~)
is_disabled, is_enabled : 如其名,查看表是否disable或者enable
list: 根据正则表达式获取table,或者获取所有表名(不加任何参数),hbase shell中有返回值的函数都可以通过变量进行接收
list_regions:可以通过各种filter获取到需要的表的region信息
locate_region: 通过表名和rowkey来确定某一个region的位置
show_filters:查看hbase所有的filter,这些filter可以用作scan查询或者其他用途(嗯?我也不清楚哦所以才这么说的)
Group name: namespaceCommands: alter_namespace, create_namespace, describe_namespace, drop_namespace, list_namespace, list_namespace_tables
alter_namespace:修改namaspace中的属性,根据help的格式来看,比如给namespace设置quota策略
create_namespace:创建namaspace并且给予初始的namespace属性
describe_namespace:描述namespace,包括名称和一些属性
drop_namespace:只能删除掉已经为空的namespace
list_namespace:列出所有namespace或者通过正则表达式过滤
list_namespace_tables:给定一个namespace名称,列出其中所有表
Group name: dmlCommands: append, count, delete, deleteall, get, get_counter, get_splits, incr, put, scan, truncate, truncate_preserve
append, count, delete, deleteall, get, get_counter, get_splits, incr, put, scan, truncate, truncate_preserve
Append:按照规则添加一行新数据(column是列族:列名才能行哦)
Count:获取表行数,可能会速度较慢,可以通过jar包执行mr任务来计算
Delete:和append格式一样,删除掉一格cell的数据(一格column)
Deleteall:删除掉rowkey下面所有的cell
Get:通过rowkey获取单行数据
get_counter:获取计数器的值,incr
get_splits:得到table的splits方案
incr:原子计数器,可以通过该方法实现原子+-
put:和append区别不大
scan:扫描表中的数据,通过给定的filter
truncate:清除表中所有数据,并且不留splits
truncate_preserve:清除表中所有数据,留下splits方案(region边界)
Group name: toolsCommands: assign, balance_switch, balancer, balancer_enabled, catalogjanitor_enabled, catalogjanitor_run, catalogjanitor_switch, cleaner_chore_enabled, cleaner_chore_run, cleaner_chore_switch, clear_deadservers, close_region, compact, compact_rs, compaction_state, flush, is_in_maintenance_mode, list_deadservers, major_compact, major_compact_rs, merge_region, move, normalize, normalizer_enabled, normalizer_switch, split, splitormerge_enabled, splitormerge_switch, trace, unassign, wal_roll, zk_dump
assign:如果region已经assign也会重新被assign,assign就是让region上线 unassign:相反~
balance_switch:转换balance状态,是否开启自动balance
balancer:触发一次balancer
balancer_enabled:查看balance是否是开启
catalogjanitor_enabled:是否开启catalogjanitor
catalogjanitor_run:运行catalogjanitor来收集hbase垃圾文件
catalogjanitor_switch:开关catalogjanitor
cleaner_chore_enabled, cleaner_chore_run, cleaner_chore_switch:定时清理HFile是否开启等~
clear_deadservers,list_deadservers:清除已经dead的RS节点;列出dead的RS节点
close_region:关闭某个region让其下线,小心使用
compact, compact_rs, compaction_state, major_compact, major_compact_rs:和comapct相关,定时做major compact使用较多,带上RS的就是只针对某个RS进行compact
flush:对某张表或者某个region强制flush
is_in_maintenance_mode:是否处于maintenance模式(hbck的时候就是处于这个模式)
merge_region:合并2个相邻的region(不要强行合并,一定会出现问题)
move:移动一个region到随机server或者到指定的server
normalize:让表变得扁平化(即每个region尽可能地size相同)
normalizer_enabled:是否开启扁平化 normalizer_switch:~
split:注意参数,手动对region或者table进行split
splitormerge_enabled, splitormerge_switch:自行查看help~字面意思
trace:不明白是做啥的呢~hhh 用于追踪hbase shell?嗯?
wal_roll:让某个RS server写一份新的WAL(roll file有时候也代表着写下一份文件,比如Roll log等~)
zk_dump:获取目前zk的状态信息
Group name: replicationCommands: add_peer, append_peer_tableCFs, disable_peer, disable_table_replication, enable_peer, enable_table_replication, get_peer_config, list_peer_configs, list_peers, list_replicated_tables, remove_peer, remove_peer_tableCFs, set_peer_bandwidth, set_peer_tableCFs, show_peer_tableCFs, update_peer_config
集群未设置replication,命令几乎没有操作过,如果开启了replica那么可能会频繁操作这些命令吧~
Group name: snapshotsCommands: clone_snapshot, delete_all_snapshot, delete_snapshot, delete_table_snapshots, list_snapshots, list_table_snapshots, restore_snapshot, snapshot
clone_snapshot:通过snapshot克隆一张新表,比如说想改变表region分布
delete_all_snapshot:正则表达式删除任何匹配的snapshot
delete_snapshot:删除特定的snapshot
delete_table_snapshots:通过2个正则表达式来删除snapshots
list_snapshots:列出所有的snapshots
list_table_snapshots:列出该表的所有 snapshots
restore_snapshot:对disabled的表进行回滚,回滚到snapshot的状态
snapshot:对一张表做snapshot存储,可以用作全表导出或者表结构大改迁移
Group name: configuration
Commands: update_all_config, update_config
对于支持dynamtic config的子集列表,可以不用重启服务器而直接动态修改对应的配置
Apache HBase ™ Reference Guide
Group name: quotasCommands: list_quotas, set_quota
设置吞吐量quota,如果是设置表数目或者region数目quota,则需要在namespace中进行配置
hbase.namespace.quota.maxtables
hbase.namespace.quota.maxregions
Group name: securityCommands: grant, list_security_capabilities, revoke, user_permission
grant:对用户授权相关的访问权限
revoke:撤回相关授予的权限
user_permission:查看用户权限
list_security_capabilities:List supported security capabilities
Group name: proceduresCommands: abort_procedure, list_procedures
谨慎使用abort命令,有些procedure是不可被abort的
Group name: visibility labelsCommands: add_labels, clear_auths, get_auths, list_labels, set_auths, set_visibility
本集群未开启相关功能,可以自行查看help相关内容
主要是可见性相关的操作,比如某些分组是否为可见等
Group name: rsgroupCommands: add_rsgroup, balance_rsgroup, get_rsgroup, get_server_rsgroup, get_table_rsgroup, list_rsgroups, move_servers_rsgroup, move_servers_tables_rsgroup, move_tables_rsgroup, remove_rsgroup, remove_servers_rsgroup
add_rsgroup: 构建一个RSgroup分组,逻辑上对regionServer进行分组(里面包含有不同的业务类型)
balance_rsgroup: 对rsGroup进行balance,让其中的region分布满足自己balance算法
get_rsgroup: 获取rsgroup中的table
get_server_rsgroup: 获取对应RS服务器的rsgroup
get_table_rsgroup:获取table对应的rsGroup
list_rsgroups:得到所有的rsGroup列表
move_servers_rsgroup:移动RS服务器的rsgroup
move_servers_tables_rsgroup:移动RS服务器以及相关表的rsGroup
move_tables_rsgroup:移动table的rsGroup
remove_rsgroup:删除rsGroup
remove_servers_rsgroup:从rsGroup中移除已经dead的RS节点
常用用法很多的指令:~(以后遇见了再详细说吧~今天写累了)create:创建表的时候使用,用法很多,一般是设置压缩算法和TTL等,其他可以采用以前建表默认参数
scan:有时候需要通过scan来查看数据集是否符合要求~以及一些比较特殊的scan需求,需要熟练使用filter
balance_rsgroup:刚刚移动过分组之后需要进行balance,也可以等待集群自动balance
move_servers_rsgroup,move_servers_tables_rsgroup:对集群做负载均衡或者要移动分组的时候



