8.1. 基本分布式 HBase 安装

在下文内容中是一个分布式 10 节点的群集的基本配置示例:其中,节点被命名为 example0,example1...一直到 example9,在这个例子中;HBase Master 和 HDFS NameNode 正在节点 example0 上运行;RegionServers 在节点 example1- example9 上运行;一个 3 节点 ZooKeeper 集合运行在 example1、example2,以及 example3 的默认端口上;ZooKeeper 的数据被保存到:_/export/zookeeper_r。

下面我们显示在 HBase conf 目录中找到的主要配置文件 hbase-site.xml, regionservers, and hbase-env.sh

8.1.1. hbase-site.xml

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
  <property>
    <name>hbase.zookeeper.quorum</name>
    <value>example1,example2,example3</value>
    <description>The directory shared by RegionServers.
    </description>
  </property>
  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/export/zookeeper</value>
    <description>Property from ZooKeeper config zoo.cfg.
    The directory where the snapshot is stored.
    </description>
  </property>
  <property>
    <name>hbase.rootdir</name>
    <value>hdfs://example0:8020/hbase</value>
    <description>The directory shared by RegionServers.
    </description>
  </property>
  <property>
    <name>hbase.cluster.distributed</name>
    <value>true</value>
    <description>The mode the cluster will be in. Possible values are
      false: standalone and pseudo-distributed setups with managed ZooKeeper
      true: fully-distributed with unmanaged ZooKeeper Quorum (see hbase-env.sh)
    </description>
  </property>
</configuration>

8.1.2. regionservers

在此文件中列出将运行 RegionServers 的节点。在我们的例子中,这些节点是 example1- example9。

example1
example2
example3
example4
example5
example6
example7
example8
example9

8.1.3. hbase-env.sh

hbase-env.sh 文件中的以下行显示了如何设置JAVA_HOME环境变量(HBase 需要的)并将堆设置为 4 GB(而不是默认值 1 GB)。如果您复制并粘贴此示例,请务必调整JAVA_HOME以适合您的环境。

# The java implementation to use.
export JAVA_HOME=/usr/java/jdk1.8.0/

# The maximum amount of heap to use. Default is left to JVM default.
export HBASE_HEAPSIZE=4G

使用 rsync 将 conf 目录的内容复制到群集的所有节点。