启动HBase:
- 先启动zookeeper
- 启动hbase
-
去60010端口查看
出现此页面证明启动成功
启动hbase的shell
[xc2046@master bin]$ hbase shell
2017-03-23 16:11:56,974 INFO [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.98.9-hadoop2, r96878ece501b0643e879254645d7f3a40eaf101f, Mon Dec 15 23:00:20 PST 2014
hbase(main):001:0> list
TABLE
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/xc2046/hbase-0.98.9-hadoop2/lib/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/xc2046/hadoop-2.6.0/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
2017-03-23 16:12:09,238 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
0 row(s) in 2.4790 seconds
=> []
hbase(main):002:0> create 'scores','grade','course'
0 row(s) in 0.8920 seconds
=> Hbase::Table - scores
hbase(main):003:0> list
TABLE
scores
1 row(s) in 0.0240 seconds
=> ["scores"]
hbase(main):004:0> describe 'scores'
Table scores is ENABLED
COLUMN FAMILIES DESCRIPTION
{NAME => 'course', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICAT
ION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', T
TL => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY
=> 'false', BLOCKCACHE => 'true'}
{NAME => 'grade', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATI
ON_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TT
L => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY =
> 'false', BLOCKCACHE => 'true'}
2 row(s) in 0.0650 seconds
hbase> put 'ns1:t1', 'r1', 'c1', 'value'
hbase> put 't1', 'r1', 'c1', 'value'
hbase> put 't1', 'r1', 'c1', 'value', ts1
hbase> put 't1', 'r1', 'c1', 'value', {ATTRIBUTES=>{'mykey'=>'myvalue'}}
hbase> put 't1', 'r1', 'c1', 'value', ts1, {ATTRIBUTES=>{'mykey'=>'myvalue'}}
hbase> put 't1', 'r1', 'c1', 'value', ts1, {VISIBILITY=>'PRIVATE|SECRET'}
The same commands also can be run on a table reference. Suppose you had a reference
t to table 't1', the corresponding command would be:
hbase> t.put 'r1', 'c1', 'value', ts1, {ATTRIBUTES=>{'mykey'=>'myvalue'}}
hbase(main):007:0> put'scores','Tom','grade',5
0 row(s) in 0.1090 seconds
hbase(main):008:0> put 'scores','Tom','grade',5
0 row(s) in 0.0100 seconds
hbase(main):009:0> put 'scores','Tom','course:math',97
0 row(s) in 0.0590 seconds
hbase(main):010:0> list
TABLE
scores
1 row(s) in 0.0410 seconds
=> ["scores"]
hbase(main):011:0> get 'scores','Tom'
COLUMN CELL
course:math timestamp=1490257052698, value=97
grade: timestamp=1490257030209, value=5
2 row(s) in 0.0490 seconds
hbase(main):012:0> scan'scores',{COLUMNS=>'course'}
ROW COLUMN+CELL
Tom column=course:math, timestamp=1490257052698, value=97
1 row(s) in 0.0470 seconds
hbase(main):013:0> delete'scores','Tom','course:math'
0 row(s) in 0.0330 seconds
hbase(main):014:0> get 'scores','Tom'
COLUMN CELL
grade: timestamp=1490257030209, value=5
1 row(s) in 0.0260 seconds
网友评论