编辑: 霜天盈月祭 2017-10-02

put '

t1'

, '

r1'

, '

c1'

, '

value'

, ts1 示例: //向表test中put数据,RowKey为rowkey1,列族名为cf,列名为qualifier1,值为value1 hbase(main):002:0>

put '

test'

,'

rowkey1'

,'

cf:qualifier1'

,'

value1'

0 row(s) in 0.5940 seconds hbase(main):003:0>

put '

test'

,'

rowkey2'

,'

cf:qualifier2'

,'

value2'

0 row(s) in 0.0080 seconds //指定时间戳为3 hbase(main):011:0>

put '

test'

,'

rowkey3'

,'

cf:qualifier3'

,'

value3'

,3

0 row(s) in 0.0510 seconds hbase(main):013:0>

count '

test'

3 row(s) in 0.0160 seconds 例如,向表test中put三条数据,并通过count命令计算test表中的数据的条数 第8页 版权所有?

2015 华为技术有限公司 常用Shell接口C 读取一行数据Get 查询一行数据时,必选参数是表名和RowKey,可选参数包括列名(包括列族和列 名)、时间戳、版本数等 用法: hbase>

get '

t1'

, '

r1'

hbase>

get '

t1'

, '

r1'

, {TIMERANGE =>

[ts1, ts2]} 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'

, TIMERANGE =>

[ts1, ts2], VERSIONS =>

4} hbase>

get '

t1'

, '

r1'

, {COLUMN =>

'

c1'

, TIMESTAMP =>

ts1, VERSIONS =>

4} hbase>

get '

t1'

, '

r1'

, '

c1'

hbase>

get '

t1'

, '

r1'

, '

c1'

, '

c2'

hbase>

get '

t1'

, '

r1'

, ['

c1'

, '

c2'

] 第9页 版权所有?

2015 华为技术有限公司 常用Shell接口C 读取多行数据Scan 查询多行数据,必选参数是表名,可选参数包括列名(包括列族和列名)、起止Key、Filter 用法: //查询元表 hbase>

scan '

.META.'

hbase>

scan '

.META.'

, {COLUMNS =>

'

info:regioninfo'

} hbase>

scan '

t1'

, {COLUMNS =>

['

c1'

, '

c2'

], LIMIT =>

10, STARTROW =>

'

xyz'

} hbase>

scan '

t1'

, {COLUMNS =>

'

c1'

, TIMERANGE =>

[1303668804, 1303668904]} hbase>

scan '

t1'

, {FILTER =>

(PrefixFilter ('

row2'

) AND (QualifierFilter s(>

=, '

binary:xyz'

)))AND (TimestampsFilter ( 123, 456)) } hbase>

scan '

t1'

, {FILTER =>

org.apache.hadoop.hbase.filter.ColumnPaginationFilter.new(1, 0)} hbase>

scan '

t1'

, {COLUMNS =>

['

c1'

, '

c2'

], CACHE_BLOCKS =>

false} hbase>

scan '

t1'

, {RAW =>

true, VERSIONS =>

10} 第10页 版权所有?

2015 华为技术有限公司 常用Shell接口C 其他常用命令 HBase还提供了一些其它的Shell API,包括general、ddl、dml、tools、replication和security六组,每 组又包括多个Shell命令.每组命令和每个命令的用法均可以通过help查询其用法 COMMAND GROUPS: Group name: general Commands: status, version, whoami Group name: ddl Commands: alter, alter_async, alter_status, create, describe, disable, disable_all, drop, drop_all, enable, enable_all, exists, is_disabled, is_enabled, list, show_filters Group name: dml Commands: count, delete, deleteall, get, get_counter, incr, put,scan, truncate Group name: tools Commands: assign, balance_switch, balancer, close_region, compact, flush, hlog_roll, major_compact, move, split, unassign, zk_dump Group name: replication Commands: add_peer, disable_peer, enable_peer, list_peers, remove_peer, start_replication, stop_replication Group name: security Commands: grant, revoke, user_permission 第11页 版权所有?

下载(注:源文件不在本站服务器,都将跳转到源网站下载)
备用下载
发帖评论
相关话题
发布一个新话题