"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
High Availability with Galera Cluster - SkySQL Road Show 2013 in Berlin
1. G a l e r a C l u s t e r
Seppo Jaakola
Codership
2. 2
www.codership.com
Agenda
● The Meaning of Galera
● Galera Cluster Short Introduction
● Migrating to Galera Cluster
● Galera Project
● MariaDB Galera Cluster 5.5.29 GA
3. 3
www.codership.com
What is the Meaning of Galera ?
Turns out it has different semantics in:
● Italy
● Uruguay
● Brazil
● Spain, Portugal, Russia...
20. 20
www.codership.com
MariaDB MariaDB MariaDB
Multi-Master Replication
Galera Replication
Replication is synchronous
read & write read & write read & write
Client can connect to any node
There can be several nodes
Read & write access to any node
27. 27
www.codership.com
MariaDB MariaDB MariaDB
Quorum
a
Galera Replication
Load Balancing
● Galera uses quorum based
failure handling:
– When cluster partitioning is
detected, the majority
partition "has quorum" and
can continue
– A minority partition cannot
commit transactions, but will
attempt to re-connect to
primary partition
– Note: 50% is not majority!
=> Minimum 3 nodes
recommended.
● Load balancer will notice errors
& remove node from pool
31. 31
www.codership.com
Optimistic Concurrency Control
● Transactions process independently
in each cluster node
● Transaction write sets will be
replicated at commit time (before
commit)
● Cluster wide conflicts will be resolved
and conflict victim must rollback
Optimistic Concurrency Control
32. 32
www.codership.com
Multi-Master or Not
● If your application can handle deadlock
errors, multi-master is good to use
● However, if database has hot-spots, i.e.
multi-master conflicts happen frequently,
write performance will suffer
● But read scalability is always guaranteed
● Use Master-Slave, if deadlock errors are a
problem or conflict rate hurts your
performance
37. 38
www.codership.com
MariaDB
Parallel Replication
Slave queue
Slave thd Slave thd
Slave control
Any number of slave applier
threads can be started
Slave control assigns write
sets for slave appliers
Slave control is on ROW level
Only applying is parallel
commit order is dictated
38. 39
www.codership.com
Parallel Applying
● Aka parallel replication
● Every application will benefit of it, because it
works:
● not on database
● not on table
● but on row level
● wsrep_slave_threads=n
● How many slaves makes sense:
● Monitor wsrep_cert_deps_distance
● Max ~4 * #CPUcores
40. 41
www.codership.com
Galera Cluster
➢ Good Performance
➢ Optimistic concurrency control
➢ Virtually synchronous replication
➢ Parallel Replication
➢ Optimized Group Communication
➢ 99.99% transparent
➢ InnoDB look & feel
➢ Automatic node joining
➢ Works in LAN / WAN / Cloud
41. 42
www.codership.com
Galera Cluster
➢ Synchronous multi-master cluster
➢ no data loss
➢ no slave lag
➢ no slave failover
➢ For MySQL/MariaDB InnoDB
➢ 3 or more nodes needed for HA
➢ No single point of failure
62. 72
www.codership.com
Galera Project
● Galera Cluster for MySQL
● 5 years development
● based on MySQL server community edition
● Fully open source
● Active community
● ~3 releases per year
● Latest release 2.3
● Major release 3.0 in the works
● MariaDB Galera Cluster 5.5.29 GA !!