设为首页 加入收藏

TOP

HBaseShell(一)
2015-11-21 01:30:27 来源: 作者: 【 】 浏览:1
Tags:HBaseShell

?

HBase Shell是使用(J)Ruby的IRB实现的命令行脚本。

因此可以在HBase Shell中混合使用Ruby代码:

hbase(main):011:0> create'testtable','colfam'

hbase(main):011:0> for i in 'a'..'z' do

hbase(main):012:1* for j in 'a'..'z' do

hbase(main):013:2* put'testtable',"row-#{i}#{j}","colfam:#{j}","#{j}"


1) Shell命令帮助

hbase(main):025:0> help

COMMAND GROUPS:

Group name: general

Commands: status, table_help, version, whoami

………………….

会出现很多命令组,然后也可以查看每个命令组下面命令的帮助

hbase(main):025:0> help "status"

Show cluster status. Can be 'summary','simple', 'detailed', or 'replication'. The

default is 'summary'. Examples:

?

hbase> status

hbase> status 'simple'

hbase> status 'summary'

hbase> status 'detailed'

hbase> status 'replication'

hbase> status 'replication', 'source'

hbase> status 'replication', 'sink'

?

执行命令:

hbase(main):026:0> whoami

hadoop (auth:SIMPLE)

groups: hadoop

?

2) HBase Shell客户端,退格键无法删除命令的问题

ctrl+返回键即可删除

?

3) 查看数据库状态

hbase(main):061:0> status 'simple'

2 live servers

gpseg:16020 1434249190233

requestsPerSecond=0.0, numberOfOnlineRegions=3, usedHeapMB=15,maxHeapMB=193, numberOfStores=3, numberOfStorefiles=2,storefileUncompressedSizeMB=0, storefileSizeMB=0, memstoreSizeMB=0,storefileIndexSizeMB=0, readRequestsCount=87, writeRequestsCount=8,rootIndexSizeKB=0, totalStaticIndexSizeKB=0, totalStaticBloomSizeKB=0,totalCompactingKVs=0, currentCompactedKVs=0, compactionProgressPct=NaN,coprocessors=[]

gpmaster:16202 1434249598161

requestsPerSecond=0.0, numberOfOnlineRegions=2, usedHeapMB=13,maxHeapMB=193, numberOfStores=2, numberOfStorefiles=0,storefileUncompressedSizeMB=0, storefileSizeMB=0, memstoreSizeMB=0,storefileIndexSizeMB=0, readRequestsCount=0, writeRequestsCount=0,rootIndexSizeKB=0, totalStaticIndexSizeKB=0, totalStaticBloomSizeKB=0,totalCompactingKVs=0, currentCompactedKVs=0, compactionProgressPct=NaN,coprocessors=[]

0 dead servers

Aggregate load: 0, regions: 5

?

hbase(main):062:0> status 'summary'

2 servers, 0 dead, 2.5000 average load

?

hbase(main):063:0> status 'detailed' -----更加详细的信息,此处略

?

4) 表操作

hbase(main):001:0> version

hbase(main):001:0> create 'member','member_id','address','info'

注释:member指表名,后面三个为列族,系统会自动分配region

list

describe tablename

hbase(main):010:0> list

TABLE

member

student

t1

3 row(s) in 0.0450 seconds

?

=> ["member","student", "t1"]

hbase(main):011:0> describe 'member'

Table member is ENABLED

member

COLUMN FAMILIES DESCRIPTION

{NAME => 'address', DATA_BLOCK_ENCODING=> 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS=> '1', COMPR

ESSION => 'NONE', MIN_VERSIONS =>'0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE =>'65536', IN_MEMORY =

> 'false', BLOCKCACHE =>'true'}

{NAME => 'info', DATA_BLOCK_ENCODING=> 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS=> '1', COMPRESS

ION => 'NONE', MIN_VERSIONS => '0',TTL => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536',IN_MEMORY => '

false', BLOCKCACHE => 'true'}

{NAME => 'member_id',DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE=> '0', VERSIONS => '1', COM

PRESSION => 'NONE', MIN_VERSIONS =>'0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE =>'65536', IN_MEMORY

=> 'false', BLOCKCACHE => 'true'}

3 row(s) in 0.0710 seconds

?

注释:上面创建表时没有指定时间戳,那么将由系统自动生成

5

首页 上一页 1 2 3 下一页 尾页 1/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Redis禁用FLUSHALLFLUSHDBKEYS命令 下一篇【算法导论】第十二课跳跃表

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: