zoukankan      html  css  js  c++  java
  • Hbase集群模式搭建

    1.官网下载hbase安装包

    这里不做赘述。

    2.解压---直接tar -zxvf xxxx

    3.配置hbase集群,要修改3个文件(首先zk集群已经安装好了)
    注意:要把hadoop的hdfs-site.xml和core-site.xml 放到hbase/conf下

    3.1修改hbase-env.sh
    export JAVA_HOME=/usr/java/jdk1.8
    //告诉hbase使用外部的zk
    export HBASE_MANAGES_ZK=false

    vim hbase-site.xml

    <configuration>
    <!-- 指定hbase在HDFS上存储的路径 -->
    <property>
    <name>hbase.rootdir</name>
    <value>hdfs://ns1/hbase</value>
    </property>
    <!-- 指定hbase是分布式的 -->
    <property>
    <name>hbase.cluster.distributed</name>
    <value>true</value>
    </property>
    <!-- 指定zk的地址,多个用“,”分割 -->
    <property>
    <name>hbase.zookeeper.quorum</name>
    <value>itcast04:2181,itcast05:2181,itcast06:2181</value>
    </property>
    </configuration>

    vim regionservers

    itcast03
    itcast04
    itcast05
    itcast06

    3.2拷贝hbase到其他节点

    scp -r /itcast/hbase-0.96.2-hadoop2/ itcast02:/itcast/
    scp -r /itcast/hbase-0.96.2-hadoop2/ itcast03:/itcast/
    scp -r /itcast/hbase-0.96.2-hadoop2/ itcast04:/itcast/
    scp -r /itcast/hbase-0.96.2-hadoop2/ itcast05:/itcast/
    scp -r /itcast/hbase-0.96.2-hadoop2/ itcast06:/itcast/

    4.将配置好的HBase拷贝到每一个节点并同步时间。

    5.启动所有的hbase
    分别启动zk
    ./zkServer.sh start
    启动hbase集群
    start-dfs.sh
    启动hbase,在主节点上运行:
    start-hbase.sh
    6.通过浏览器访问hbase管理页面
    192.168.1.133:60010
    7.为保证集群的可靠性,要启动多个HMaster
    hbase-daemon.sh start master
    Hmaster不启动
    hbase-site.xml增加配置

    <property>
    <name>hbase.unsafe.stream.capability.enforce</name>
    <value>false</value>
    </property>

    8.启动异常:

    java.lang.IllegalStateException: The procedure WAL relies on the ability to hsync for proper operation during component failures, but the underlying filesystem does not support doing so. Please check the config value of 'hbase.procedure.store.wal.use.hsync' to set the desired level of robustness and ensure the config value of 'hbase.wal.dir' points to a FileSystem mount that can provide it.

    hbase-site.xml增加配置 

    <property>
    <name>hbase.unsafe.stream.capability.enforce</name>
    <value>false</value>
    </property>

    9.idea javaapi 连接本地hbase超时

    hbase-site.xml增加配置

    <property>
    <name>hbase.master.ipc.address</name>
    <value>0.0.0.0</value>
    </property>
    <property>
    <name>hbase.regionserver.ipc.address</name>
    <value>0.0.0.0</value>
    </property>

     10.Hbase集群可能会因为时间不同步出现各种问题,我们要配置linux时间同步

    在各个节点安装ntp服务

    yum -y install ntp

    在所有节点设置时区,中国所用的时区为

    timedatectl set-timezone Asia/Shanghai

    在master节点更改ntp.conf文件,设置server为其自身,再新增restrict表示可接受网段

    # vim /etc/ntp.conf

    重启ntp服务

    systemctl restart ntpd

    在client节点设置ntp服务器ip

    # vim /etc/ntp.conf

     每个client节点同步server时间

    ntpdate master 或者 ntpdate 192.168.60.10

    每个client节点启动ntpd服务

    # systemctl start ntpd
    
    # systemctl enable ntpd

    所有节点时间同步

    # timedatectl set-ntp yes

  • 相关阅读:
    CSU 1554 SG Value —— 思维
    最优配对问题(集合上的动态规划) —— 状压DP
    Codeforces Round #374 (Div. 2) D. Maxim and Array —— 贪心
    Codeforces Round #373 (Div. 2) C. Efim and Strange Grade —— 贪心 + 字符串处理
    Codeforces Round #369 (Div. 2) D. Directed Roads —— DFS找环 + 快速幂
    Codeforces Round #374 (Div. 2) C. Journey —— DP
    Codeforces Round #363 (Div. 2) D. Fix a Tree —— 并查集
    Codeforces Round #374 (Div. 2) B. Passwords —— 基础题
    Codeforces Round #374 (Div. 2) A. One-dimensional Japanese Crossword —— 基础题
    UVA10129 Play on Words —— 欧拉回路
  • 原文地址:https://www.cnblogs.com/jake-jin/p/11435291.html
Copyright © 2011-2022 走看看