美文网首页linux那些事儿
centos7下安装hbase单机版

centos7下安装hbase单机版

作者: yeah青没素 | 来源:发表于2018-11-29 11:42 被阅读0次

        本文只在单机上安装hbase做测试,不涉及集群的搭建。

        首先,hbase需要java环境,如果没有安装好的话,可以查看本系列的文章centos7下yum安装jdk并配置环境变量 

        1. 下载hbase的安装包,下载地址:apache网站。选择一个仓库,进入下载对应版本的bin安装包。

2. 将下载好的安装包通过ssh工具上传到centos上,并将其解压,并重命名文件夹。

[root@localhost home]# tar -zxvf hbase-3.1.1.bin.tar.gz

[root@localhost home]# mv hbase-3.1.1 hbase

3. 编辑hbase-env.sh 文件,为hbase配置JAVA_HOME路径

如果你已经配置好JAVA_HOME的话,可以这样查看。

[root@localhost home]# echo $JAVA_HOME

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el7_5.x86_64

[root@localhost hbase]# vi conf/hbase-env.sh

export HBASE_MANAGES_ZK=true 表示使用自带的zookeeper

去掉下面红框中的注释,并将JAVA_HOME配置为你的JAVA_HOME。

其他保持默认配置,就可以保存退出了。

编辑 conf/hbase-site.xml

<?xml version="1.0"?>

<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>

        <property>

                <name>hbase.rootdir</name>

                <value>file:///usr/hbase-release/rootdir</value>

                <description>The directory shared byregion servers.</description>

        </property>

        <property>

                <name>fs.defaultFS</name>

                <value>file:///usr/hbase-release/dfs</value>

        </property>

        <!-- hbase的端口 -->

        <property>

                <name>hbase.zookeeper.property.clientPort</name>

                <value>2181</value>

                <description>Property from ZooKeeper'sconfig zoo.cfg. The port at which the clients will connect.

        </description>

        </property>

        <!--  超时时间 -->

        <property>

                <name>zookeeper.session.timeout</name>

                <value>120000</value>

        </property>

        <!--  zookeeper 集群配置。如果是集群,则添加其它的主机地址 -->

        <property>

                <name>hbase.zookeeper.quorum</name>

                <value>192.168.130.xxx:2181</value>

        </property>

        <property>

                <name>hbase.tmp.dir</name>

                <value>/usr/hbase-release/tmp</value>

        </property>

        <property>

                <name>hbase.cluster.distributed</name>

                <value>false</value>

        </property>

        <property>

                <name>hbase.zookeeper.property.dataDir</name>

                <value>/usr/hbase-release/datadir</value>

        </property>

        <property>

                <name>zookeeper.znode.parent</name>

                <value>/hbase</value>

        </property>

</configuration>

4. 启动测试

a. 启动

[root@localhost hbase]# ./bin/start-hbase.sh

启动如果遇到错误,可以检查一下虚拟机cpu的核心数,貌似至少得双核以上才能起得来。

启动成功会显示如下画面。

上面两个警告因为安装的是jdk的1.8版本,可以按照这个方法解决。

b.启动shell

[root@localhost hbase]# ./bin/hbase shell

c.查看所有表

hbase(main):005:0> list

d. 删除表

hbase(main):005:0> disable 'test'

hbase(main):005:0> drop 'test'

相关文章

网友评论

    本文标题:centos7下安装hbase单机版

    本文链接:https://www.haomeiwen.com/subject/nvyxcqtx.html