Ubuntu上的Hbase集群搭建

解压:

tar -zxvf /home/hadoop/桌面/hbase-2.2.6-bin.tar.gz

移动位置并改名:

su
mv /home/hadoop/hbase-2.2.6 /usr/local/Hbase
更新文件夹所有者
cd /usr/local/
chown -R hadoop:hadoop ./Hbase

配置环境:

复制代码
echo "export PATH=/usr/local/Hbase/bin:$PATH" >> /etc/bash.bashrc
echo "export HBASE_HOME=/usr/local/Hbase" >> /etc/bash.bashrc source /etc/bash.bashrc exit cd /usr/local/Hbase/ echo "export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/" >> conf/hbase-env.sh cd ~ sudo vim /etc/profile
复制代码

在profile的末尾添加

export HBASE_HOME=usr/local/Hbase
export PATH=$HBASE_HOME/bin:$PATH

修改配置文件:

cd /usr/local/Hbase/conf
vim hbase-env.sh

最下面的两行应该是:(前面如果配置了环境应该是只有第一行,那么只需要加入第二行就行了)

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/
export HBASE_MANAGES_ZK=false

保存退出

vim hbase-site.xml

修改如下:

复制代码
<configuration>
  <!--
    The following properties are set for running HBase as a single process on a
    developer workstation. With this configuration, HBase is running in
    "stand-alone" mode and without a distributed file system. In this mode, and
    without further configuration, HBase and ZooKeeper data are stored on the
    local filesystem, in a path under the value configured for `hbase.tmp.dir`.
    This value is overridden from its default value of `/tmp` because many
    systems clean `/tmp` on a regular basis. Instead, it points to a path within
    this HBase installation directory.

    Running against the `LocalFileSystem`, as opposed to a distributed
    filesystem, runs the risk of data integrity issues and data loss. Normally
    HBase will refuse to run in such an environment. Setting
    `hbase.unsafe.stream.capability.enforce` to `false` overrides this behavior,
    permitting operation. This configuration is for the developer workstation
    only and __should not be used in production!__

    See also https://hbase.apache.org/book.html#standalone_dist
  -->
  <property>
    <name>hbase.cluster.distributed</name>
    <value>true</value>
  </property>
  <property>
     <!-- 指定 hbase 在 HDFS 上的存储位置 -->
    <name>hbase.rootdir</name>
    <value>hdfs://master:9000/hbase</value>
  </property>
    <property>
        <!-- 指定 zookeeper 的地址-->
        <name>hbase.zookeeper.quorum</name>
        <value>master:2181,slave1:2181,slave2:2181,slave3:2181</value>
    </property>
  <property>
    <name>hbase.tmp.dir</name>
    <value>./tmp</value>
  </property>
  <property>
    <name>hbase.unsafe.stream.capability.enforce</name>
    <value>false</value>
  </property>
</configuration>
复制代码

保存退出

原文地址:https://www.cnblogs.com/studya/p/14204073.html