立即注册 登录
About云-梭伦科技 返回首页

旧收音机的个人空间 https://www.aboutyun.com/?5994 [收藏] [复制] [分享] [RSS]

日志

Hbase之shell精简版

已有 731 次阅读2014-12-9 23:43

1.进入HBase Shell 命令:

$ ${HBASE_HOME}/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

element
Font
font-family
font-size
font-style
font-variant
font-weight
letter-spacing
line-height
text-decoration
text-align
text-indent
text-transform
white-space
word-spacing
color
Background
bg-attachment
bg-color
bg-image
bg-position
bg-repeat
Box
width
height
border-top
border-right
border-bottom
border-left
margin
padding
max-height
min-height
max-width
min-width
outline-color
outline-style
outline-width
Positioning
position
top
bottom
right
left
float
display
clear
z-index
List
list-style-image
list-style-type
list-style-position
Table
vertical-align
border-collapse
border-spacing
caption-side
empty-cells
table-layout
Effects
text-shadow
-webkit-box-shadow
border-radius
Other
overflow
cursor
visibility

路过

雷人

握手

鲜花

鸡蛋

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 立即注册

关闭

推荐上一条 /2 下一条