This project demonstrates the implementation of an Active-Active Galera Cluster using MariaDB and HAProxy on Ubuntu virtual machines. The objective is to build a highly available database infrastructure where multiple database servers operate simultaneously and maintain synchronized data across all nodes.
Unlike a traditional single database server, an Active-Active Galera Cluster allows every database node to accept read and write requests. Any data inserted into one node is automatically replicated to the remaining nodes in real time. This architecture eliminates a single point of failure and improves database availability.
The project consists of four virtual machines.
| VM | IP Address | Role |
|---|---|---|
| HAProxy Load Balancer | 192.168.0.2 | Load Balancer |
| Galera DB Node 1 | 192.168.0.3 | Primary Bootstrap Node |
| Galera DB Node 2 | 192.168.0.4 | Cluster Member |
| Galera DB Node 3 | 192.168.0.5 | Cluster Member |
- Ubuntu Server 22.04 LTS
- MariaDB Server
- Galera Cluster (galera-4)
- HAProxy
- SSH
- rsync
- Active-Active database architecture
- Synchronous data replication
- Three-node MariaDB Galera Cluster
- HAProxy load balancing
- High Availability (HA)
- Automatic failover support
- Fault tolerance
- Real-time data synchronization
- Install MariaDB and Galera packages on all database nodes.
- Configure each node with the same Galera cluster configuration.
- Bootstrap the first database node to create the cluster.
- Join the remaining database nodes to the cluster.
- Configure HAProxy to distribute database traffic across all nodes.
- Verify cluster health using
wsrepstatus variables. - Test database replication by creating a database and inserting data.
- Perform failover testing by stopping one database node and confirming that the remaining nodes continue serving requests.
The following validations were completed during the implementation:
- Successful cluster bootstrap
- DB2 and DB3 joined the cluster successfully
- Cluster size verification (
wsrep_cluster_size) - Cluster readiness verification (
wsrep_ready) - Real-time database replication
- HAProxy backend connectivity
- High availability and failover testing
This project provided hands-on experience with:
- MariaDB Galera Cluster
- Multi-master database clustering
- Database replication
- High Availability (HA)
- HAProxy load balancing
- Linux server administration
- SSH-based remote management
- Enterprise database deployment concepts
- Add Keepalived for HAProxy high availability.
- Configure SSL/TLS encryption for database communication.
- Integrate monitoring using Checkmk or Prometheus.
- Automate deployment using Ansible.
- Deploy the cluster in a cloud environment.
Chand Parveen Shivani Sharma
B.Tech Computer Science & Engineering
Hands-on Project: Active-Active MariaDB Galera Cluster with HAProxy Load Balancer