High availability

Configuration sync

When you operate two HAProxy ALOHA instances, whether in active-active or active-standby mode, you will often want to synchronize the load balancer configuration between them so that they are identical. Synchronization is a manual process that you must initiate. This allows you to test a configuration on one HAProxy ALOHA instance before pushing it to ther other.

Info

  • Each load balancer within a cluster can run a different configuration if you choose.
  • The configuration is not automatically synchronized between peers.
  • Any load balancer within a cluster can push its configuration to another load balancer.
  • Each service defined on the Services tab must be synced individually.

Enable the csyncd service Jump to heading

Before you can sync a configuration across load balancers, you must enable the csyncd service, which performs configuration synchronizations between the cluster members.

To enable the csyncd service, follow these steps on each HAProxy ALOHA instance:

  1. In the Services tab, click [advanced mode]. Then edit the csyncd service.

    csyncd Advanced Mode

    The contents of the /etc/csyncd/csyncd.cfg configuration file displays.

  2. Set each field as described below:

    Field Description
    LOCAL_IP Administration IP address of current HAProxy ALOHA instance.
    REMOTE_IP Administration IP address of the second instance in the cluster.
    LOCAL_NODE Unique ID of the current instance in the cluster (between 1 and 255). By convention, use one of:
    1 to indicate the primary instance
    2 to indicate the secondary instance.
    REMOTE_NODE Unique ID of the remote instance in the cluster (between 1 and 255). Use the ID that you did not use for LOCAL_NODE.

    Example csyncd configuration on each HAProxy ALOHA instance:

    • LB1 (Primary)

      text
      LOCAL_IP=10.0.32.11
      REMOTE_IP=10.0.32.12
      LOCAL_NODE=1
      REMOTE_NODE=2
      text
      LOCAL_IP=10.0.32.11
      REMOTE_IP=10.0.32.12
      LOCAL_NODE=1
      REMOTE_NODE=2
    • LB2 (Secondary)

      text
      LOCAL_IP=10.0.32.12
      REMOTE_IP=10.0.32.11
      LOCAL_NODE=2
      REMOTE_NODE=1
      text
      LOCAL_IP=10.0.32.12
      REMOTE_IP=10.0.32.11
      LOCAL_NODE=2
      REMOTE_NODE=1
  3. Click OK and then Close.

  4. Click csyncd setup.

    csyncd Service Setup

  5. Remove the line no autostart.

  6. Click OK and then Close.

Exchange SSH keys Jump to heading

In order for the HAProxy ALOHA instances to communicate, they must exchange SSH keys.

  • host keys are exchanged and saved to the /etc/csyncd/ssh_known_hosts file on each server. During a sync, the current server checks this file to verify that it is connecting to a trusted peer.
  • user keys are exchanged and saved to the /etc/csyncd/csyncd_authorized file on each server. During a sync, the remote server checks this file to verify that it trusts the peer that is connecting to it.
  1. On the primary load balancer instance, stop the csyncd service if it is running.

    Ensure the csyncd service is stopped:

    csyncd Service Stopped

  2. Click the genkey button to generate the SSH host and user keys.

  3. Repeat steps 1 and 2 on the secondary load balancer.

  4. On the primary load balancer instance, click the getkey button to fetch the secondary load balancer’s SSH keys.

  5. Click Start on the csyncd service.

  6. Repeat steps 4 and 5 on the secondary load balancer.

  7. In the Setup tab, click Save under Local Configuration to persist your changes after a reboot.

Sync only the load balancer configuration Jump to heading

Follow these steps to synchronize only the configuration related to load balancing.

  1. On the primary HAProxy ALOHA instance, go to either the LB Layer7 tab or the LB Layer4 tab, depending on which one you use for load balancing.

  2. After making configuration changes and applying them, a button labeled Push will appear. Click it to synchronize changes to the remote load balancer.

    • If no message appears after a few seconds, everything is fine.

    • In there was an issue, the following message may display at the bottom of the page:

      Sync Error

  3. To persist the changes on the remote load balancer, go to the Setup tab and click Save under the Remote Configuration section. The Current status indicator should turn green.

Sync other services Jump to heading

You can synchronize the configuration of other services between two HAProxy ALOHA instances, besides the LB Layer7 or LB Layer4 tab load balancer configuration. Each service must be synced individually.

  1. In the Services tab, click [advanced mode] to see the Edit Configuration button for a service.

  2. After you have made changes to the service’s configuration, click Apply and then Push to sync the change to the other load balancer.

  3. To persist the changes on the remote load balancer, go to the Setup tab and click Save under the Remote Configuration section. The Current status indicator should turn green.

Troubleshooting Jump to heading

If you run into any problems, try these troubleshooting steps:

  1. On the Setup tab, look for the Remote Configuration area. The current status table reports the synchronization capability of the cluster:

    • A red indicator means synchronization does not work.
    • An orange or green indicator means synchronization works.
  2. If the indicator is red:

    • Power on both HAProxy ALOHA instances.
    • Check that both HAProxy ALOHA web UIs listen on the same TCP port and on the same protocol scheme (HTTP or HTTPs).
    • Check that both HAProxy ALOHA instances can ping each other.
    • Check that the csyncd service is started on both HAProxy ALOHA instances, for example, a green indicator on the Services tab.
    • Force a csyncd key exchange by clicking the getkey button on each HAProxy ALOHA instance.

Do you have any suggestions on how we can improve the content of this page?