Installing the ha_proxy Utility

The next step in an HA installation is to install the ha_proxy utility that will load-balance your clustered database instances.

Overview

For this exercise, we will fulfill the following requirements:

  • The ha_proxy utility only needs to be set up on your primary and secondary nodes. The redundancy node will never be the active node for the DB service in your HA cluster, so it does not need to have the ha_proxy. To set up ha_proxy, use the installer utility included in $MOOGSOFT_HOME/bin/utils as follows:

    haproxy_installer.sh -l 3309 -c -i 
    <primary-IP>:3306,<secondary-IP>:3306,<redundancy-IP>:3306

    where <primary-IP>, <secondary-IP>, and <redundancy-IP>; are the private IP addresses for your primary, secondary, and redundancy nodes, respectively.

  • Check that the ha_proxy utility has been correctly configured by running the check_haproxy_connections.sh (also in $MOOGSOFT_HOME/bin/utils) to verify that the utility has its frontend on your primary node at port 3309 and its backend on all three of your nodes at port 3306.

Step-By-Step Solution

  1. Connect to your primary HA node via SSH and become root.

  2. Change directories to $MOOGSOFT_HOME/bin/utils and install the ha_proxy utility with the command:

    haproxy_installer.sh -l 3309 -c -i 
    <primary-IP>:3306,<secondary-IP>:3306,<redundancy-IP>:3306

    where <primary-IP>, <secondary-IP>, and <redundancy-IP> are the private IP addresses for your primary, secondary, and redundancy nodes respectively (example: 172.38.31.152).

  3. Repeat step 2 above on your secondary node.

  4. Check your ha_proxy settings by executing the command:

    $MOOGSOFT_HOME/bin/utils/check_haproxy_connections.sh

    You should receive confirmation that your ha_proxy is listening at port 3309 and proxying traffic to all three of your database nodes on port 3306 of each of your HA nodes.

This concludes the lab section.