20170711234复习-hbase篇-shell命令使用篇
COMMAND GROUPS:
Group name: general 第一组
Commands: 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, locate_region, show_filters
查看有哪些表: list
创建表:create 'ns1:t1', {NAME => 'f1', VERSIONS => 5} , {NAME => 'f2'} 或者 create 'ns1:t1', 'f1', 'f2'
删除表:先disable 'ns1:t1' , 然后 drop 'ns1:t1'
修改表:增加一个列族:alter 'ns1:t1' , 'cf33' 增加一个列族cf33
修改一个列族:alter 't1', NAME => 'f1', VERSIONS => 5 将列族f1的版本设置为5
删除一个列族:alter 'ns1:t1', NAME => 'f1', METHOD => 'delete 或者 alter 'ns1:t1', 'delete' => 'f1'
查询表:查询全部数据:scan 'ns1:t1'
查询某条数据:get 'ns1:t1', 'f1' 查询f1列族下的所有列 get 'ns1:t1', 'f1:c1', 'f2' 获取f1列族下的c1列,和全部的f2列族下的列
注:以上是查询记录,并不是查询表,查询表用list,具体使用方法见上面
描述表:describe 'ns1:t1'
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, close_region, compact, compact_rs, flush, major_compact, merge_region, move, normalize, normalizer_enabled, normalizer_switch, split, 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, list_peers, list_replicated_tables, remove_peer, remove_peer_tableCFs, set_peer_tableCFs, show_peer_tableCFs
Group name: snapshots 第七组 快照的命令
Commands: clone_snapshot, delete_all_snapshot, delete_snapshot, list_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
总结:上面图片展示了基本的操作:库的增删改查,表的增删改查,表中记录的增删改查,以及表和region的切割,合并,移动,重分配,重平衡等工具。已经可以满足日常使用了,
未展示的命令,是管理命令,日常开发使用较少,或者有一些命令无需手动执行,它已经有默认值,已经在后台运行了。
也可以查看http://www.yiibai.com/hbase/hbase_security.html