Impala配置HA-Nginx
Impala的高可用配置,官方的例子用的是Haproxy,考虑到nginx配置简单,使用人群广泛,再加上nginx1.9以后支持TCP的负载均衡,所以选用nginx。
nginx安装:yum install -y nginx,安装地址:192.168.101.22
Impala Daemon实例有三个:cdh-t-004,cdh-t-005,cdh-t-006
配置,编辑文件 /etc/nginx/nginx.conf:
# For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; # Load dynamic modules. See /usr/share/nginx/README.dynamic. include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; } stream{ upstream impalajdbc { hash $remote_addr consistent; server cdh-t-004:21050; server cdh-t-005:21050; server cdh-t-006:21050; } upstream impala { least_conn; server cdh-t-004:21000; server cdh-t-005:21000; server cdh-t-006:21000; } server { listen 25003; proxy_timeout 30s; proxy_pass impala; } server { listen 21051; proxy_timeout 30s; proxy_pass impalajdbc; } }
校验配置文件是否正确:nginx -t
启动nginx:service nginx start
使用:
impala-shell -i 192.168.101.22:25003
注: Impala守护进程Beeswax端口21000映射到Nginx 25003
Impala守护进程HiveServer2端口21050映射到Nginx 21051
遇到的问题:
安装配置成功后,使用impala-shell时报错【2018/01/24 18:36:38 [crit] 10653#0: *13 connect() to 192.168.101.20:21000 failed (13: Permission denied) while connecting to upstream, client: 192.168.101.22, server: 0.0.0.0:25003, upstream: "192.168.101.20:21000", bytes from/to client:0/0, bytes from/to upstream:0/0】
分析:权限问题,impala主机无防火墙,需要修改SETLINUX配置
解决:执行命令【setenforce 0】,此命令修改的内容,在机器重启后会丢失,最好是修改配置文件【/etc/selinux/config】-> SELINUX=disabled,重启生效。