背景需求
hive 在离线分析,数仓中是最常用的工具,业务人员不需要熟悉mr,编程基础就可以通过sql操作数据。hive 的性能及稳定性在生产中必须保证。hive可以通过HAPROXY进行多节点负载均衡来达到目的。、
近期现场环境cdh hadoop平台nn1 所在节点 机器故障,由于hdfs做了HA,namenode自动切换到了nn2,但是hive sql任务配置的连接都是nn1:10000 ,所以任务都出了问题。故决定启用hive Ha
前提环境准备
可用的基于cdh搭建的hadoop集群,并且Hdfs 、yarn、hive等安装完毕可用,cloudera manager可用,hdfsHa可用
进行配置
进入hive服务配置,添加两个及以上的hive metastore和server

直接安装

报错
改用 yum -y install haproxy --nogpgcheck 命令:

修改配置
/etc/haproxy/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

本文讲述了如何在CDH Hadoop集群中配置Hive的高可用性,解决因nn1节点故障导致的Hive SQL连接问题。涉及Hive metastore和server的设置,使用HAPROXY进行负载均衡,以及关键配置参数的调整,如最大连接数和超时时间。
最低0.47元/天 解锁文章
696





