MariaDB Galera Cluster Webinar by Ivan Zoratti on 13.11.2013. Also available as on demand webinar at http://www.skysql.com/why-skysql/webinars/mariadb-galera-cluster-simple-transparent-highly-available
3. SkySQL
•Leading
provider
of
open
source
databases,
services
and
solutions
•Home
for
the
founders
and
the
original
developers
of
the
core
of
MySQL
•The
creators
of
MariaDB,
the
drop-‐in,
innovative
replacement
of
MySQL
PAGE
3
4. Agenda
•Welcome
and
intro
•Galera
Cluster
Short
Introduction
•Cluster
Topologies
•Automatic
Node
Joining
(SST
IST)
•Galera
Project
•Galera,
MariaDB
and
SkySQL
PAGE
4
9. Multi-Master Replication
Client can connect to any node
There can be several nodes
MySQL
MySQL
Galera Replication
MySQL
Automatic node provisioning
10. Multi-Master Replication
read & write
read & write
read & write
Read & write access to any node
Client can connect to any node
There can be several nodes
MySQL
MySQL
Galera Replication
MySQL
Automatic node provisioning
11. Multi-Master Replication
read & write
read & write
read & write
Read & write access to any node
Client can connect to any node
There can be several nodes
MySQL
MySQL
Galera Replication
MySQL
Automatic node provisioning
Replication is synchronous
12. Multi-Master Replication
read & write
read & write
read & write
Multi-master cluster looks like
one big database with multiple
entry points
MySQL
17. How node failures are handled
Load Balancing
MySQL
MySQL
MySQL
Galera Replication
18. Quorum
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
–
Load Balancing
Note: 50% is not majority!
=> Minimum 3 nodes recommended.
Load balancer will notice errors & remove node
from pool
MySQL
MySQL
MySQL
Galera Replication
20. 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
21. Galera vs other HA solutions
Solid
SAN
Galera
RAC
Data integrity
DRBD
Galera is like...
NDB
●
99.999...%
●
MySQL replication without integrity issues
or slave lag
DRBD/SAN without failover downtime and
performance penalty
●
●
Poor
99 %
Slow
MySQL
replication
Failover downtime
Fast
Oracle RAC without failover downtime
NDB, but you get to keep InnoDB
22. Galera Cluster
➢
Synchronous multi-master cluster
➢
Each node full representative of DB
➢
No Single point of failure
➢
For MySQL+InnoDB
➢
99.99% compatible
➢
3 or more nodes needed for HA
➢
Automatic node provisioning
➢
Works in LAN / WAN / Cloud
No Data Loss
No Slave Lag
No Failover
25. WAN replication
●
Works fine
●
Use higher timeouts and send windows
●
No impact on reads
●
No impact within a transaction
●
adds 100-300 ms to commit latency
●
No major impact on tps
●
Quorum between data centers
–3
data centers
– Distribute
nodes evenly
26. WAN with MySQL asynchronous replication
●
●
●
●
●
You can mix Galera replication and
MySQL replication
Good option on poor WAN
Remember to watch out for slave lag,
etc...
"Channel failover" if a master node
crashes
Mixed replication useful when you want
async slave (such as time-delayed,
filtered, multi-source...)
27. Migrating to Galera Clustering
MySQL
master
MySQL master slave hierarchy
MySQL
slave
28. Galera as MySQL Slave
MySQL
master
Add Galera node as normal
MySQL slave
MySQL
slave
Galera
Node 1
29. Galera as MySQL Slave
MySQL
master
Join more nodes in Galera slave cluster
MySQL
slave
Galera
Node 1
Galera
Node 2
Galera
Node 3
30. Galera as MySQL Slave
MySQL
master
Move traffic to Galera cluster
MySQL
slave
Galera
Node 1
Galera
Node 2
Galera
Node 3
31. Galera as MySQL Slave
Drop obsolete MySQL servers
Galera
Node 1
Galera
Node 2
Galera
Node 3
33. State Transfer
Joining node needs to get the current database state
➢
Two choices:
➢
IST: incremental state transfer
➢
SST: full state transfer
➢
If joining node has been part of cluster,
and has some previous state,
and gcache spans to that,
then IST can be used
➢
34. State Snapshot Transfer
To send full database state
●wsrep_sst_method to choose the method:
➢
mysqldump
➢
rsync
➢
xtrabackup
➢
write your own...
●
36. Galera Project
●
Galera Cluster for MySQL
5 years development
● Fully open source
● Based on MySQL Community Server
● Active community
●
●
~3 releases per year
●
●
Latest release 3.0
MariaDB Galera Cluster
38. Galera 3.0
• WAN Replication support
•Connections between cluster segments (previously it was between
all the nodes)
•Donors for State Transfer will be searched within the segment first
•Weighted quorum calculation
• Certification Keys refactoring
•Reduced memory footprint
•Faster key checks
•Larger transactions can run in parallel
38
39. Galera 3.0
• GTID Support
•MySQL Slaves will see Galera
Cluster as one MySQL Master
•Pre-ordered Replication
•MySQL Replication events and
Galera Replication events can
be applied without conflicts
39
42. SkySQL
Support,
Consulting
and
Training
•
•
•
The
best
services
and
support
from
the
original
developers
of
MySQL
and
Galera
Customized
professional
services
that
adapt
to
customers’
needs,
from
the
smallest
to
the
largest
implementations
On
site
and
public
training
classes
delivered
by
certified
trainers
who
have
implemented
Galera
in
many
organizations
worldwide
PAGE
42
43. For
More
Information...
•
•
•
•
•
Information
on
Galera:
www.galera.com
Web,
Doc
&
Knowledge
Base:
www.mariadb.org
www.mariadb.com
Launchpad:
launchpad.net/maria
launchpad.net/galera
Jira
(bugs
and
development):
mariadb.atlassian.net
IRC:
irc.freenode.net
#maria
webchat.freenode.net/?
randomnick=1&channels=maria
PAGE
43