Configuring High Availability


To reduce the impact of downtime on the business caused by routine maintenance operations (planned) and unexpected system crashes, High Availability (HA) can be deployed to improve the availability for systems and applications.

With HA, a cluster of two AmpCon servers can be operated in active-standby mode to provide fail safe redundancy. The databases are automatically synchronized in the background from the master server to backup server.

NOTE:

The HA feature needs to be deployed during the system initial installation of the AmpCon servers when configuring system setup.

Preparation

1.      Prepare two virtual machines to be deployed as active and standby AmpCon servers, by using the AmpCon Server software OVA templates.

         For details about how to install AmpCon on a virtual machine using an OVA template, see AmpCon Installation Guide.

2.      Ensure that the two AmpCon servers are route reachable.

3.      Ensure that AmpCon Servers and the network devices have proper network connectivity.

a)  Ensure that the two AmpCon servers and the managed switches have route reachability between them.

b)  Ensure that the AmpCon servers and the DNS server have route reachability between them.

Procedure

The following steps in this section describe how to configure High Availability (HA) on a pair of identical AmpCon servers. Complete the following operations individually on both master and backup AmpCon servers.

1.      Login to the AmpCon server and execute /root/automation/system-setup to start the system setup configuration.

2.      During the system setup, set parameters “server ID” and “Peer Server IP” from the HA configuration options.

a)   Type "1" and set "Server ID", which is used to identify different AmpCon servers. The value could be 1 or 2, which should be different on each AmpCon server.

b)   Type “3” and set “Peer Server IP”, the “Peer Server IP” should be the management IP address of the peer AmpCon server.

c)   Type “8” and set “Server Domain Name”, the “Server Domain Name” should be the domain name of active AmpCon server configured on DNS server.

d)   Type “x” and press “Enter” to save the configurations.

3.      Enable listening on TCP port 3306.

a)   Execute command sudo firewall-cmd --zone=public --add-port=3306/tcp --permanent.

b)   Execute command sudo firewall-cmd --reload.

4.       Enable Binary Log in MySQL.

a)   Add the following code at the bottom of the file /etc/my.cnf.d/server.cnf.

#skip-log-bin
expire_logs_days = 30


   

b)   Restart MySQL service by executing command sudo systemctl restart mysql.

5.       Execute reboot.

[root@AmpCon~]# reboot

6.       Modify file /usr/share/automation/server/vpn/client.conf.

Replace the IP address with the domain name (for example: “ac.ampcon.local”).

After completing the configuration steps as described above on both master and backup AmpCon servers, HA deployment is complete. The databases will be synchronized from the master to the backup automatically.

Switching to Backup Server when Master Server is Down

When the master AmpCon server is shut down or powered off, the service does not automatically switch to the backup AmpCon. To complete the switchover, you need to manually complete the following steps.

1.      Change the DNS server settings to resolve the configured domain name to the IP address of the backup AmpCon server.

2.      Execute the following command on the backup AmpCon server.

Note: Use a valid MySQL user name and password when executing the following commands, the default user name/password is root/root.

[root@AmpCon~]# mysql -u <mysql-username> -p <mysql-passwd> -e "delete from automation.apscheduler_jobs"
[root@AmpCon~]# mysql -u <mysql-username> -p <mysql-passwd> -e "delete from automation.task_lock"

3.      Execute the following command to restart AmpCon service on the backup AmpCon server.

[root@AmpCon~]# sudo systemctl restart automation

These above operations are transparent to the managed switches. Once completed, all managed switches can seamlessly switch to backup AmpCon without any additional configuration.

NOTEs:

1.      Modifying the settings on DNS server in step 1 are necessary, thus to resolve the configured domain name to the IP address of the backup AmpCon server when master server is down.

2.      When active AmpCon server goes down, the current running tasks (e.g. deployment/upgrade) will also stop.

3.      When AmpCon process is down but the OpenVPN server is still alive on the master AmpCon server, the OpenVPN IP client on the switch will still connect to the OpenVPN server on the master, it will not automatically change the connection to OpenVPN server on the backup AmpCon server.

In this case, users need to use command sudo systemctl stop openvpn@server to stop the OpenVPN server service on the master AmpCon server, and do the operations in this section to switch to the backup AmpCon.

Verification

After HA configurations are completed on both master and backup AmpCon server, you can use command mysql -u <mysql-username> -p <mysql-password> -e "show slave status" to check the configurations.

If HA function is successfully deployed, the command output shows “Slave has read all relay log; waiting for the slave I/O thread to update it”. For example,

Copyright © 2024 Pica8 Inc. All Rights Reserved.