Hiveserver2 HA配置(nginx)
一.安装编译nginx
1. 安装PCRE
PCRE 作用是让 Nginx 支持 Rewrite 功能。
wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
[root@test src]# tar zxvf pcre-8.35.tar.gz
[root@test src]# cd pcre-8.35
[root@test pcre-8.35]# ./configure
[root@test pcre-8.35]# make && make install
[root@test pcre-8.35]# pcre-config --version
说明安装成功
2. 安装1.9.0 nginx
下载地址 http://nginx.org/download/
解压nginx 开始编译
cd nginx-1.9.0
./configure --prefix=/usr/local/nginx --with-stream --without-http_gzip_module --with-pcre=/root/pcre-8.35
make && make install
启动nginx
/usr/local/nginx/sbin/nginx
访问192.168.38.149 出现如下网页说明nginx编译成功
二.配置hive HA
1. 配置nginx
vim /usr/local/nginx/conf/nginx.conf
stream {
upstream beeline {
server test3:10000;
server test4:10000;
}
server {
listen 8686;
proxy_pass beeline;
}
}
2. 重启nginx
/usr/local/nginx/sbin/nginx -s reopen
3. 测试hive连接 使用jdbc去连接hive端口
beeline -nhdfs -phdfs -ujdbc:hive2://test4:8686
如上说明test4:8686 已经转发到test3:10000 上去了,测试hive的高可用