renran421 发表于 2018-8-27 10:11:41

hbase shell 命令

hbase(main):002:0> help get  

  
ERROR: wrong number of arguments (0 for 2)
  

  
Here is some help for this command:
  
Get row or cell contents; pass table name, row, and optionally
  
a dictionary of column(s), timestamp, timerange and versions. Examples:
  

  
hbase> get 'ns1:t1', 'r1'
  
hbase> get 't1', 'r1'
  
hbase> get 't1', 'r1', {TIMERANGE => }
  
hbase> get 't1', 'r1', {COLUMN => 'c1'}
  
hbase> get 't1', 'r1', {COLUMN => ['c1', 'c2', 'c3']}
  
hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1}
  
hbase> get 't1', 'r1', {COLUMN => 'c1', TIMERANGE => , VERSIONS => 4}
  
hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1, VERSIONS => 4}
  
hbase> get 't1', 'r1', {FILTER => "ValueFilter(=, 'binary:abc')"}
  
hbase> get 't1', 'r1', 'c1'
  
hbase> get 't1', 'r1', 'c1', 'c2'
  
hbase> get 't1', 'r1', ['c1', 'c2']
  
hbase> get 't1', 'r1', {COLUMN => 'c1', ATTRIBUTES => {'mykey'=>'myvalue'}}
  
hbase> get 't1', 'r1', {COLUMN => 'c1', AUTHORIZATIONS => ['PRIVATE','SECRET']}
  
hbase> get 't1', 'r1', {CONSISTENCY => 'TIMELINE'}
  
hbase> get 't1', 'r1', {CONSISTENCY => 'TIMELINE', REGION_REPLICA_ID => 1}
  

  
Besides the default 'toStringBinary' format, 'get' also supports custom formatting by
  
column.A user can define a FORMATTER by adding it to the column name in the get
  
specification.The FORMATTER can be stipulated:
  

  
1. either as a org.apache.hadoop.hbase.util.Bytes method name (e.g, toInt, toString)
  
2. or as a custom class followed by method name: e.g. 'c(MyFormatterClass).format'.
  

  
Example formatting cf:qualifier1 and cf:qualifier2 both as Integers:
  
hbase> get 't1', 'r1' {COLUMN => ['cf:qualifier1:toInt',
  
    'cf:qualifier2:c(org.apache.hadoop.hbase.util.Bytes).toInt'] }
  

  
Note that you can specify a FORMATTER by column only (cf:qualifier).You cannot specify
  
a FORMATTER for all columns of a column family.
  

  
The same commands also can be run on a reference to a table (obtained via get_table or
  
create_table). Suppose you had a reference t to table 't1', the corresponding commands
  
would be:
  

  
hbase> t.get 'r1'
  
hbase> t.get 'r1', {TIMERANGE => }
  
hbase> t.get 'r1', {COLUMN => 'c1'}
  
hbase> t.get 'r1', {COLUMN => ['c1', 'c2', 'c3']}
  
hbase> t.get 'r1', {COLUMN => 'c1', TIMESTAMP => ts1}
  
hbase> t.get 'r1', {COLUMN => 'c1', TIMERANGE => , VERSIONS => 4}
  
hbase> t.get 'r1', {COLUMN => 'c1', TIMESTAMP => ts1, VERSIONS => 4}
  
hbase> t.get 'r1', {FILTER => "ValueFilter(=, 'binary:abc')"}
  
hbase> t.get 'r1', 'c1'
  
hbase> t.get 'r1', 'c1', 'c2'
  
hbase> t.get 'r1', ['c1', 'c2']
  
hbase> t.get 'r1', {CONSISTENCY => 'TIMELINE'}
  
hbase> t.get 'r1', {CONSISTENCY => 'TIMELINE', REGION_REPLICA_ID => 1}
  

  

  
HBase Shell, version 1.2.1, r8d8a7107dc4ccbf36a92f64675dc60392f85c015, Wed Mar 30 11:19:21 CDT 2016
  
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, 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, 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
  

  
SHELL USAGE:
  
Quote all names in HBase Shell such as table and column names.Commas delimit
  
command parameters.Typeafter 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


页: [1]
查看完整版本: hbase shell 命令