HBase的选型和单节点安装

环境

  1. 下载地址: http://archive.cloudera.com/cdh5/cdh/5/

  2. 前提条件

    hadoop-2.6.0-cdh5.16.2
    zookeeper-3.4.5-cdh5.16.2

  3. 版本选择

    5.x 1.2.0+cdh5.16.2
    6.x 2.1.0+cdh6.3.1

安装

  1. 跳过tar包解压等步骤,修改 hbase-site.xml 文件

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

    <configuration>
    <!--hbase.rootdir的前端与$HADOOP_HOME/conf/core-site.xml的fs.defaultFS一致 -->
    <property>
    <name>hbase.rootdir</name>
    <value>hdfs://ruozedata001:9000/hbase</value>
    </property>
    <property>
    <name>hbase.cluster.distributed</name>
    <value>true</value>
    </property>

    <!--本地文件系统的临时文件夹。可以修改到一个更为持久的目录上。(/tmp会在重启时清除) -->
    <property>
    <name>hbase.tmp.dir</name>
    <value>/home/hadoop/tmp/hbase</value>
    </property>

    <!--如果只设置单个 Hmaster,那么 hbase.master 属性参数需要设置为 master:60000 (主机名:60000) -->
    <!--如果要设置多个 Hmaster,那么我们只需要提供端口 60000,因为选择真正的 master 的事情会有 zookeeper 去处理 -->
    <property>
    <name>hbase.master</name>
    <value>60000</value>
    </property>

    <!--这个参数用户设置 ZooKeeper 快照的存储位置,默认值为 /tmp,显然在重启的时候会清空。因为笔者的 ZooKeeper 是独立安装的,所以这里路径是指向了 $ZOOKEEPER_HOME/conf/zoo.cfg 中 dataDir 所设定的位置 -->
    <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/home/hadoop/tmp/zookeeper</value>
    </property>

    <property>
    <name>hbase.zookeeper.quorum</name>
    <value>ruozedata001</value>
    </property>
    <!--表示客户端连接 ZooKeeper 的端口 -->
    <property>
    <name>hbase.zookeeper.property.clientPort</name>
    <value>2181</value>
    </property>
    <!--ZooKeeper 会话超时。Hbase 把这个值传递改 zk 集群,向它推荐一个会话的最大超时时间 -->
    <property>
    <name>zookeeper.session.timeout</name>
    <value>120000</value>
    </property>

    <!--当 regionserver 遇到 ZooKeeper session expired , regionserver 将选择 restart 而不是 abort -->
    <property>
    <name>hbase.regionserver.restart.on.zk.expire</name>
    <value>true</value>
    </property>

    <!-- 以下是phoenix的参数 占时用不到
    <property>
    <name>hbase.table.sanity.checks</name>
    <value>false</value>
    </property>
    <property>
    <name>hbase.regionserver.wal.codec</name>
    <value>org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec</value>
    </property>
    <property>
    <name>phoenix.schema.isNamespaceMappingEnabled</name>
    <value>true</value>
    </property>
    <property>
    <name>phoenix.schema.mapSystemTablesToNamespace</name>
    <value>true</value>
    </property>

    <!--
    <property>
    <name>phoenix.query.dateFormatTimeZone</name>
    <value>Asia/Shanghai</value>
    </property>
    -->


    <property>
    <name>hbase.online.schema.update.enable</name>
    <value>true</value>
    </property>

    <property>
    <name>hbase.coprocessor.abortonerror</name>
    <value>false</value>
    </property>
    </configuration>
  2. 修改hbase-env.sh

    # The directory where pid files are stored. /tmp by default.
    export HBASE_PID_DIR=/home/hadoop/tmp
  3. 修改regionservers

    ruozedata001
  4. 启动

    bin/start-hbase.sh
  5. 查看hbase的端口

    [hadoop@ruozedata001 hbase]$ netstat -nlp|grep xxxxx
    (Not all processes could be identified, non-owned process info
    will not be shown, you would have to be root to see it all.)
    tcp6 0 0 :::60010 :::* LISTEN 10579/java
    tcp6 0 0 192.168.0.3:60000 :::* LISTEN 10579/java
    [hadoop@ruozedata001 hbase]$ netstat -nlp|grep 10748
    (Not all processes could be identified, non-owned process info
    will not be shown, you would have to be root to see it all.)
    tcp6 0 0 192.168.0.3:60020 :::* LISTEN 10748/java
    tcp6 0 0 :::60030 :::* LISTEN 10748/java
  6. 查看web界面

    http://ruozedata001:60010/master-status
Author: Tunan
Link: http://yerias.github.io/2020/07/21/hbase/1/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.