get

hbase(main):015:0> get 't10', 'row1'
COLUMN                        CELL                                                                               
 f10:colum1                   timestamp=1519647321864, value=value10                                             
 f10:colum2                   timestamp=1519647626671, value=value12                                             
 f10:name2                    timestamp=1519647914157, value=wangshumin2                                         
3 row(s) in 0.0150 seconds


hbase(main):016:0> get 't10', 'row1'
COLUMN                        CELL                                                                               
 f10:colum1                   timestamp=1519647321864, value=value10                                             
 f10:colum2                   timestamp=1519647626671, value=value12                                             
 f10:name2                    timestamp=1519647914157, value=wangshumin2                                         
3 row(s) in 0.7370 seconds


hbase(main):017:0> help
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.  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
hbase(main):018:0> delete


ERROR: wrong number of arguments (0 for 3)


Here is some help for this command:
Put a delete cell value at specified table/row/column and optionally
timestamp coordinates.  Deletes must match the deleted cell's
coordinates exactly.  When scanning, a delete cell suppresses older
versions. To delete a cell from  't1' at row 'r1' under column 'c1'
marked with the time 'ts1', do:


  hbase> delete 'ns1:t1', 'r1', 'c1', ts1
  hbase> delete 't1', 'r1', 'c1', ts1
  hbase> delete 't1', 'r1', 'c1', ts1, {VISIBILITY=>'PRIVATE|SECRET'}


The same command can also be run on a table reference. Suppose you had a reference
t to table 't1', the corresponding command would be:


  hbase> t.delete 'r1', 'c1',  ts1
  hbase> t.delete 'r1', 'c1',  ts1, {VISIBILITY=>'PRIVATE|SECRET'}




hbase(main):019:0> delete 't10', 'row1','f10:colum1'
0 row(s) in 1.4490 seconds


hbase(main):020:0> get 't10', 'row1'
COLUMN                        CELL                                                                               
 f10:colum2                   timestamp=1519647626671, value=value12                                             
 f10:name2                    timestamp=1519647914157, value=wangshumin2                                         
2 row(s) in 0.0540 seconds


hbase(main):021:0> delete 't10', 'row1','f10:colum2'
0 row(s) in 0.0050 seconds


hbase(main):022:0> get 't10', 'row1'
COLUMN                        CELL                                                                               
 f10:name2                    timestamp=1519647914157, value=wangshumin2                                         
1 row(s) in 0.0090 seconds


hbase(main):023:0> scan 't10', 'row1'
ROW                           COLUMN+CELL                                                                        


ERROR: Args should be a Hash


Here is some help for this command:
Scan a table; pass table name and optionally a dictionary of scanner
specifications.  Scanner specifications may include one or more of:
TIMERANGE, FILTER, LIMIT, STARTROW, STOPROW, ROWPREFIXFILTER, TIMESTAMP,
MAXLENGTH or COLUMNS, CACHE or RAW, VERSIONS, ALL_METRICS or METRICS


If no columns are specified, all columns will be scanned.
To scan all members of a column family, leave the qualifier empty as in
'col_family'.


The filter can be specified in two ways:
1. Using a filterString - more information on this is available in the
Filter Language document attached to the HBASE-4176 JIRA
2. Using the entire package name of the filter.


If you wish to see metrics regarding the execution of the scan, the
ALL_METRICS boolean should be set to true. Alternatively, if you would
prefer to see only a subset of the metrics, the METRICS array can be 
defined to include the names of only the metrics you care about.


Some examples:


  hbase> scan 'hbase:meta'
  hbase> scan 'hbase:meta', {COLUMNS => 'info:regioninfo'}
  hbase> scan 'ns1:t1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, STARTROW => 'xyz'}
  hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, STARTROW => 'xyz'}
  hbase> scan 't1', {COLUMNS => 'c1', TIMERANGE => [1303668804, 1303668904]}
  hbase> scan 't1', {REVERSED => true}
  hbase> scan 't1', {ALL_METRICS => true}
  hbase> scan 't1', {METRICS => ['RPC_RETRIES', 'ROWS_FILTERED']}
  hbase> scan 't1', {ROWPREFIXFILTER => 'row2', FILTER => "
    (QualifierFilter (>=, 'binary:xyz')) AND (TimestampsFilter ( 123, 456))"}
  hbase> scan 't1', {FILTER =>
    org.apache.hadoop.hbase.filter.ColumnPaginationFilter.new(1, 0)}
  hbase> scan 't1', {CONSISTENCY => 'TIMELINE'}
For setting the Operation Attributes 
  hbase> scan 't1', { COLUMNS => ['c1', 'c2'], ATTRIBUTES => {'mykey' => 'myvalue'}}
  hbase> scan 't1', { COLUMNS => ['c1', 'c2'], AUTHORIZATIONS => ['PRIVATE','SECRET']}
For experts, there is an additional option -- CACHE_BLOCKS -- which
switches block caching for the scanner on (true) or off (false).  By
default it is enabled.  Examples:


  hbase> scan 't1', {COLUMNS => ['c1', 'c2'], CACHE_BLOCKS => false}


Also for experts, there is an advanced option -- RAW -- which instructs the
scanner to return all cells (including delete markers and uncollected deleted
cells). This option cannot be combined with requesting specific COLUMNS.
Disabled by default.  Example:


  hbase> scan 't1', {RAW => true, VERSIONS => 10}


Besides the default 'toStringBinary' format, 'scan' supports custom formatting
by column.  A user can define a FORMATTER by adding it to the column name in
the scan 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> scan 't1', {COLUMNS => ['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.


Scan can also be used directly from a table, by first getting a reference to a
table, like such:


  hbase> t = get_table 't'
  hbase> t.scan


Note in the above situation, you can still provide all the filtering, columns,
options, etc as described above.






hbase(main):024:0> scan 't10'
ROW                           COLUMN+CELL                                                                        
 row0                         column=f10:address, timestamp=1519647793871, value=beijing                         
 row0                         column=f10:age, timestamp=1519647830498, value=110                                 
 row0                         column=f10:name, timestamp=1519647816288, value=wangshumin1                        
 row1                         column=f10:name2, timestamp=1519647914157, value=wangshumin2                       
 row2                         column=f10:colum2, timestamp=1519647478935, value=value12                          
3 row(s) in 0.1380 seconds


hbase(main):025:0> delete 't10', 'row2','f10:colum2'
0 row(s) in 0.0280 seconds


hbase(main):026:0> scan 't10'
ROW                           COLUMN+CELL                                                                        
 row0                         column=f10:address, timestamp=1519647793871, value=beijing                         
 row0                         column=f10:age, timestamp=1519647830498, value=110                                 
 row0                         column=f10:name, timestamp=1519647816288, value=wangshumin1                        
 row1                         column=f10:name2, timestamp=1519647914157, value=wangshumin2                       
2 row(s) in 0.0930 seconds


hbase(main):027:0> describe 't10'
Table t10 is ENABLED                                                                                             
t10                                                                                                              
COLUMN FAMILIES DESCRIPTION                                                                                      
{NAME => 'f10', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_
BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLO
CKSIZE => '65536', REPLICATION_SCOPE => '0'}                                                                     
{NAME => 'f20', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_
BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLO
CKSIZE => '65536', REPLICATION_SCOPE => '0'}                                                                     
{NAME => 'f30', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_
BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLO
CKSIZE => '65536', REPLICATION_SCOPE => '0'}                                                                     
3 row(s) in 0.7440 seconds


hbase(main):028:0> get_table


ERROR: wrong number of arguments (0 for 1)


Here is some help for this command:
Get the given table name and return it as an actual object to
be manipulated by the user. See table.help for more information
on how to use the table.
Eg.


  hbase> t1 = get_table 't1'
  hbase> t1 = get_table 'ns1:t1'


returns the table named 't1' as a table object. You can then do


  hbase> t1.help


which will then print the help for that table.




hbase(main):029:0> get_table 't10'
0 row(s) in 0.0000 seconds


=> Hbase::Table - t10
hbase(main):030:0> describe 't10'
Table t10 is ENABLED                                                                                                                                                                         
t10                                                                                                                                                                                          
COLUMN FAMILIES DESCRIPTION                                                                                                                                                                  
{NAME => 'f10', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSI
ONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}                                                                                                            
{NAME => 'f20', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSI
ONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}                                                                                                            
{NAME => 'f30', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSI
ONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}                                                                                                            
3 row(s) in 0.0440 seconds


hbase(main):031:0> scan 't10'
ROW                                              COLUMN+CELL                                                                                                                                 
 row0                                            column=f10:address, timestamp=1519647793871, value=beijing                                                                                  
 row0                                            column=f10:age, timestamp=1519647830498, value=110                                                                                          
 row0                                            column=f10:name, timestamp=1519647816288, value=wangshumin1                                                                                 
 row1                                            column=f10:name2, timestamp=1519647914157, value=wangshumin2                                                                                
2 row(s) in 0.0370 seconds


hbase(main):032:0> put 't10', 'row2','f20:name','longhongyan'
0 row(s) in 0.0830 seconds


hbase(main):033:0> scan 't10'
ROW                                              COLUMN+CELL                                                                                                                                 
 row0                                            column=f10:address, timestamp=1519647793871, value=beijing                                                                                  
 row0                                            column=f10:age, timestamp=1519647830498, value=110                                                                                          
 row0                                            column=f10:name, timestamp=1519647816288, value=wangshumin1                                                                                 
 row1                                            column=f10:name2, timestamp=1519647914157, value=wangshumin2                                                                                
 row2                                            column=f20:name, timestamp=1519681639423, value=longhongyan                                                                                 
3 row(s) in 0.0800 seconds


hbase(main):034:0> put 't10', 'row2','f20:age','longhongyan'
0 row(s) in 0.0050 seconds


hbase(main):035:0> scan 't10'
ROW                                              COLUMN+CELL                                                                                                                                 
 row0                                            column=f10:address, timestamp=1519647793871, value=beijing                                                                                  
 row0                                            column=f10:age, timestamp=1519647830498, value=110                                                                                          
 row0                                            column=f10:name, timestamp=1519647816288, value=wangshumin1                                                                                 
 row1                                            column=f10:name2, timestamp=1519647914157, value=wangshumin2                                                                                
 row2                                            column=f20:age, timestamp=1519681654559, value=longhongyan                                                                                  
 row2                                            column=f20:name, timestamp=1519681639423, value=longhongyan                                                                                 
3 row(s) in 0.1210 seconds


hbase(main):036:0> put 't10', 'row2','f20:age','120'
0 row(s) in 0.0060 seconds


hbase(main):037:0> scan 't10'
ROW                                              COLUMN+CELL                                                                                                                                 
 row0                                            column=f10:address, timestamp=1519647793871, value=beijing                                                                                  
 row0                                            column=f10:age, timestamp=1519647830498, value=110                                                                                          
 row0                                            column=f10:name, timestamp=1519647816288, value=wangshumin1                                                                                 
 row1                                            column=f10:name2, timestamp=1519647914157, value=wangshumin2                                                                                
 row2                                            column=f20:age, timestamp=1519681678763, value=120                                                                                          
 row2                                            column=f20:name, timestamp=1519681639423, value=longhongyan                                                                                 
3 row(s) in 0.0220 seconds


hbase(main):038:0> put 't10', 'row2','f20:address','立水桥'
0 row(s) in 0.0060 seconds


hbase(main):039:0> scan 't10'
ROW                                              COLUMN+CELL                                                                                                                                 
 row0                                            column=f10:address, timestamp=1519647793871, value=beijing                                                                                  
 row0                                            column=f10:age, timestamp=1519647830498, value=110                                                                                          
 row0                                            column=f10:name, timestamp=1519647816288, value=wangshumin1                                                                                 
 row1                                            column=f10:name2, timestamp=1519647914157, value=wangshumin2                                                                                
 row2                                            column=f20:address, timestamp=1519681730731, value=\xE7\xAB\x8B\xE6\xB0\xB4\xE6\xA1\xA5                                                     
 row2                                            column=f20:age, timestamp=1519681678763, value=120                                                                                          
 row2                                            column=f20:name, timestamp=1519681639423, value=longhongyan                                                                                 
3 row(s) in 0.0650 seconds


hbase(main):040:0> 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 => [ts1, ts2]}
  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 => [ts1, ts2], 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 => [ts1, ts2]}
  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 => [ts1, ts2], 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(main):041:0> get 't10','row1'
COLUMN                                           CELL                                                                                                                                        
 f10:name2                                       timestamp=1519647914157, value=wangshumin2                                                                                                  
1 row(s) in 0.0070 seconds


hbase(main):042:0> get 't10','row2'
COLUMN                                           CELL                                                                                                                                        
 f20:address                                     timestamp=1519681730731, value=\xE7\xAB\x8B\xE6\xB0\xB4\xE6\xA1\xA5                                                                         
 f20:age                                         timestamp=1519681678763, value=120                                                                                                          
 f20:name                                        timestamp=1519681639423, value=longhongyan                                                                                                  
3 row(s) in 0.0090 seconds


hbase(main):043:0> get 't10','row0'
COLUMN                                           CELL                                                                                                                                        
 f10:address                                     timestamp=1519647793871, value=beijing                                                                                                      
 f10:age                                         timestamp=1519647830498, value=110                                                                                                          
 f10:name                                        timestamp=1519647816288, value=wangshumin1                                                                                                  
3 row(s) in 0.0070 seconds


hbase(main):044:0> get 't10','row0','f10:name'
COLUMN                                           CELL                                                                                                                                        
 f10:name                                        timestamp=1519647816288, value=wangshumin1                                                                                                  
1 row(s) in 0.0050 seconds


hbase(main):045:0> get 't10','f10:name'
COLUMN                                           CELL                                                                                                                                        
0 row(s) in 0.0040 seconds


hbase(main):046:0> get 't10','row0','f20:name'
COLUMN                                           CELL                                                                                                                                        
0 row(s) in 0.0050 seconds


hbase(main):047:0> get 't10','row2','f20:name'
COLUMN                                           CELL                                                                                                                                        
 f20:name                                        timestamp=1519681639423, value=longhongyan                                                                                                  
1 row(s) in 0.0080 seconds


hbase(main):048:0> 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值