HBASE 表空間大小及常用命令

假設 $HBASE 爲HBASE的安裝目錄;
$HADOOP爲HADOOP的安裝目錄。
運行

$HADOOP/bin/hdfs dfs -du -h /

918.5 M  /hbase
3.0 M    /tmp

$HADOOP/bin/hdfs dfs -du -h /hbase
0        /hbase/.tmp
91       /hbase/WALs
0        /hbase/archive
0        /hbase/corrupt
918.5 M  /hbase/data
42       /hbase/hbase.id
7        /hbase/hbase.version
0        /hbase/oldWALs


$HADOOP/bin/hdfs dfs -du -h /hbase/data
918.4 M  /hbase/data/default
104.1 K  /hbase/data/hbase

查看具體數據表的佔用空間的大小
$HADOOP/bin/hdfs dfs -du -h /hbase/data/default
2.3 M    /hbase/data/default/AnalyErrorInfo
254.9 M  /hbase/data/default/AnalyticsEvent
332      /hbase/data/default/AppParam
62.7 K   /hbase/data/default/AppVersion
2.2 K    /hbase/data/default/ApplicationAppIdIndexV2
20.9 K   /hbase/data/default/ApplicationV2
33.9 M   /hbase/data/default/WidgetStartupInfo
354.4 K  /hbase/data/default/pkgResultsV2
26.4 M   /hbase/data/default/widgetSoftTokenIndexV2
600.5 M  /hbase/data/default/widgetsV2

也可以通過如下命令來查詢,得到一樣的結果
$HADOOP/hadoop fs -du -h /hbase/data/default 
2.3 M    /hbase/data/default/AnalyErrorInfo
254.9 M  /hbase/data/default/AnalyticsEvent
332      /hbase/data/default/AppParam
62.7 K   /hbase/data/default/AppVersion
2.2 K    /hbase/data/default/ApplicationAppIdIndexV2
20.9 K   /hbase/data/default/ApplicationV2
33.9 M   /hbase/data/default/WidgetStartupInfo
354.4 K  /hbase/data/default/pkgResultsV2
26.4 M   /hbase/data/default/widgetSoftTokenIndexV2
600.5 M  /hbase/data/default/widgetsV2

$HBASE/bin/hbase shell 進入HBASE,進行交互。

help
HBase Shell, version 0.98.10-hadoop2, rb18bc4b06f3eb90f592c906e78fb6461548ae627, Sun Feb  1 05:48:33 UTC 2015
Type 'help "COMMAND"', (e.g. 'help "get"' -- the quotes are necessary) for help on a specific command.
Commands are grouped. Type 'help "COMMAND_GROUP"', (e.g. 'help "general"') for help on a command group.

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, 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, incr, put, scan, truncate, truncate_preserve

  Group name: tools
  Commands: assign, balance_switch, balancer, catalogjanitor_enabled, catalogjanitor_run, catalogjanitor_switch, close_region, compact, compact_rs, flush, hlog_roll, major_compact, merge_region, move, split, trace, unassign, zk_dump

  Group name: replication
  Commands: add_peer, disable_peer, enable_peer, list_peers, list_replicated_tables, remove_peer, set_peer_tableCFs, show_peer_tableCFs

  Group name: snapshots
  Commands: clone_snapshot, delete_all_snapshot, delete_snapshot, list_snapshots, restore_snapshot, snapshot

  Group name: security
  Commands: grant, revoke, user_permission

  Group name: visibility labels
  Commands: add_labels, clear_auths, get_auths, list_labels, set_auths, set_visibility

SHELL USAGE:
Quote all names in HBase Shell such as table and column names.  Commas delimit
command parameters.  Type <RETURN> after entering a command to run it.
Dictionaries of configuration used in the creation and alteration of tables are
Ruby Hashes. They look like this:

  {'key1' => 'value1', 'key2' => 'value2', ...}

and are opened and closed with curley-braces.  Key/values are delimited by the
'=>' character combination.  Usually keys are predefined constants such as
NAME, VERSIONS, COMPRESSION, etc.  Constants do not need to be quoted.  Type
'Object.constants' to see a (messy) list of all constants in the environment.

If you are using binary keys or values and need to enter them in the shell, use
double-quote'd hexadecimal representation. For example:

  hbase> get 't1', "key\x03\x3f\xcd"
  hbase> get 't1', "key\003\023\011"
  hbase> put 't1', "test\xef\xff", 'f1:', "\x01\x33\x40"

The HBase shell is the (J)Ruby IRB with the above HBase-specific commands added.
For more on the HBase Shell, see http://hbase.apache.org/book.html

名稱 命令表達式
創建表 create ‘表名稱’, ‘列名稱1’,‘列名稱2’,‘列名稱N’
添加記錄 put ‘表名稱’, ‘行名稱’, ‘列名稱:’, ‘值’
查看記錄 get ‘表名稱’, ‘行名稱’
查看錶中的記錄總數 count ‘表名稱’
刪除記錄 delete ‘表名’ ,‘行名稱’ , ‘列名稱’
刪除一張表 先屏蔽表,再 disable ‘表名稱’ ,接着 drop ‘表名稱’
查看所有記錄 scan ‘表名稱’
查看某個表某個列中所有數據 scan ‘表名稱’ , [‘列名稱:’]
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章