HBase shell 命令入门


HBase Shell 名字可归类以下6部分:

1) General  HBase shell commands

status Show cluster status. Can be ‘summary’, ‘simple’, or ‘detailed’. The
default is ‘summary’.


hbase> status
hbase> status ‘simple’
hbase> status ‘summary’
hbase> status ‘detailed’

version Output this HBase versionUsage:


hbase> version

whoami Show the current hbase user.Usage:


hbase> whoami

2) Tables Management commands

alter Alter column family schema; pass table name and a dictionary
specifying new column family schema. Dictionaries are described
on the main help command output. Dictionary must include name
of column family to alter.For example, to change or add the ‘f1′ column family in table ‘t1′ from
current value to keep a maximum of 5 cell VERSIONS, do:


hbase> alter ‘t1′, NAME => ‘f1′, VERSIONS => 5

You can operate on several column families:

hbase> alter ‘t1′, ‘f1′, {NAME => ‘f2′, IN_MEMORY => true}, {NAME => ‘f3′, VERSIONS => 5}

To delete the ‘f1′ column family in table ‘t1′, use one of:hbase> alter ‘t1′, NAME => ‘f1′, METHOD => ‘delete’
hbase> alter ‘t1′, ‘delete’ => ‘f1′

You can also change table-scope attributes like MAX_FILESIZE, READONLY,
MEMSTORE_FLUSHSIZE, DEFERRED_LOG_FLUSH, etc. These can be put at the end;
for example, to change the max size of a region to 128MB, do:

hbase> alter ‘t1′, MAX_FILESIZE => ‘134217728’

You can add a table coprocessor by setting a table coprocessor attribute:

hbase> alter ‘t1′,
‘coprocessor’=>’hdfs:///foo.jar|com.foo.FooRegionObserver|1001|arg1=1,arg2=2

Since you can have multiple coprocessors configured for a table, a
sequence number will be automatically appended to the attribute name
to uniquely identify it.

The coprocessor attribute must match the pattern below in order for
the framework to understand how to load the coprocessor classes:

[coprocessor jar file location] | class name | [priority] | [arguments]

You can also set configuration settings specific to this table or column family:

hbase> alter ‘t1′, CONFIGURATION => {‘hbase.hregion.scan.loadColumnFamiliesOnDemand’ => ‘true’}
hbase> alter ‘t1′, {NAME => ‘f2′, CONFIGURATION => {‘hbase.hstore.blockingStoreFiles’ => ’10’}}

You can also remove a table-scope attribute:

hbase> alter ‘t1′, METHOD => ‘table_att_unset’, NAME => ‘MAX_FILESIZE’

hbase> alter ‘t1′, METHOD => ‘table_att_unset’, NAME => ‘coprocessor$1′

There could be more than one alteration in one command:

hbase> alter ‘t1′, { NAME => ‘f1′, VERSIONS => 3 },
{ MAX_FILESIZE => ‘134217728’ }, { METHOD => ‘delete’, NAME => ‘f2′ },
OWNER => ‘johndoe’, METADATA => { ‘mykey’ => ‘myvalue’ }

create Create table; pass table name, a dictionary of specifications per
column family, and optionally a dictionary of table configuration.


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}
hbase> create ‘t1′, {NAME => ‘f1′, CONFIGURATION => {‘hbase.hstore.blockingStoreFiles’ => ’10’}}

Table configuration options can be put at the end.

describe Describe the named table.


  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值