hbase shell-general(常规指令)

hbase shell常规指令解释篇

  1. status (显示集群状态,master,server情况,显示内容的详略程度可选)

hbase(main):015:0> help 'status'
Show cluster status. Can be 'summary', 'simple', 'detailed', or 'replication'. The
default is 'summary'. Examples:

  hbase> status                  #默认等价于 status 'summary'
  hbase> status 'simple'            #显示region,storefile,request,read,write等等状况,通常使用计数器进行描述
  hbase> status 'summary'           #显示各个节点的状态,alive or dead
  hbase> status 'detailed'           #各个节点存储的详细情况
  hbase> status 'replication'
  hbase> status 'replication', 'source'
  hbase> status 'replication', 'sink'
hbase(main):010:0> status
1 active master, 0 backup masters, 3 servers, 0 dead, 5.3333 average load 

  2. table_help (表的引用,通过获取一张表的引用来对这张表进行添加删除数据等等操作,现在不推荐使用)

hbase(main):025:0> help 'table_help'
 1 Help for table-reference commands.
 2 
 3 You can either create a table via 'create' and then manipulate the table via commands like 'put', 'get', etc.
 4 See the standard help information for how to use each of these commands.
 5 
 6 However, as of 0.96, you can also get a reference to a table, on which you can invoke commands.
 7 For instance, you can get create a table and keep around a reference to it via:
 8 
 9    hbase> t = create 't', 'cf'
10 
11 Or, if you have already created the table, you can get a reference to it:
12 
13    hbase> t = get_table 't'
14 
15 You can do things like call 'put' on the table:
16 
17   hbase> t.put 'r', 'cf:q', 'v'
18 
19 which puts a row 'r' with column family 'cf', qualifier 'q' and value 'v' into table t.
20 
21 To read the data out, you can scan the table:
22 
23   hbase> t.scan
24 
25 which will read all the rows in table 't'.
26 
27 Essentially, any command that takes a table name can also be done via table reference.
28 Other commands include things like: get, delete, deleteall,
29 get_all_columns, get_counter, count, incr. These functions, along with
30 the standard JRuby object methods are also available via tab completion.
31 
32 For more information on how to use each of these commands, you can also just type:
33 
34    hbase> t.help 'scan'
35 
36 which will output more information on how to use that command.
37 
38 You can also do general admin actions directly on a table; things like enable, disable,
39 flush and drop just by typing:
40 
41    hbase> t.enable
42    hbase> t.flush
43    hbase> t.disable
44    hbase> t.drop
45 
46 Note that after dropping a table, your reference to it becomes useless and further usage
47 is undefined (and not recommended).
View Code

  3. version (查看系统版本,hbase shell进入时也会打印显示,详细情况见http://www.cnblogs.com/husky/p/6374802.html)

1 hbase(main):008:0> version
2 1.2.0-cdh5.9.0, rUnknown, Fri Oct 21 01:19:47 PDT 2016

  4. whoami  (查看当前用户)

1 hbase(main):007:0> whoami
2 xwtech (auth:SIMPLE)
3     groups: xwtech
posted @ 2017-02-07 16:46  时光舟  阅读(1229)  评论(0编辑  收藏  举报