hbase shell基本命令
1.进入hbase shell
hadoop@namenode:~/hbase-0.98.8-hadoop1/conf$ hbase shell
HBase Shell; enter ‘help<RETURN>‘ for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.98.8-hadoop1, r6cfc8d064754251365e070a10a82eb169956d5fe, Fri Nov 14 17:14:19 PST 2014
hbase(main):001:0>
hbase不适合复杂的查询
2.以下是操作
hbase(main):007:0> create ‘user‘,‘age‘,‘name‘,‘gender‘,‘address‘
0 row(s) in 0.7400 seconds
=> Hbase::Table - user
hbase(main):008:0> list
TABLE
uesr
user
2 row(s) in 0.0080 seconds
hbase(main):009:0> describe ‘user‘
Table user is ENABLED
COLUMN FAMILIES DESCRIPTION
{NAME => ‘address‘, DATA_BLOCK_ENCODING => ‘NONE‘, BLOOMFILTER => ‘ROW‘, REPLICATION_SCOPE => ‘0‘, VERSIONS => ‘1‘, COMPRESSI
ON => ‘NONE‘, MIN_VERSIONS => ‘0‘, TTL => ‘FOREVER‘, KEEP_DELETED_CELLS => ‘FALSE‘, BLOCKSIZE => ‘65536‘, IN_MEMORY => ‘false
‘, BLOCKCACHE => ‘true‘}
{NAME => ‘age‘, DATA_BLOCK_ENCODING => ‘NONE‘, BLOOMFILTER => ‘ROW‘, REPLICATION_SCOPE => ‘0‘, VERSIONS => ‘1‘, COMPRESSION =
> ‘NONE‘, MIN_VERSIONS => ‘0‘, TTL => ‘FOREVER‘, KEEP_DELETED_CELLS => ‘FALSE‘, BLOCKSIZE => ‘65536‘, IN_MEMORY => ‘false‘, B
LOCKCACHE => ‘true‘}
{NAME => ‘gender‘, DATA_BLOCK_ENCODING => ‘NONE‘, BLOOMFILTER => ‘ROW‘, REPLICATION_SCOPE => ‘0‘, VERSIONS => ‘1‘, COMPRESSIO
N => ‘NONE‘, MIN_VERSIONS => ‘0‘, TTL => ‘FOREVER‘, KEEP_DELETED_CELLS => ‘FALSE‘, BLOCKSIZE => ‘65536‘, IN_MEMORY => ‘false‘
, BLOCKCACHE => ‘true‘}
{NAME => ‘name‘, DATA_BLOCK_ENCODING => ‘NONE‘, BLOOMFILTER => ‘ROW‘, REPLICATION_SCOPE => ‘0‘, VERSIONS => ‘1‘, COMPRESSION
=> ‘NONE‘, MIN_VERSIONS => ‘0‘, TTL => ‘FOREVER‘, KEEP_DELETED_CELLS => ‘FALSE‘, BLOCKSIZE => ‘65536‘, IN_MEMORY => ‘false‘,
BLOCKCACHE => ‘true‘}
4 row(s) in 0.0580 seconds
删除表之前必须先disable掉表
hbase(main):010:0> disable ‘uesr‘
0 row(s) in 1.3560 seconds
hbase(main):012:0> drop ‘uesr‘
0 row(s) in 0.2450 seconds
hbase(main):013:0> list
TABLE
user
1 row(s) in 0.0080 seconds
新增数据(‘表名’,‘row key’,‘列族:列‘,‘值‘)
hbase(main):016:0*> put ‘user‘,‘xiaoming‘,‘address:city‘,‘newYork‘
0 row(s) in 0.0250 seconds
查询数据(‘表名’,‘row key’)
hbase(main):002:0> get ‘user‘,‘xiaoming‘
COLUMN CELL
address:city timestamp=1417013862751, value=newYork
age:real timestamp=1417273133703, value=14
hbase(main):003:0> get ‘user‘,‘xiaoming‘,‘address‘
COLUMN CELL
address:city timestamp=1417013862751, value=newYork
hbase(main):003:0> get ‘user‘,‘xiaoming‘,‘address:city‘
COLUMN CELL
address:city timestamp=1417013862751, value=newYork
hbase(main):011:0> scan ‘user‘
ROW COLUMN+CELL
xiaoming column=address:city, timestamp=1417013862751, value=newYork
xiaoming column=age:real, timestamp=1417273547325, value=16
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。