Skip to content
Bots!
Bots!
  • About
    • Myself
    • আমার দোয়া
  • Bookmarks
    • Bookmarks
    • My OCI Bookmarks
    • Useful Proxmox Commands & Links
    • Learning Nano
    • Useful Sites
    • Useful Virtualbox Command
    • Useful MySQL Command
    • Useful Linux Command
    • BTT-CAS
  • Resources
    • Webinar on Cloud Adoption for Project Managers
  • Photos
  • Videos
  • Downloads
Bots!

Setup HAProxy Load Balancer for MariaDB Galera Cluster

Rumi, December 28, 2022December 28, 2022

If you check the above test scenario and try to create DBs on any of the nodes, you would see that the data would automatically sync between the nodes. Which means Availability is achieved. Now to achieve high availability we will use HaProxy as the loadbalancer.

Set up another VM for this and install HAProxy as follows.

sudo apt-get update
sudo apt-get install haproxy

Edit HA Proxy Config as follows.

sudo vim /etc/haproxy/haproxy.cfg

Add the following lines.

# MySQL Cluster FE configuration
frontend mysql_cluster_frontend
bind *:3306
mode tcp
option tcplog
default_backend galera_cluster_backend

# MySQL Cluster BE configuration
backend galera_cluster_backend
mode tcp
option tcpka
balance leastconn
server mysql-01 <node-1-ip>:3306 check weight 1
server mysql-02 <node-2-ip>:3306 check weight 1
server mysql-03 <node-3-ip>:3306 check weight 1

Make sure to update the ip addresses of each node in the config above.

systemctl restart haproxy

That’s it. Connect to Loadbalancer VM IP address : 3306 and you should now have a Highly Available MySQL/Mariadb Cluster with Galera.

Ref:
View story at Medium.com

Administrations Configurations (Linux) HAProxyUbuntuUbuntu 20

Post navigation

Previous post
Next post

Comment

  1. Pingback: MariaDB Galera Cluster on Ubuntu 20 | Bots!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Myself…

Hi, I am Hasan T. Emdad Rumi, an IT Project Manager & Consultant, Virtualization & Cloud Savvyfrom Dhaka, Bangladesh. I have prior experience in managing numerous local and international projects in the area of Telco VAS & NMC, National Data Center & PKI Naitonal Root and CA Infrastructure. Also engaged with several Offshore Software Development Team.

Worked with Orascom Telecom-Banglalink, Network Elites as VAS partner, BTRC, BTT (Turkey) , Mango Teleservices Limited and Access to Informaiton (A2I-UNDP)

Currently working at Oracle Corporation as Principal Technology Solution and Cloud Architect.

You can reach me [h.t.emdad at gmail.com] and I will be delighted to exchange my views.

Tags

Apache Bind Cacti CentOS CentOS 6 CentOS 7 Debain Debian Debian 10 Debian 11 Debian 12 DKIM Docker icinga iptables Jitsi LAMP Letsencrypt Linux Munin MySQL Nagios Nextcloud NFS nginx openvpn pfsense php Postfix powerdns Proxmox RDP SSH SSL Ubuntu Ubuntu 16 Ubuntu 18 Ubuntu 20 Varnish virtualbox vpn Webmin Windows 10 XCP-NG zimbra

Topics

Recent Posts

  • Technitium DNS Web UI Configuration for Primary-Secondary Name Servers February 12, 2026
  • Technitium DNS with Primary-Slave Installation on Debian February 12, 2026
  • Install Docker and Docker Compose in Debian 12 February 5, 2026
  • Install GUI on Debian 12 using CLI February 4, 2026
  • Configuring Multiple PHP Versions on Virtualmin January 30, 2026
  • Deploy a Container TIG (Telegraf, InfluxDB and Grafana) Stack January 24, 2026
  • Resetting password of another Linux by mounting disk December 15, 2025
  • “অমুক মাছ কেটে দিনে দশ হাজার কামাচ্ছে”- এসব গল্প এখন অনেকেই শোনায় November 22, 2025
  • Proxmox VM with NAT using Host Server November 21, 2025
  • Torrent Download Script with Aria2C on Debian 12 using Command Line Interface November 7, 2025

Archives

Top Posts & Pages

  • Technitium DNS Web UI Configuration for Primary-Secondary Name Servers
©2026 Bots! | WordPress Theme by SuperbThemes