[root@localhost ~]# docker search hbase
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
harisekhon/hbase Apache HBase, opens shell - pseudo-distribut… 110 [OK]
dajobe/hbase HBase 2.1.2 in Docker 41
nerdammer/hbase HBase pseudo-distributed (configured for loc… 25 [OK]
banno/hbase-standalone HBase master running in standalone mode on U… 17 [OK]
boostport/hbase-phoenix-all-in-one HBase with phoenix and the phoenix query ser… 11 [OK]
harisekhon/hbase-dev Apache HBase + dev tools, github repos, pseu… 9 [OK]
zenoss/hbase HBase image for Zenoss 5.0 9
bde2020/hbase-standalone Standalone Apache HBase docker image. Suitab… 6 [OK]
bde2020/hbase-regionserver Regionserver Docker image for Apache HBase. 4 [OK]
aaionap/hbase AAI Hbase 3
gradiant/hbase-base Hbase small footprint Image (Alpine based) 3 [OK]
smizy/hbase Apache HBase docker image based on alpine 3 [OK]
bde2020/hbase-master Master docker image for Apache HBase. 2 [OK]
imagenarium/hbase 2
imagenarium/hbase-regionserver 1
newnius/hbase Setup a HBase cluster in a totally distribut… 1 [OK]
pilchard/hbase Hbase 1.2.0 (CDH 5.11) with openjdk-1.8 1 [OK]
pierrezemb/hbase-docker hbase in docker 1 [OK]
imagenarium/hbase-master 1
stellargraph/hbase-master 1
cellos/hbase HBase on top of Alpine Linux 0
rperla/hbase 0
openiamdocker/hbase Wrapper around hbase 0
dwpdigital/hbase-table-provisioner Docker image containing Hbase-Table-Provisio… 0
ibmcom/hbase-s390x Docker image for hbase-s390x
获取HBase镜像:docker pull harisekhon/hbase
[root@localhost ~]# docker run -d -p 2181:2181 -p 8080:8080 -p 8085:8085 -p 9090:9090 -p 9095:9095 -p 16000:16000 -p 16010:16010 -p 16201:16201 -p 16301:16301 -p 16030:16030 -p 16020:16020 --name hbase harisekhon/hbase
6a4e3a377c79fbe2bd2edf561f60f9ef1ec1ff87230bfe8ae2437fa6a306a171
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6a4e3a377c79 harisekhon/hbase "/entrypoint.sh" 6 seconds ago Up 2 seconds 0.0.0.0:2181->2181/tcp, :::2181->2181/tcp, 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp, 0.0.0.0:8085->8085/tcp, :::8085->8085/tcp, 0.0.0.0:9090->9090/tcp, :::9090->9090/tcp, 0.0.0.0:9095->9095/tcp, :::9095->9095/tcp, 0.0.0.0:16000->16000/tcp, :::16000->16000/tcp, 0.0.0.0:16010->16010/tcp, :::16010->16010/tcp, 0.0.0.0:16020->16020/tcp, :::16020->16020/tcp, 0.0.0.0:16030->16030/tcp, :::16030->16030/tcp, 0.0.0.0:16201->16201/tcp, :::16201->16201/tcp, 0.0.0.0:16301->16301/tcp, :::16301->16301/tcp hbase
访问地址:http://192.168.79.11:16010/
[root@localhost ~]# docker exec -it hbase /bin/bash
bash-4.4#
bash-4.4#
bash-4.4# hbase shell
2022-07-12 02:20:47,009 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
HBase Shell
Use "help" to get list of supported commands.
Use "exit" to quit this interactive shell.
For Reference, please visit: http://hbase.apache.org/2.0/book.html#shell
Version 2.1.3, rda5ec9e4c06c537213883cca8f3cc9a7c19daf67, Mon Feb 11 15:45:33 CST 2019
Took 0.0039 seconds
hbase(main):001:0>
0、查看HBase版本
hbase(main):001:0> version
2.1.3, rda5ec9e4c06c537213883cca8f3cc9a7c19daf67, Mon Feb 11 15:45:33 CST 2019
Took 0.0003 seconds
1、创建表
hbase(main):002:0> create 'fruits','features'
Created table fruits
Took 1.6252 seconds
=> Hbase::Table - fruits
2、查看所有的表
hbase(main):004:0* list
TABLE
fruits
1 row(s)
Took 0.0438 seconds
=> ["fruits"]
3、删除表
首先需要disable table,然后才能删除表。注意:需要添加单引号 '
hbase(main):006:0> disable 'fruits'
Took 1.1063 seconds
hbase(main):007:0> drop 'fruits'
Took 0.5607 seconds
4、添加数据
hbase(main):017:0> put 'fruits','1','features:name','apple'
Took 0.1120 seconds
hbase(main):018:0> put 'fruits','1','features:degree','middle'
Took 0.0063 seconds
hbase(main):019:0> put 'fruits','2','features:name','banana'
Took 0.0086 seconds
hbase(main):020:0> put 'fruits','2','features:degree','rare'
Took 0.0101 seconds
5、据rowkey查询
hbase(main):006:0* get 'fruits','1'
COLUMN CELL
features:degree timestamp=1657593583700, value=middle
features:name timestamp=1657593573585, value=apple
1 row(s)
Took 0.8220 seconds
hbase(main):007:0> get 'fruits','2'
COLUMN CELL
features:degree timestamp=1657593601577, value=rare
features:name timestamp=1657593593156, value=banana
1 row(s)
Took 0.0182 seconds
6、扫描全表
hbase(main):008:0> scan 'fruits'
ROW COLUMN+CELL
1 column=features:degree, timestamp=1657593583700, value=middle
1 column=features:name, timestamp=1657593573585, value=apple
2 column=features:degree, timestamp=1657593601577, value=rare
2 column=features:name, timestamp=1657593593156, value=banana
2 row(s)
Took 0.0362 second