hbase shell概述

hbase shell-general(常规指令):http://www.cnblogs.com/husky/p/6374867.html

hbase shell-ddl(表定义指令):http://www.cnblogs.com/husky/p/6374321.html

hbase shell-namespace(命名空间指令):http://www.cnblogs.com/husky/p/6374878.html

hbase shell-dml(数据管理指令):http://www.cnblogs.com/husky/p/6374892.html

hbase shell-security(安全指令):http://www.cnblogs.com/husky/p/6374905.html

HBase 为用户提供了一个非常方便的使用方式, 我们称之为“HBase Shell”。
HBase Shell 提供了大多数的 HBase 命令, 通过 HBase Shell 用户可以方便地创建、删除及修改表, 还可以向表中添加数据、列出表中的相关信息等。

鉴于网上大多数的相关归纳资源不全或者比较乱,现自己归纳一份作为备份。

测试的hbase系统版本为:Version 1.2.0-cdh5.9.0,在通过使用hbase shell进入hbase时显示,也可以使用稍后说明的命令version进行查看http://www.cnblogs.com/husky/p/6374867.html

1 [husky@master ~]$ hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 1.2.0-cdh5.9.0, rUnknown, Fri Oct 21 01:19:47 PDT 2016

shell命令按照分类进行说明,分类标准依据系统

1 hbase(main):001:0> help
 1 HBase Shell, version 1.2.0-cdh5.9.0, rUnknown, Fri Oct 21 01:19:47 PDT 2016
 2 Type 'help "COMMAND"', (e.g. 'help "get"' -- the quotes are necessary) for help on a specific command.
 3 Commands are grouped. Type 'help "COMMAND_GROUP"', (e.g. 'help "general"') for help on a command group.
 4 
 5 COMMAND GROUPS:
 6   Group name: general
 7   Commands: status, table_help, version, whoami
 8 
 9   Group name: ddl
10   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
11 
12   Group name: namespace
13   Commands: alter_namespace, create_namespace, describe_namespace, drop_namespace, list_namespace, list_namespace_tables
14 
15   Group name: dml
16   Commands: append, count, delete, deleteall, get, get_counter, get_splits, incr, put, scan, truncate, truncate_preserve
17 
18   Group name: tools
19   Commands: assign, balance_switch, balancer, balancer_enabled, catalogjanitor_enabled, catalogjanitor_run, catalogjanitor_switch, close_region, compact, compact_mob, compact_rs, flush, major_compact, major_compact_mob, merge_region, move, normalize, normalizer_enabled, normalizer_switch, split, trace, unassign, wal_roll, zk_dump
20 
21   Group name: replication
22   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
23 
24   Group name: snapshots
25   Commands: clone_snapshot, delete_all_snapshot, delete_snapshot, list_snapshots, restore_snapshot, snapshot
26 
27   Group name: configuration
28   Commands: update_all_config, update_config
29 
30   Group name: quotas
31   Commands: list_quotas, set_quota
32 
33   Group name: security
34   Commands: grant, list_security_capabilities, revoke, user_permission
35 
36   Group name: procedures
37   Commands: abort_procedure, list_procedures
38 
39   Group name: visibility labels
40   Commands: add_labels, clear_auths, get_auths, list_labels, set_auths, set_visibility
41 
42 SHELL USAGE:
43 Quote all names in HBase Shell such as table and column names.  Commas delimit
44 command parameters.  Type <RETURN> after entering a command to run it.
45 Dictionaries of configuration used in the creation and alteration of tables are
46 Ruby Hashes. They look like this:
47 
48   {'key1' => 'value1', 'key2' => 'value2', ...}
49 
50 and are opened and closed with curley-braces.  Key/values are delimited by the
51 '=>' character combination.  Usually keys are predefined constants such as
52 NAME, VERSIONS, COMPRESSION, etc.  Constants do not need to be quoted.  Type
53 'Object.constants' to see a (messy) list of all constants in the environment.
54 
55 If you are using binary keys or values and need to enter them in the shell, use
56 double-quote'd hexadecimal representation. For example:
57 
58   hbase> get 't1', "keyx03x3fxcd"
59   hbase> get 't1', "key032311"
60   hbase> put 't1', "testxefxff", 'f1:', "x01x33x40"
61 
62 The HBase shell is the (J)Ruby IRB with the above HBase-specific commands added.
63 For more on the HBase Shell, see http://hbase.apache.org/book.html
View Code

补充:在hbase shell中只知道部分使用时,使用help是一个不错的方法。

直接help——显示所有的分组信息,参数说明等等,见上面。

help '分类'  (具体分类下面会列出,直接help也可以查看)——显示该分类下面所有command的用法,如果你觉得篇幅太多,可以试试直接

help 'commandName' ——显示该命令详细的说明及使用

hbase(main):003:0> help 'list'
List all tables in hbase. Optional regular expression parameter could
be used to filter the output. Examples:

  hbase> list
  hbase> list 'abc.*'
  hbase> list 'ns:abc.*'
  hbase> list 'ns:.*'
View Code

以下列出的是系统的分类方式,也是接下来我进行说明的分类方式。

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  #表定义指令,包括创建表,删除表,查看表,查看表状态等等 
  Group name: namespace Commands: alter_namespace, create_namespace, describe_namespace, drop_namespace, list_namespace, list_namespace_tables  #和namespace相关的指令,包括创建,删除,显示结构,列出,修改,列出namespace下的表等等
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_mob, compact_rs, flush, major_compact, major_compact_mob, 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

加蓝色中文注释的是比较基础常用的操作,其余的需要深入hbase原理层面,以后有时间进行补充。

hbase shell-general(常规指令):http://www.cnblogs.com/husky/p/6374867.html

hbase shell-ddl(表定义指令):http://www.cnblogs.com/husky/p/6374321.html

hbase shell-namespace(命名空间指令):http://www.cnblogs.com/husky/p/6374878.html

hbase shell-dml(数据管理指令):http://www.cnblogs.com/husky/p/6374892.html

hbase shell-security(安全指令):http://www.cnblogs.com/husky/p/6374905.html

原文地址:https://www.cnblogs.com/husky/p/6374802.html