CentOS 7镜像准备一台,安装java环境
hbase默认是强依赖zookeeper的,但是在部署单机版hbase的时候,不需要额外独立部署zookeeper,
他会自己在一台机器上启动hbase和zookeeper的,此时不需要hdfs,hbase自动把数据写入本地磁盘里
在服务器上启动一个单机版本的hbase,说白了就是启动一个hbase的jvm进程
1.从网上下载最新版本的包,上传虚拟机
进入
解压
2.配置java_home 环境变量
修改conf/hbase-site.sh 这是核心配置文件
找到java安装路径:
[root@MiWiFi-R4CM-srv java]# find / -name "java"
/etc/pki/ca-trust/extracted/java
/etc/pki/java
/etc/java
/etc/alternatives/java
/var/lib/alternatives/java
/usr/bin/java
/usr/lib/java
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64/jre/bin/java
我用echo $JAVA_HOME 都没输出出来东西。
yum安装jdk找不到安装目录问题||没有java环境变量 -
hbase-site.xml 文件修改
这里主要是基于你的机器情况,设置一下hbase和zookeeper基于的数据目录,告诉他们数据写入到哪个目录里去,下面就是一份最小化配置示例
<configuration>
<property>
<!--文件存在哪里-->
<name>hbase.rootdir</name>
<value>file:///usr/local/data/hbase</value>
</property>
<property>
<!--单机版zookeeper-->
<name>hbase.zookeeper.property.dataDir</name>
<value>/usr/local/data/zookeeper</value>
</property>
<property>
<!--配置本地磁盘配置-->
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
<description>
Controls whether HBase will check for stream capabilities (hflush/hsync).
Disable this if you intend to run on LocalFileSystem, denoted by a rootdir
with the 'file://' scheme, but be mindful of the NOTE below.
WARNING: Setting this to false blinds you to potential data loss and
inconsistent system state in the event of process and/or node failures. If
HBase is complaining of an inability to use hsync or hflush it's most
likely not a false positive.
</description>
</property>
</configuration>
调用start-hbase.sh
penJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
running master, logging to /root/hbase/bin/../logs/hbase-root-master-MiWiFi-R4CM-srv.out
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
提示jvm有些需要调整不影响启动
访问启动的服务的ip+16010端口
http://192.168.31.117:16010/master-status
./hbase shell
进入命令行进行操作
作者:三号小玩家