zoukankan      html  css  js  c++  java
  • hbase

    http://hi.baidu.com/fengyanmin1990/item/abd8ef036240bf07addc70e5

    http://raylzhang520.iteye.com/blog/1569738

    1.进入HBase Shell 命令:

    $ ${HBASE_HOME}/bin/hbase shell

    例如  /home/hduser/hbase/bin/hbase shell

    2.获得命令列表:

    hbase> help

    3.alter:

    1)表't1'中,增加或修改一个column family=> 'f1'并保持其最大版本数为5:

    hbase> alter 't1', {NAME => 'f1', VERSIONS => 5}

    2)删除表't1'中值为'f1'的column family:

    hbase> alter 't1', {NAME => 'f1', METHOD => 'delete'}

    3)你也可以修改表属性,比如:MAX_FILESIZE,MEMSTORE_FLUSHSIZE和READONLY:

    hbase> alter 't1', {METHOD => 'table_att', MAX_FILESIZE => '134217728'}

    4.count:

    返回表的全部行数,这种操作会花费很长时间(run counting mapreduce job),默认每1000行显示一次,当然这个是可以自己配置的。

    hbase> count 't1'

    hbase> count 't1', 100000

    5.create:

    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}

    TTL为此column family的生命周期,单位为秒。

    6.describe:

    获得表的属性。

    hbase> describe 't1'

    7.delete:

    删除一个cell,需要用timestamp定位。

    hbase> delete 't1', 'r1', 'f1:c1', ts1

    8.deleteall

    根据指定条件批量删除cell。

    hbase> deleteall 't1', 'r1'
    hbase> deleteall 't1', 'r1', 'f1:c1'
    hbase> deleteall 't1', 'r1', 'f1:c1', ts1

    9.disable

    使一个指定表失效。

    hbase> exists 't1'

    10.drop

    删除一张表,在删除之前必须先disable此表,如果这个表有多个region,先运行:

    hbase> major_compact ".META."

    11.enable

    与disable相对应。

    12.exists

    判断表是否存在。

    hbase> exists 't1'

    13.exit

    离开hbase shell。

    14.get

    根据指定条件返回查询结果,必须指定row。

    hbase> get 't1', 'r1'

    hbase> get 't1', 'r1', {COLUMN => 'f1:c1'}

    hbase> get 't1', 'r1', {COLUMN => ['f1:c1', 'f1:c2', 'f1:c3']}

    hbase> get 't1', 'r1', {COLUMN => 'f1:c1', TIMESTAMP => ts1}

    hbase> get 't1', 'r1', {COLUMN => 'f1:c1', TIMESTAMP => ts1, VERSIONS => 4}

    15.list

    获得hbase中所有表名。

    16.put

    新增一个cell。

    hbase> put 't1', 'r1', 'f1:c1', 'value', ts1

    17.tools

    获得server端的一些操作命令,如close_regin,flush等,如以后遇到,会另作具体详解。

    18.scan

    根据指定条件扫描指定表,条件包括LIMIT,STARTROW,STOPROW,TIMESTAMP,COLUMNS。如果在COLUMNS中未指定具体column family则会扫描全部column family。

    hbase> scan '.META.'

    hbase> scan '.META.', {COLUMNS => 'info:regioninfo'}

    hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, STARTROW => 'xyz'}

    在扫描的时候也可以自动设置缓存的开启和关闭状态,默认为开启。

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

    19.status

    显示hbase中列簇状态,条件可以为:summary,simple,detailed,默认为summary。

    hbase> status

    hbase> status 'simple'

    hbase> status 'summary'
    hbase> status 'detailed'

    20.shutdown,truncate,version

  • 相关阅读:
    OC
    OC
    核心动画
    核心动画
    核心动画
    数据存储1
    plsql语句基础
    Oracle3连接&子查询&联合查询&分析函数
    oracle2约束添加&表复制&拼接
    Oracle表空间创建及表创建
  • 原文地址:https://www.cnblogs.com/qinyan20/p/3784269.html
Copyright © 2011-2022 走看看