HAProxy ALOHA Documentation 15.5

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.

Enable the csyncd service

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.

    https://cdn.haproxy.com/documentation/aloha/latest/assets/csyncd_service_advanced-6e892863323be317bcc4c0468e3b121c1ba9a43ff4649b77ccd5598417c0d10e.png

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

  2. Set each field as described below:

    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, we typically configure:

    • 1 if this is the primary instance

    • 2 if this is 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)

    LOCAL_IP=10.0.32.11
    REMOTE_IP=10.0.32.12
    LOCAL_NODE=1
    REMOTE_NODE=2

    LB2 (Secondary)

    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 setup_icon.

    https://cdn.haproxy.com/documentation/aloha/latest/assets/csyncd_service_setup-6aad9f102867c38fc8f426608195103e3383bd7ccff9e07b9ff17537dce4944c.png
  5. Remove the line no autostart.

  6. Click OK and then Close.

Exchange SSH keys

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 stop_icon the csyncd service if it is running.

    Ensure the csyncd service is stopped:

    https://cdn.haproxy.com/documentation/aloha/latest/assets/service_csyncd_stopped-b21b82f6affb318952bf5c83d1d8ccb29202471c5030aa7d6f56bf537bea72da.png
  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 start_icon 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

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 labelled 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:

      https://cdn.haproxy.com/documentation/aloha/latest/assets/sync_error_368x18-3ecde6cd758e4e33908e4998f4474501e6a123babd02dfabfff9d0f52d8a8d0a.png
  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

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 edit_icon for a service.

  2. After you have made changes to the service's configuration, click Apply apply_icon and then Push push_icon 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

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:

    1. Power on both HAProxy ALOHA instances.

    2. Check that both HAProxy ALOHA web UIs listen on the same TCP port and on the same protocol scheme (HTTP or HTTPs).

    3. Check that both HAProxy ALOHA instances can ping each other.

    4. Check that the csyncd service is started on both HAProxy ALOHA instances, i.e. a green indicator on the Services tab.

    5. Force a csyncd key exchange by clicking the getkey button on each HAProxy ALOHA instance.


Next up

Load Balancing