目录
一、安装HBase前置环境
1.jdk
2.hadoop
3.zookeeper
二、安装HBase步骤
(一)解压
(二)修改文件名
(三)修改配置文件
(四)配置HBase的环境变量
(五)启动HBase
1.启动hadoop
2.启动zookeeper
3.启动hbase
4.jps出现HMaster和HRegionServer
5.HBase的WebUI
(六)HBase的逻辑结构:
(七)HBase基本命令
1.进入HBase
2.查看HBase版本信息
3.查看命名空间
4.查看'hbase'这一命名空间的所有表
5.查看默认命名空间
6.创建命名空间
7.删除命名空间
(七)关闭HBase
1.关闭hbase
2.关闭zookeeper
3.关闭hadoop
一、安装HBase前置环境
1.jdk
参考博文《Shell脚本之——自动安装JDK》
2.hadoop
参考博文《Shell脚本之——Hadoop3单机版安装》
3.zookeeper
zookeeper安装脚本
vim autoinstall.sh
#! /bin/bash
echo 'auto install begining...'
# global var
zk=true
hostname=`hostname`
if [ "$zk" = true ];then
echo 'zookeeper install set true'
echo 'setup zookeeper-3.4.5-cdh5.14.2.tar.gz'
tar -zxf /opt/install/zookeeper-3.4.5-cdh5.14.2.tar.gz -C /opt/soft/
mv /opt/soft/zookeeper-3.4.5-cdh5.14.2 /opt/soft/zk345
cp /opt/soft/zk345/conf/zoo_sample.cfg /opt/soft/zk345/conf/zoo.cfg
mkdir -p /opt/soft/zk345/datas
sed -i '12c dataDir=/opt/soft/zk345/datas' /opt/soft/zk345/conf/zoo.cfg
echo "server.0=$hostname:2287:3387" >> /opt/soft/zk345/conf/zoo.cfg
echo "0" > /opt/soft/zk345/datas/myid
sed -i '73a\export PATH=$PATH:$ZOOKEEPER_HOME/bin' /etc/profile
sed -i '73a\export ZOOKEEPER_HOME=/opt/soft/zk345' /etc/profile
sed -i '73a\# ZOOKEEPER_HOME' /etc/profile
echo 'setup zookeeper success!!!'
fi
二、安装HBase步骤
(一)解压
[root@lxm147 soft]# tar -zxf /opt/install/hbase-2.3.5-bin.tar.gz -C /opt/soft/
(二)修改文件名
[root@lxm147 soft]# mv hbase-2.3.5-bin.tar.gz/ hbase235
[root@lxm147 soft]# ll
total 8
drwxr-xr-x. 2 root root 6 Mar 4 09:01 flumetest
drwxr-xr-x. 12 root root 189 Feb 17 10:04 hadoop313
drwxr-xr-x. 7 root root 182 Mar 6 11:45 hbase235
drwxr-xr-x. 10 root root 184 Feb 16 09:13 hive312
drwxr-xr-x. 8 10143 10143 273 Dec 16 2021 jdk180
drwxr-xr-x. 14 501 wheel 4096 Mar 4 22:48 zeppelin
drwxr-xr-x. 14 root root 4096 Mar 28 2018 zookeeper345
(三)修改配置文件
[root@lxm147 conf]# pwd
/opt/soft/hbase235/conf
[root@lxm147 conf]# vim hbase-env.sh
27 # The java implementation to use. Java 1.8+ required.
28 export JAVA_HOME=/opt/soft/jdk180
125 # Tell HBase whether it should manage it's own instance of ZooKeeper or not.
126 export HBASE_MANAGES_ZK=false
[root@lxm147 conf]# vim hbase-site.xml
<property>
<name>hbase.rootdir</name>
<value>hdfs://192.168.180.147:9000/hbase</value>
</property>
<property>
<name>hbzse.zookeeper.property.dataDir</name>
<value>/opt/soft/zookeeper345/datatmp</value>
</property>
<property>
<name>hbzse.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
<property>
<name>hbzse.zookeeper.property.dataDir</name>
<value>/opt/soft/zookeeper345/datatmp</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.tmp.dir</name>
<value>/opt/soft/hbase235/tmp</value>
</property>
<property>
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
</property>
(四)配置HBase的环境变量
# HBASE_HOME
export HBASE_HOME=/opt/soft/hbase235
export PATH=$PATH:$HBASE_HOME/bin
source /etc/profile
(五)启动HBase
1.启动hadoop
start-dfs.sh
start-yarn.sh
2.启动zookeeper
zkServer.sh start
3.启动hbase
start-hbase.sh
4.jps出现HMaster和HRegionServer
5.HBase的WebUI
localhost:16010
文章来源:https://www.toymoban.com/news/detail-471593.html
(六)HBase的逻辑结构:
文章来源地址https://www.toymoban.com/news/detail-471593.html
(七)HBase基本命令
1.进入HBase
[root@lxm147 ~]# hbase shell
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/soft/hadoop313/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/soft/hbase235/lib/client-facing-thirdparty/slf4j-log4j12-1.7.30.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
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.3.5, rfd3fdc08d1cd43eb3432a1a70d31c3aece6ecabe, Thu Mar 25 20:50:15 UTC 2021
Took 0.0014 seconds
2.查看HBase版本信息
hbase(main):001:0> version
2.3.5, rfd3fdc08d1cd43eb3432a1a70d31c3aece6ecabe, Thu Mar 25 20:50:15 UTC 2021
Took 0.0003 seconds
3.查看命名空间
hbase(main):002:0> list_namespace
NAMESPACE
default
hbase
2 row(s)
Took 0.6574 seconds
4.查看'hbase'这一命名空间的所有表
hbase(main):004:0> list_namespace_tables 'hbase'
TABLE
meta
namespace
2 row(s)
Took 0.0310 seconds
=> ["meta", "namespace"]
5.查看默认命名空间
hbase(main):005:0> list_namespace_tables 'default'
TABLE
0 row(s)
Took 0.0156 seconds
=> []
6.创建命名空间
hbase(main):008:0> create_namespace 'test'
Took 0.2250 seconds
hbase(main):009:0> list_namespace
NAMESPACE
default
hbase
test
3 row(s)
Took 0.0347 seconds
7.删除命名空间
hbase(main):010:0> drop_namespace 'test'
Took 0.2295 seconds
hbase(main):011:0> list_namespace
NAMESPACE
default
hbase
2 row(s)
Took 0.0189 seconds
(七)关闭HBase
1.关闭hbase
stop-hbase.sh
2.关闭zookeeper
zkServer.sh stop
3.关闭hadoop
stop-dfs.sh
stop-yarn.sh
到了这里,关于HBase单机版安装详细步骤的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!