You are here

Galera Cluster for MySQL


Galera is a synchronous multi-master replication Cluster for MySQL/InnoDB databases, having features like:

  • Synchronous replication
  • Active-active multi-master topology
  • Read and write to any cluster node
  • Automatic membership control, failed nodes drop from the cluster
  • Automatic node joining
  • True parallel replication, on row level
  • Direct client connections, native MySQL look & feel


The benefits of these features are:

  • No slave lag
  • No lost transactions
  • Read scalability and write improvement
  • Smaller client latencies


Galera Cluster for MySQL uses the Galera library for the replication implementation. To interface with Galera replication, Codership has enhanced MySQL server to support replication API definition in the wsrep API project.

The implementation of the replication API in MySQL server, happens in open source project: MySQL-wsrep.


Codership MySQL and the Galera plugin can be found on Launchpad.

Use Cases

Galera replication works for a wide variety of use cases, here are some common use cases Codership has identified in the open source community:

Read Master Traditional MySQL master-slave topology, but with Galera all "slave" nodes are capable masters at all times, it is just the application who treats them as slaves. Galera replication can guarantee 0 slave lag for such installations and due to parallel slave applying, much better throughput for the cluster.
Write Scalability Distributing writes across the cluster will harness the CPU power in slave nodes for better use to process client write transactions. Due to the row based replication method, only changes made during a client transaction will be replicated and applying such a transaction in slave applier is much faster than the processing of the original transaction. Therefore the cluster can distribute the heavy client transaction processing across many master nodes and this yields in better write transaction throughput overall.
WAN Clustering Synchronous replication works fine over the WAN network. There will be a delay, which is proportional to the network round trip time (RTT), but it only affects the commit operation.
Disaster Recover Disaster recovery is a sub-class of WAN replication. Here one data center is passive and only receives replication events, but does not process any client transactions. Such a remote data center will be up to date at all times and no data loss can happen. During recovery, the spare site is just nominated as primary and application can continue as normal with a minimal failover delay.
Latency Eraser With WAN replication topology, cluster nodes can be located close to cilents. Therefore all read & write operations will be super fast with the local node connection. The RTT related delay will be experienced only at commit time, and even then it can be generally accepted by end user, usually the kill-joy for end user experiences is the slow browsing response time, and read operations are as fast as they possibly can be.