• Like

High Availability with Galera Cluster - SkySQL Road Show 2013 in Berlin

  • 1,479 views
Uploaded on

High Availability with Galera Cluster by Seppo Jaakkola, Codership at the SkySQL Road Show 2013 in Berlin 18.6.2013

High Availability with Galera Cluster by Seppo Jaakkola, Codership at the SkySQL Road Show 2013 in Berlin 18.6.2013

More in: Technology , Travel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,479
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
23
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. G a l e r a C l u s t e rSeppo JaakolaCodership
  • 2. 2www.codership.comAgenda● The Meaning of Galera● Galera Cluster Short Introduction● Migrating to Galera Cluster● Galera Project● MariaDB Galera Cluster 5.5.29 GA
  • 3. 3www.codership.comWhat is the Meaning of Galera ?Turns out it has different semantics in:● Italy● Uruguay● Brazil● Spain, Portugal, Russia...
  • 4. 4www.codership.comGalera in ItalyChe cosa significa la parola galera?
  • 5. 5www.codership.comGalera in ItalyChe cosa significa la parola galera?Jail / Prison
  • 6. 6www.codership.comGalera in ItalyChe cosa significa la parola galera?PoliziottoJail / Prison
  • 7. 7www.codership.comOtto Poliziotto ?
  • 8. 8www.codership.comGalera in UruguayQue significa galera en Uruguai?
  • 9. 9www.codership.comGalera in UruguayQue significaca galera en Uruguai?Traditional tall hat
  • 10. 10www.codership.comGalera in BrazilComo sobre em Brazil?
  • 11. 11www.codership.comGalera in BrazilA Group of Happy People
  • 12. 12www.codership.comGalera in Spain, Portugal, Russia...Heres the correct meaning for Galera...
  • 13. 13www.codership.comGalera in Spain, Portugal, Russia...Galley
  • 14. Galera Cluster
  • 15. 15www.codership.comMariaDBMulti-Master ReplicationGalera Replication
  • 16. 16www.codership.comMariaDB MariaDBMulti-Master ReplicationGalera ReplicationThere can be several nodes
  • 17. 17www.codership.comMariaDB MariaDB MariaDBMulti-Master ReplicationGalera ReplicationThere can be several nodes
  • 18. 18www.codership.comMariaDB MariaDB MariaDBMulti-Master ReplicationGalera ReplicationClient can connect to any nodeThere can be several nodes
  • 19. 19www.codership.comMariaDB MariaDB MariaDBMulti-Master ReplicationGalera ReplicationClient can connect to any nodeThere can be several nodesread & write read & write read & write Read & write access to any node
  • 20. 20www.codership.comMariaDB MariaDB MariaDBMulti-Master ReplicationGalera ReplicationReplication is synchronousread & write read & write read & writeClient can connect to any nodeThere can be several nodesRead & write access to any node
  • 21. 21www.codership.comMariaDBMulti-Master ReplicationaMulti-master cluster lookslike one big database withmultiple entry pointsread & write read & write read & write
  • 22. 22www.codership.comMariaDB MariaDB MariaDBSynchronous ReplicationaGalera ReplicationRead & writeTransaction isprocessed locally upto commit time
  • 23. 23www.codership.comMariaDB MariaDB MariaDBSynchronous ReplicationGalera ReplicationcommitTransactions writeset is replicated towhole clusterSlave queueSlave queue
  • 24. 24www.codership.comGalera ReplicationMariaDB MariaDB MariaDBSynchronous ReplicationOKClient gets OKstatusSlave queueSlave queue
  • 25. 25www.codership.comGalera ReplicationMariaDB MariaDB MariaDBSynchronous ReplicationTransaction isapplied in slavesSlave queueSlave queue
  • 26. 26www.codership.comMariaDB MariaDB MariaDBHow node failures are handledaGalera ReplicationLoad Balancing
  • 27. 27www.codership.comMariaDB MariaDB MariaDBQuorumaGalera ReplicationLoad Balancing● Galera uses quorum basedfailure handling:– When cluster partitioning isdetected, the majoritypartition "has quorum" andcan continue– A minority partition cannotcommit transactions, but willattempt to re-connect toprimary partition– Note: 50% is not majority!=> Minimum 3 nodesrecommended.● Load balancer will notice errors& remove node from pool
  • 28. Optimistic Concurrency Control
  • 29. 29www.codership.comGalera ReplicationAOptimistic Concurrency ControlcommitTrx ABcommitTrx B
  • 30. 30www.codership.comGalera ReplicationAOptimistic Concurrency ControlcommitTrx ABcommitTrx BDEADLOCKerorROLLBACK
  • 31. 31www.codership.comOptimistic Concurrency Control● Transactions process independentlyin each cluster node● Transaction write sets will bereplicated at commit time (beforecommit)● Cluster wide conflicts will be resolvedand conflict victim must rollbackOptimistic Concurrency Control
  • 32. 32www.codership.comMulti-Master or Not● If your application can handle deadlockerrors, 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 aproblem or conflict rate hurts yourperformance
  • 33. Parallel Replication
  • 34. 34www.codership.comMariaDBParallel ReplicationSlave queueSlave thd Slave thdAny number of slave applierthreads can be startedSlave control
  • 35. 35www.codership.comMariaDBParallel ReplicationSlave queueSlave thd Slave thdAny number of slave applierthreads can be startedSlave control assigns writesets for slave appliersSlave control
  • 36. 36www.codership.comMariaDBParallel ReplicationSlave queueSlave thd Slave thdAny number of slave applierthreads can be startedSlave control assigns writesets for slave appliersSlave control is on ROW levelSlave control
  • 37. 38www.codership.comMariaDBParallel ReplicationSlave queueSlave thd Slave thdSlave controlAny number of slave applierthreads can be startedSlave control assigns writesets for slave appliersSlave control is on ROW levelOnly applying is parallelcommit order is dictated
  • 38. 39www.codership.comParallel Applying● Aka parallel replication● Every application will benefit of it, because itworks:● 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
  • 39. Galera Cluster Benefits
  • 40. 41www.codership.comGalera 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. 42www.codership.comGalera 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
  • 42. 52www.codership.comSynchronous ReplicationThats more like it !!
  • 43. 53www.codership.comSynchronous ReplicationThats more like it !!Row based
  • 44. 54www.codership.comSynchronous ReplicationThats more like it !!Multi-MasterRow based
  • 45. 55www.codership.comSynchronous ReplicationThats more like it !!Multi-MasterAll have Oxford master degreeRow based
  • 46. 56www.codership.comSynchronous ReplicationThats more like it !!Multi-MasterAll have Oxford master degreeSynchronousRow based
  • 47. 57www.codership.comSynchronous ReplicationThats more like it !!Top notch performanceMulti-MasterAll have Oxford master degreeSynchronousRow based
  • 48. 58www.codership.comSynchronous ReplicationThats more like it !!Top notch performanceMulti-MasterAll have Oxford master degreeArbitratorSynchronousRow based
  • 49. Automatic Node Joining
  • 50. 60www.codership.comMySQL MySQLAutomatic Node JoiningGalera ReplicationjoinerCluster handshake
  • 51. 61www.codership.comMySQL DonorAutomatic Node JoiningGalera ReplicationjoinerSend state
  • 52. 62www.codership.comMySQL MySQLAutomatic Node JoiningGalera ReplicationjoinerCatch upSlave queue
  • 53. 63www.codership.comMySQL MySQLAutomatic Node JoiningGalera ReplicationMySQL
  • 54. Migrating to Galera Cluster
  • 55. 65www.codership.comMigrating to Galera ClusteringaMySQLslaveMySQLmasterMySQL master slave hierarchy
  • 56. 66www.codership.comMySQLslaveMySQLmasterGaleraNode 1Migrating to Galera ClusteringaInstall first Galera node tooperate as MySQL slave
  • 57. 67www.codership.comMySQLslaveMySQLmasterGaleraNode 1Migrating to Galera Clusteringapromote Galera node tooperate as one node cluster
  • 58. 68www.codership.comMySQLslaveMySQLmasterGaleraNode 1Migrating to Galera ClusteringaJoin more nodes in Galeraslave clusterGaleraNode 2GaleraNode 3
  • 59. 69www.codership.comMySQLslaveMySQLmasterGaleraNode 1Migrating to Galera ClusteringaMove traffic to Galera clusterGaleraNode 2GaleraNode 3
  • 60. 70www.codership.comGaleraNode 1Migrating to Galera ClusteringaDrop obsolete MySQL serversGaleraNode 2GaleraNode 3
  • 61. Galera Project
  • 62. 72www.codership.comGalera 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 !!
  • 63. 73Who is using Galera?
  • 64. 74www.codership.comGalera ProjectMySQLMariaDBmergemergeMySQL Community EditionMariaDBGalera Cluster for MySQLMariaDB FeaturesAPIMySQLGalera Replication plugin
  • 65. 75www.codership.comGalera ProjectAPIGalera Replication pluginAPIMariaDBMySQL Community EditionMariaDB Galera ClusterMySQLGalera Cluster for MySQLmergeGalera Replication pluginMySQL
  • 66. 76www.codership.comGalera SupportCodershipLevel 3 support, GaleraMontyProgramLevel 3 Support, MariaDBGaleraClusterMariaDBGaleraClusterSkySQLSupport Subscriptions
  • 67. Questions?Thank you for listening!Happy Clustering :-)