CDH实操--hive高可用

二龙2年前技术文章1547

前言

在CDH中,hive metastore、hiveserver2若角色单实例部署,或者部署多个实例但是连接配置任选其一的话,均存在单点问题,一旦实例故障就会影响业务稳定;这时我们就好考虑高可用部署:hive metastore较简单,一般部署2个实例即可;hiveserver2的高可用,有多种方法,这里介绍了zk以及haproxy两种实现方式。

1、Hive配置调整(metastore高可用配置)

001.png

2、配置Hive-site.xml文件(页面配置hiveserver2高可用)

002.png

修改完成后重启两个过期事例

3、验证

3.1、进入zk,可以看到对于的叶子节点上有hiveserver2的高可用配置,如下:

003.png

3.2、hiveserver2链接方式通过zk连接:

004.png

3.3、hivemetastore的高可用(重启后可以看到配置里有多个url,默认使用第一个):

005.png

4、配置haproxy的高可用

安装:yum -y install haproxy

[root@cdh02 haproxy]# cat haproxy.cfg 
#---------------------------------------------------------------------
# Example configuration for a possible web application.  See the
# full configuration options online.
#
#   http://haproxy.1wt.eu/download/1.4/doc/configuration.txt
#
#---------------------------------------------------------------------

#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
    # to have these messages end up in /var/log/haproxy.log you will
    # need to:
    #
    # 1) configure syslog to accept network log events.  This is done
    #    by adding the '-r' option to the SYSLOGD_OPTIONS in
    #    /etc/sysconfig/syslog
    #
    # 2) configure local2 events to go to the /var/log/haproxy.log
    #   file. A line like the following can be added to
    #   /etc/sysconfig/syslog
    #
    #    local2.*                       /var/log/haproxy.log
    #
    log         127.0.0.1 local2

    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon

    # turn on stats unix socket
    stats socket /var/lib/haproxy/stats

#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 3000

#--------------------------------------------------------------------------
# 定义管理界面
#--------------------------------------------------------------------------
listen stats :1080
        balance
        stats enable
        stats uri /stats
        stats refresh 30s
        stats auth admin:admin

#--------------------------------------------------------------------------
# 代理配置
#--------------------------------------------------------------------------
listen jdbchive :25005
       timeout connect 10s #连接超时时间,重要,hive查询数据能返回结果的保证
       balance leastconn
           option tcplog
       timeout client 2h   #同上
       timeout server 2h   #同上
       mode tcp
           server hiveServer1 cdh01:10000 check
           server hiveServer2 cdh03:10000 check

006.png

启动haproxy

systemctl start haproxy

systemctl enable haproxy

cdh上的配置:

007.png

验证页面:

008.png

009.png


相关文章

CDH实操--客户端安装

CDH实操--客户端安装

概述安装CDH客户端,主要是方便在CDH部署节点以外,通过客户端的方式连接CDH上的hdfs,hive和hbase服务1、安装jdk(适配CDH即可,一般1.8)2、获取安装包3、部署安装包把安装包解...

CDH实操--集成 freeipa

CDH实操--集成 freeipa

1 概述环境准备: 1)安装cdh6.2.1 2)安装FreeIPA,server和client(在所有cdh节点)2 集成2.1 krb5.conf修改注释:default_ccache_nam...

Hdfs3.x新特性详解

Hdfs3.x新特性详解

HDFS Disk Balancer(磁盘均衡器)HDFS Disk Balancer与HDFS Balancer的区别?两者都是实现负载均衡功能HDFS Balancer是之前Hadoop2.x中本...

大数据监控系列(二)——Prometheus+Grafana在CDH使用实践(包含Altermanager告警)

大数据监控系列(二)——Prometheus+Grafana在CDH使用实践(包含Altermanager告警)

1 概述我们之前在《大数据监控系列(一)——Promehteus+Grafana监控概述》中对Promehteus和Grafana的基本概念做了介绍,这里将介绍Promehteus和Grafana在c...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。