美文网首页
hbase完全分布式安装

hbase完全分布式安装

作者: LI木水 | 来源:发表于2019-07-07 23:14 被阅读0次

完全分布式部署(Fully Distributed)

准备

jdk版本,看下图我们需要至少1.8版本的jdk

HBase Version JDK 7 JDK 8 JDK 9 (Non-LTS) JDK 10 (Non-LTS) JDK 11
2.0+ No Yes HBASE-20264 HBASE-20264 HBASE-21110
1.2+ Yes Yes HBASE-20264 HBASE-20264 HBASE-21110

节点规划

主机 Master RegionServer backup master
hdfs-01 Yes No No
hdfs-02 No Yes No
hdfs-03 No Yes Yes
hdfs-04 No Yes Yes

下载

wget http://mirrors.tuna.tsinghua.edu.cn/apache/hbase/1.3.5/hbase-1.3.5-bin.tar.gz

解压

tar -zxvf hbase-1.3.5-bin.tar.gz -C /data/servers/

配置

进入配置文件夹并修改文件hbase-env.sh

cd /data/servers/hbase-1.3.5/conf/

vim hbase-env.sh
# Set environment variables here.
# The java implementation to use.
export JAVA_HOME=/data/java/jdk1.8.0_111
# 不使用自带的ZK,因为已经有了一个zookeeper集群,直接使用就行了
export HBASE_MANAGES_ZK=false

编辑hbase-site.xml

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
/**
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-->
<configuration>
<!-- 在hdfs的存储rootdir -->
  <property>
    <name>hbase.rootdir</name>
    <value>hdfs://hdfs-01:8020/hbase</value>
  </property>
<!-- zk地址-->
<property>
  <name>hbase.zookeeper.quorum</name>
  <value>web-app-02:2181,hdfs-01:2181,hdfs-02:2181</value>
</property>
  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/data/servers/data_hbase_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>
<!-- 分布式模式 -->
<property>
  <name>hbase.cluster.distributed</name>
  <value>true</value>
</property>
</configuration>

设置备份master

编辑backup-masters文件(需手动创建)

vim backup-masters
#往里面添加
hdfs-03
hdfs-04

设置regionservers

vim regionservers
#往里面添加
hdfs-02
hdfs-03
hdfs-04

设置Hadoop的conf/hdfs-site.xml文件中dfs.datanode.max.transfer.threads参数,修改dfs.datanode.max.transfer.threads = 4096 (如果运行hbase的话建议为16384),指定用于在DataNode间传输block数据的最大线程数,老版本的对应参数为dfs.datanode.max.xcievers

<property>
  <name>dfs.datanode.max.transfer.threads</name>
  <value>16384</value>
</property>

将配置好的hbase scp到其他主机

scp -r hbase-1.3.5/ hdfs-02:$PWD
scp -r hbase-1.3.5/ hdfs-03:$PWD
scp -r hbase-1.3.5/ hdfs-04:$PWD

在hdfs-01启动hbase

bin/start-hbase.sh

查看进程

jps -l
24864 org.apache.zookeeper.server.quorum.QuorumPeerMain
25920 org.apache.hadoop.hdfs.server.datanode.DataNode
15936 org.apache.hadoop.hbase.master.HMaster
51937 org.apache.flink.runtime.taskexecutor.TaskManagerRunner
26435 org.apache.hadoop.hdfs.tools.DFSZKFailoverController
31942 org.apache.hadoop.hdfs.server.namenode.NameNode
22602 org.apache.hadoop.util.RunJar
27466 org.apache.hadoop.yarn.server.nodemanager.NodeManager
8501 sun.tools.jps.Jps

访问master节点web界面

http://hdfs-01:16010

shell 访问hbase

root@hdfs-01:/data/servers/hbase-1.3.5# bin/hbase shell
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/data/servers/hbase-1.3.5/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/data/servers/hadoop-2.6.0-cdh5.14.0/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 1.3.5, rb59afe7b1dc650ff3a86034477b563734e8799a9, Wed Jun  5 15:57:14 PDT 2019
hbase(main):001:0> create 'test', 'cf'
0 row(s) in 1.4310 seconds

=> Hbase::Table - test
hbase(main):002:0> list 'test'
TABLE
test
1 row(s) in 0.0180 seconds

=> ["test"]


相关文章

网友评论

      本文标题:hbase完全分布式安装

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