Moogsoft Docs

Set Up HA Proxy for the Database Role

This topic details the installation and configuration of HA Proxy on a Moogsoft AIOps server, for connection to a remote Percona XtraDB Cluster.

Percona XtraDB Cluster must be run as a 3-node (minimum) cluster distributed across the database roles.

HA architecture

Before you install and configure HA Proxy, configure PerconaXtraDB as described in Set Up the Database for HA, with the components installed as follows:

HA_db.png

Server 3: DB 1 (Percona Node 1).

Server 4: DB 2 (Percona Node 2).

Server 5: DB 3 (Percona Node 3).

Fully distributed installation

See Distributed HA Installation for a reference diagram and steps to achieve a fully distributed installation.

Minimally distributed installation

For a minimally distributed installation follow the instructions below, replacing server 3, server 4 and server 5 with the relevant values for your architecture.

Configure HA Proxy for connection to Percona XtraDB Cluster

On the relevant server, run the following command to configure and start HA Proxy:

$MOOGSOFT_HOME/bin/utils/haproxy_installer.sh -l 3307 -c -i <server 3 ip address>:3306,<server 4 ip address>:3306,<server 5 ip address>:3306

Note

Moogsoft advises providing IP addresses instead of host names for servers running the Percona Cluster, in order to reduce the network latency.

The script performs the following tasks:

  • Installs HA Proxy v1.5.

  • Configures HA Proxy to listen on 0.0.0.0:3306 and route connections to one of three MySQL back ends (as specified by the -i properties).

Verify HA Proxy connection status

On the required server, run the following command:

$MOOGSOFT_HOME/bin/utils/check_haproxy_connections.sh

A successful response is as follows:

HAProxy Connection Counts
 
Frontend:
    0.0.0.0:3306 : 13
Backend:
        mysql_node_1 10.99.1.24:3306 : 13
        mysql_node_2 10.99.1.23:3306 : 0
        mysql_node_3 10.99.1.18:3306 : 0
 
Press Ctrl-C to quit