Configure the load balancer

This section describes how to configure your MySQL or MariaDB database for the HA deployment.

Set up load balancer

Configuring the load balancer may vary depending on the load balancer in question. Set up and configure your load balancer as instructed in the documentation of your load balancer.

You must situate the load balancer between the two API Portal instances.

Example configuration

This example uses Balance by Inlab. For more details or to get Balance, see the Inlab website.

Note   On a production environment, it is recommended to use commercial load balancers.

The load balancer with the IP address 10.0.1.10 listens on port 3306 and redirects to 10.0.1.5:3306 and 10.0.1.6:3306. The load balancer also does this for ports 80 and 443 for the Apache servers in the deployment. This infrastructure is set in the Balance load balancer as follows:

./balance 3306 10.0.1.5:3306 % 10.0.1.6:3306
./balance 80 10.0.1.5:80 % 10.0.1.6:80
./balance 443 10.0.1.5:443 % 10.0.1.6:443

Fine-tune database settings

You can use advanced settings to fine-tune the database and its performance:

  • To automatically set increment IDs in the database and synchronize the IDs between the two API Portal instances, check the settings for auto_increment_increment and auto_increment_offset.
  • To avoid timeout issues, check the master-connect-retry setting.
  • To avoid filling disk space with database replication logs, adjust the expire_log_days and max_binlog_size as needed.

It is recommended to keep an eye on the machine KPIs (disk space, RAM, CPU, network).

For more details on the database settings, see MySQL documentation or MariaDB documentation.

Related Links