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:
-
In the Services tab, click [advanced mode]. Then edit the
csyncd
service.The contents of the
/etc/csyncd/csyncd.cfg
configuration file displays. -
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 instance2
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)
textLOCAL_IP=10.0.32.11REMOTE_IP=10.0.32.12LOCAL_NODE=1REMOTE_NODE=2textLOCAL_IP=10.0.32.11REMOTE_IP=10.0.32.12LOCAL_NODE=1REMOTE_NODE=2 -
LB2 (Secondary)
textLOCAL_IP=10.0.32.12REMOTE_IP=10.0.32.11LOCAL_NODE=2REMOTE_NODE=1textLOCAL_IP=10.0.32.12REMOTE_IP=10.0.32.11LOCAL_NODE=2REMOTE_NODE=1
-
-
Click OK and then Close.
-
Click csyncd setup.
-
Remove the line
no autostart
. -
Click OK and then Close.
-
To make your changes persistent after a reboot, click the Setup tab. Then click Save under Configuration.
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.
-
On the primary load balancer instance, stop the
csyncd
service if it is running.Ensure the
csyncd
service is stopped: -
Click the genkey button to generate the SSH
host
anduser
keys. -
Repeat steps 1 and 2 on the secondary load balancer.
-
On the primary load balancer instance, click the getkey button to fetch the secondary load balancer’s SSH keys.
-
Click Start on the
csyncd
service. -
Repeat steps 4 and 5 on the secondary load balancer.
-
To make your changes persistent after a reboot, click the Setup tab. Then click Save under Configuration.
Sync only the load balancer configuration Jump to heading
Follow these steps to synchronize only the configuration related to load balancing.
-
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.
-
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:
-
-
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.
-
In the Services tab, click [advanced mode] to see the Edit Configuration button for a service.
-
After you have made changes to the service’s configuration, click Apply and then Push to sync the change to the other load balancer.
-
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:
-
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.
-
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?