標籤:hadoop hbase
1.進入hbase shell
[email protected]:~/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
hbase shell基本命令