Community Articles
Find and share helpful community-sourced technical articles
Labels (2)

Documentation referred:

Environment Information:


[ hivenv ] >> Cluster name >> >> Ambari Server >> >> Existing Ranger Admin >> >> Load Balancer >> >> Additional Ranger Admin

      # hadoop version
 Subversion -r5cc60e0003e33aa98205f18bccaeaf36cb193cc
 Compiled by jenkins on 2015-09-30T18:08Z
 Compiled with protoc 2.5.0
 From source with checksum 69a3bf8c667267c2c252a54fbbf23d
 This command was run using /usr/hdp/
      # uname -a
 Linux 3.10.0-327.13.1.el7.x86_64 #1 SMP Thu Mar 31 16:04:38 UTC 2016
x86_64 x86_64 x86_64 GNU/Linux
      # cat /etc/redhat-release
 CentOS release 6.7 (Final)

Steps to be followed:

  • Install the Ranger Admin component on the hosts you wish to use – For information about installing Ranger over Ambari, see Installing Ranger Over Ambari 2.0 .
  • Configure a load balancer to balance the loads among the various Ranger Admin instances and take note of the load balancer URL.

Step 1: Before Installing HAProxy on the server we need to install epel repository on our system depending on our operating system version using following command.

 CentOS/RHEL 5 , 32 bit:
 # rpm -Uvh
 CentOS/RHEL 5 , 64 bit:
 # rpm -Uvh
 CentOS/RHEL 6 , 32 bit:
 # rpm -Uvh
 CentOS/RHEL 6 , 64 bit:
 # rpm -Uvh

Step 2: Install HAProxy using Yum.

[root@hn3 ~]# yum install haproxy

Step 3: Now we will configure HAProxy.

[root@hn3 ~]# vi /etc/haproxy/haproxy.cfg

Please refer for brief documentation before editing this file :

[root@hn3 ~]# cat haproxy.cfg
 # Example configuration for a possible web
application.  See the
 # full configuration options online.
 # Global settings
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
#  /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 local2
chroot  /var/lib/haproxy
pidfile  /var/run/
maxconn  4000
user  haproxy
group  haproxy
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
mode  http
log  global
option   httplog
option http-server-close
option forwardfor  except
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  30000
 # round robin balancing between Ranger HA
reqadd X-Forwarded-Proto:\ http
default_backend ranger_ha
 backend ranger_ha
balance  roundrobin
mode http
stats enable
stats hide-version
stats uri /stats
stats realm Haproxy\ Statistics
stats auth haproxy:redhat
 option httpchk
 option httpclose
 option forwardfor
 cookie LB insert
server cookie A check
server check
[root@hn3 ~]#

Step 5: Start the HAProxy service

[root@hn3 ~]# service haproxy start

Step 6: To make the HAProxy service persist through reboots

[root@hn3 ~]# chkconfig haproxy on
  • Update the Policy Manager external URL in all Ranger Admin clients (Ranger UserSync and Ranger plug-ins) to point to the load balancer URL.

Ambari >> Ranger >> Configs >>Ranger Settings >> External URL (policymgr_external_url ) :

  • Enable Ranger Admin HA Wizard >> On Ambari >> Ranger >> Service Actions >> Enable Ranger HA
  • URL to load balancer:


  • Select additional Ranger Admin as hn2.hwxblr.com5163-screen-shot-2016-06-07-at-31922-pm.png
  • Install Additional Ranger Admin



  • Access Load Balancer URL: , you should be able to access Ranger policies.