MariaDB	
  Galera	
  Cluster

Simple,	
  Transparent,	
  Highly	
  Available

Ivan	
  Zora?,	
  CTO	
  -­‐	
  13.11.2013
Who	
  is	
  Ivan

?
SkySQL
•Leading	
  provider	
  of	
  open	
  source	
  
databases,	
  services	
  and	
  
solutions

•Home	
  for	
  the	
...
Agenda
•Welcome	
  and	
  intro
•Galera	
  Cluster	
  Short	
  Introduction
•Cluster	
  Topologies
•Automatic	
  Node	
  J...
Intro	
  to	
  Galera	
  Cluster
Multi-Master Replication

MySQL
Galera Replication
Multi-Master Replication

There can be several nodes

MySQL

MySQL

Galera Replication
Multi-Master Replication

There can be several nodes

MySQL

MySQL

Galera Replication

MySQL

Automatic node provisioning
Multi-Master Replication

Client can connect to any node
There can be several nodes

MySQL

MySQL

Galera Replication

MyS...
Multi-Master Replication

read & write

read & write

read & write

Read & write access to any node
Client can connect to ...
Multi-Master Replication

read & write

read & write

read & write

Read & write access to any node
Client can connect to ...
Multi-Master Replication

read & write

read & write

read & write

Multi-master cluster looks like
one big database with ...
Synchronous Replication

Transaction is processed
locally up to commit time

Read & write

MySQL

MySQL

Galera Replicatio...
Synchronous Replication

Transaction is replicated to
whole cluster

commit

MySQL

MySQL

a
Galera Replication

MySQL
Synchronous Replication

Client gets OK status
OK

MySQL

MySQL

Galera Replication

MySQL
Synchronous Replication

Transaction is applied in
slaves

MySQL

MySQL

Galera Replication

MySQL
How node failures are handled

Load Balancing

MySQL

MySQL

MySQL

Galera Replication
Quorum

Galera uses quorum based failure handling:
–

When cluster partitioning is detected, the
majority partition "has q...
Optimistic Concurrency Control

commit

commit

Trx A

Trx B

A

B

Galera Replication
Optimistic Concurrency Control

●

●

●

Transactions process independently in each cluster
node
Transaction write sets wi...
Galera vs other HA solutions

Solid

SAN

Galera

RAC

Data integrity

DRBD

Galera is like...

NDB
●

99.999...%

●

MySQ...
Galera Cluster

➢

Synchronous multi-master cluster

➢

Each node full representative of DB

➢

No Single point of failure...
Cluster	
  Topologies
Cluster Topologies
WAN replication

●

Works fine

●

Use higher timeouts and send windows

●

No impact on reads

●

No impact within a tran...
WAN with MySQL asynchronous replication

●

●
●

●

●

You can mix Galera replication and
MySQL replication
Good option on...
Migrating to Galera Clustering

MySQL
master
MySQL master slave hierarchy

MySQL
slave
Galera as MySQL Slave

MySQL
master
Add Galera node as normal
MySQL slave

MySQL
slave

Galera
Node 1
Galera as MySQL Slave

MySQL
master
Join more nodes in Galera slave cluster

MySQL
slave

Galera
Node 1

Galera
Node 2

Ga...
Galera as MySQL Slave

MySQL
master
Move traffic to Galera cluster

MySQL
slave

Galera
Node 1

Galera
Node 2

Galera
Node...
Galera as MySQL Slave

Drop obsolete MySQL servers

Galera
Node 1

Galera
Node 2

Galera
Node 3
Automatic	
  Node	
  Provisioning
State Transfer

Joining node needs to get the current database state
➢
Two choices:
➢
IST: incremental state transfer
➢
SS...
State Snapshot Transfer
To send full database state
●wsrep_sst_method to choose the method:
➢
mysqldump
➢
rsync
➢
xtraback...
The	
  Galera	
  Project
Galera Project
●

Galera Cluster for MySQL
5 years development
● Fully open source
● Based on MySQL Community Server
● Act...
Galera Replicator on Launchpad

37
Galera 3.0

• WAN Replication support
•Connections between cluster segments (previously it was between
all the nodes)

•Do...
Galera 3.0

• GTID Support
•MySQL Slaves will see Galera

Cluster as one MySQL Master

•Pre-ordered Replication
•MySQL Rep...
Who is using Galera?
Galera Support

Galera
Cluster

MariaDB
Galera
Cluster

SkySQL

Support Subscriptions

Codership
Galera

MontyProgram
Mari...
SkySQL	
  Support,	
  Consulting	
  and	
  Training
•
•

•

The	
  best	
  services	
  and	
  support	
  
from	
  the	
  o...
For	
  More	
  Information...
•
•
•
•
•

Information	
  on	
  Galera:
www.galera.com
Web,	
  Doc	
  &	
  Knowledge	
  Base...
Thank	
  You!

www.skysql.com

ivan@skysql.com
izoratti.blogspot.com
www.slideshare.net/izoratti
Upcoming SlideShare
Loading in...5
×

MariaDB Galera Cluster - Simple, Transparent, Highly Available

7,319

Published on

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

Published in: Technology, Travel

Transcript of "MariaDB Galera Cluster - Simple, Transparent, Highly Available"

  1. 1. MariaDB  Galera  Cluster Simple,  Transparent,  Highly  Available Ivan  Zora?,  CTO  -­‐  13.11.2013
  2. 2. Who  is  Ivan ?
  3. 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. 4. Agenda •Welcome  and  intro •Galera  Cluster  Short  Introduction •Cluster  Topologies •Automatic  Node  Joining  (SST  IST) •Galera  Project •Galera,  MariaDB  and  SkySQL PAGE   4
  5. 5. Intro  to  Galera  Cluster
  6. 6. Multi-Master Replication MySQL Galera Replication
  7. 7. Multi-Master Replication There can be several nodes MySQL MySQL Galera Replication
  8. 8. Multi-Master Replication There can be several nodes MySQL MySQL Galera Replication MySQL Automatic node provisioning
  9. 9. Multi-Master Replication Client can connect to any node There can be several nodes MySQL MySQL Galera Replication MySQL Automatic node provisioning
  10. 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. 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. 12. Multi-Master Replication read & write read & write read & write Multi-master cluster looks like one big database with multiple entry points MySQL
  13. 13. Synchronous Replication Transaction is processed locally up to commit time Read & write MySQL MySQL Galera Replication MySQL
  14. 14. Synchronous Replication Transaction is replicated to whole cluster commit MySQL MySQL a Galera Replication MySQL
  15. 15. Synchronous Replication Client gets OK status OK MySQL MySQL Galera Replication MySQL
  16. 16. Synchronous Replication Transaction is applied in slaves MySQL MySQL Galera Replication MySQL
  17. 17. How node failures are handled Load Balancing MySQL MySQL MySQL Galera Replication
  18. 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
  19. 19. Optimistic Concurrency Control commit commit Trx A Trx B A B Galera Replication
  20. 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. 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. 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
  23. 23. Cluster  Topologies
  24. 24. Cluster Topologies
  25. 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. 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. 27. Migrating to Galera Clustering MySQL master MySQL master slave hierarchy MySQL slave
  28. 28. Galera as MySQL Slave MySQL master Add Galera node as normal MySQL slave MySQL slave Galera Node 1
  29. 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. 30. Galera as MySQL Slave MySQL master Move traffic to Galera cluster MySQL slave Galera Node 1 Galera Node 2 Galera Node 3
  31. 31. Galera as MySQL Slave Drop obsolete MySQL servers Galera Node 1 Galera Node 2 Galera Node 3
  32. 32. Automatic  Node  Provisioning
  33. 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. 34. State Snapshot Transfer To send full database state ●wsrep_sst_method to choose the method: ➢ mysqldump ➢ rsync ➢ xtrabackup ➢ write your own... ●
  35. 35. The  Galera  Project
  36. 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
  37. 37. Galera Replicator on Launchpad 37
  38. 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. 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
  40. 40. Who is using Galera?
  41. 41. Galera Support Galera Cluster MariaDB Galera Cluster SkySQL Support Subscriptions Codership Galera MontyProgram MariaDB, MySQL
  42. 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. 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
  44. 44. Thank  You! www.skysql.com ivan@skysql.com izoratti.blogspot.com www.slideshare.net/izoratti

×