Ranger supports high availability enabled databases when deployed with
Postgres.
To support high availability (HA) of a Postgres Ranger database, integrate HAProxy (a
third-party load balancer product) into your environment. HAProxy will handle the
load balancing. Replication Manager (repmgr) handles failover and recovery of the
database.
Ranger jdbc URL must point to a load balancer URL.
For example: mvnssl-sync-1.mvnssl-sync.root.hwx.site
Lb_port = Load balancer port
For example: 6432
The following steps describe how to setup HAProxy as a load balancer and
repmgr as replication manager for postgres database:
Install the HAProxy load balancer.
On CentOS 7, use yum repository to install HAProxy.
yum install haproxy
The latest version of HAProxy available installs in yum
repository.
Run the following command to ensure that HAProxy runs every time the
server reboots.
chkconfig haproxy on
Start the service, using the following command.
systemctl start haproxy && systemctl status haproxy
Install the replication manager.
You can use repmgr package for performing replication of
databases. repmgr is available along with postgres
repository so we can directly run the install command to install this
package.
sudo yum install repmgr_12
Configure the HA proxy:
Edit the HAProxy Configuration file.
vi /etc/haproxy/haproxy.cfg
Add the primary database server hostname and port number.