Set Up HA Proxy for the Database Role

This topic tells you how to install and configure HA Proxy on a Moogsoft AIOps server to connect to a remote Percona XtraDB cluster.

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

Before you begin

Before you install and configure HA Proxy, you must configure Percona XtraDB as described in Set Up the Database for HA.

You must also set up the Core, UI and LAM nodes before installing and configuring HA Proxy on these nodes. See the following documentation for more information:

Once you have set up the Core, UI and LAM nodes, you install and configure HA Proxy on these nodes:

5_-_HA_Proxy.png

Refer to the Distributed HA system Firewall for more information on connectivity within a fully distributed HA architecture.

Install and configure HA Proxy

You install and configure HA Proxy on the following Core, UI and LAM nodes:

  • Core 1 and Core 2: Core primary and secondary.

  • UI 1 and UI 2: UI primary and secondary.

  • LAM 1 and LAM 2: LAM primary and secondary.

Complete the following steps for the Core, UI and LAM primary and secondary servers:

  1. Install the moogsoft-utils component:

    VERSION=7.3.1.1; yum -y install moogsoft-utils-${VERSION}
  2. Install and configure HA Proxy to listen on 0.0.0.0:3309 and route connections to one of three Percona XtraDB nodes. Use the Percona XtraDB server IP addresses instead of hostnames to reduce network latency .

    $MOOGSOFT_HOME/bin/utils/haproxy_installer.sh -l 3309 -c -i <DB 1 server IP address>:3306,<DB 2 server IP address >:3306,<DB 3 server IP address>:3306

    See Set up the database for HA for more information.

  3. Restart the running services that use Percona XtraDB on the primary and secondary servers to allow those services to connect on 3309:

    • Moogfarmd on the Core servers.

    • Apache Tomcat on the UI servers.

    • All LAMs on the LAM servers, for example SolarWinds or REST LAM.

  4. Run the following script to confirm successful installation:

    $MOOGSOFT_HOME/bin/utils/check_haproxy_connections.sh

    If successful, you see a script output similar to the following example:

    HAProxy Connection Counts
    Frontend:	
        0.0.0.0:3309 : 27
    Backend:
        mysql_node_1 172.31.82.211:3306 : 27
        mysql_node_2 172.31.82.133:3306 : 0
        mysql_node_3 172.31.85.42:3306 : 0