Hbase shell 操作数据库常用命令

alter    
Alter column family schema; pass table name and a dictionary specifying new column family schema. Dictionaries are described below in the GENERAL NOTES section.  Dictionary must include name of column family to alter.  For example, to change the 'f1' column family in table 't1' from defaults to instead keep a maximum of 5 cell VERSIONS.
          Examples:
          hbase> alter 't1', {NAME => 'f1', VERSIONS => 5}

count  
Count the number of rows in a table. This operation may take a LONG time(Run '$HADOOP_HOME/bin/hadoop jar hbase.jar rowcount' to run a counting mapreduce job). Current count is shown every 1000 rows by default.Count interval may be optionally specified.
           Examples:
           hbase> count 't1'
           hbase> count 't1', 100000

create   
Create table; pass table name, a dictionary of specifications per columnfamily, and optionally a dictionary of table configuration.Dictionaries are described below in the GENERAL NOTES section.
          Examples:
          hbase> create 't1', {NAME => 'f1', VERSIONS => 5}
          hbase> create 't1', {NAME => 'f1'}, {NAME => 'f2'}, {NAME =>'f3'}
          hbase> # The above in shorthand would be the following:
          hbase> create 't1', 'f1', 'f2', 'f3'
          hbase> create 't1', {NAME => 'f1', VERSIONS => 1, TTL =>2592000, BLOCKCACHE => true}

describe  
Describe the named table:
Examples: "hbase>describe 't1'"

delete    
Put adelete 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. Takes arguments like the 'put' command described below
            Examples:
            delete't1', 'r1', 'c1', ts1

deleteall
Deleteall cells in a given row; pass a table name, row, and optionally a column and timestamp
            Examples:
            hbase>deleteall 't1', 'r1'
            hbase> deleteall 't1', 'r1', 'c1'
            hbase> deleteall 't1', 'r1', 'c1',ts1

disable  
Disable the named table:
             Example: "hbase>disable 't1'"

drop
Drop the named table. Table must first bedisabled
           Examples:
           hbase> drop ‘tb1’;

enable   
Enable the named table
            hbase> enable ‘tb1’;

exists    
Does the named table exist?
            Examples:
            "hbase> exists't1'"

exit      
Type "hbase> exit" to leavethe HBase Shell

get       
Get row or cell contents; pass tablename, row, and optionally adictionary of column(s), timestamp and versions.  
          Examples:
          hbase> get 't1', 'r1'
          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', TIMESTAMP => ts1,VERSIONS = 4}

list      
List all tables in hbase
          Example:
          hbase> list

put       
Put a cell 'value' at specifiedtable/row/column and optionally timestamp coordinates.  To put a cell value into table 't1' at row 'r1' under column 'c1' marked with the time 'ts1', do:
           hbase> put 't1', 'r1', 'c:c1','value', ts1

scan   
Scan a table; pass table name and optionally an array of column names ORan array of column names AND a dictionary of scanner specifications.  If you wish to include scanner specifications,you must also include an array of columns. Scanner specifications may include one or more of the following: LIMIT, STARTROW, STOPROW,or TIMESTAMP.  To scan all members of acolumn family, leave the qualifier empty as in 'col_family:'.
          Examples:
          hbase> scan '.META.'
          hbase> scan '.META.', ['info:regioninfo']
          hbase> scan 't1', ['c1', 'c2'], {LIMIT => 10, STARTROW =>'xyz'}

version   
Output this HBase version
           hbase(main):038:0> version

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值