1 / 29

Mastering Galera

Mastering Galera. Data Masters. Special Thanks To…. 1010 NE 2 nd Ave Miami, FL 33132 305-735-1274 www.venturehive.co. Our Sponsor!. John Jadvani 954-527-0090. Short bio about me… Andrew Simkovsky 15 years working with database technology

seda
Télécharger la présentation

Mastering Galera

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MasteringGalera Data Masters

  2. Special Thanks To… 1010 NE 2nd Ave Miami, FL 33132 305-735-1274 www.venturehive.co

  3. Our Sponsor! John Jadvani 954-527-0090

  4. Short bio about me… • Andrew Simkovsky • 15 years working with database technology • Oracle, MySQL/MariaDB, SQL Server, Postgres • Redis, MongoDB, CouchDB, Cassandra, Neo4j • Worked across many industries • Consulting, Retail, Telecommunications, Energy • Data, Marketing, Gaming, Health care

  5. DBTekPro www.dbtekpro.com andrew@dbtekpro.com @asimkovsky

  6. Let’s Get Started!

  7. Galera Cluster for MySQL • High availability (HA) and scaling solution for MySQL/MariaDB • A clustering solution that integrates with MySQL / MariaDB

  8. Galera Cluster Concept MySQL/MariaDB Galera

  9. Other HA and Scaling Solutions • Sharding • Master / Slave(s) • Master / Master • Master / Master plus Slaves

  10. Sharding Application A..F G..L M..R …

  11. Master / Slave(s) Application Master Slave

  12. Master / Slave(s) Application Master Slave Slave Slave

  13. Master / Master Application Master Master

  14. Master / Master Plus Slaves Application Master Master Slave Slave Slave Slave Slave Slave

  15. Basic Galera Concepts • Contains multiple nodes • Each node has a full copy of the data • Synchronous multi-master replication across all nodes • All changes to every node are replicated to all other nodes • Each node can be for reads and writes • All nodes can be accessed at the same time

  16. Galera Concept Application Node Node Node Node Node Galera Galera Galera Galera Galera

  17. Quorum Commit • Don’t have to wait for all nodes to answer back for your changes • “Majority” rules • Committed nodes >= (N / 2 ) + 1 • Minimum recommended number of nodes is 3

  18. Split Brain Syndrome • Network partition between the nodes • Each node thinks its in charge • Both nodes keep taking traffic • Now both nodes have different contents • When nodes start talking to each other again, they are very confused

  19. Split Brain Syndrome Data Center 1 Data Center 2 Application Application Node Node Galera Galera

  20. Arbitrator Node • “Cheating” with 2 nodes • Acts as a third node • Doesn’t store any data • Aware of cluster state and replication status • Provides that third “commit” vote • Replication changes pass through it • Loss of direct connectivity between nodes can still be handled if arbitrator can talk to both

  21. Arbitrator Node Data Center 1 Data Center 2 Application Application Node Node Galera Galera Arbitrator Data Center 3

  22. Some Other “Gotchas” • Be careful with non-deterministic functions like NOW(), CURTIME(), etc • DELETE commands on tables without a primary key are not supported • Direct writes to system tables (“mysql” database) are not replicated • Cluster enforces optimistic concurrency control • “I got here first, my transaction is good” • All other transactions locking the same row get deadlock error • Application should be configured to retry the transaction

  23. Setup Overview

  24. Stuff to install on each node • Operating system • MariaDB server • Galera • PerconaXtraBackup

  25. Setup Steps • On each node: • Set up configuration files • Start up MySQL • On first node: during startup, you tell it that it’s the first node. • The data it contains will become the “master” copy. • For each additional node that starts up, it will seek out one of its “neighbors”, and try to sync a copy of the data to itself • Source node is called the “donor” • After syncing the data, the node joins the cluster and becomes active

  26. Database State Transfer • When starting up, each node needs a copy of the data • The copying of the data is called a “state transfer” • Will copy from existing nodes using one of these methods: • mysqldump • rsync • xtrabackup • For mysqldump and rsync, the donor is locked for writes during the entire copy process • Percona’sxtrabackup allows writes to happen on donor node during copy process

  27. Live Demo!

  28. Questions?

  29. Thank You For Coming! Please rate this Meet Up: www.meetup.com/data-masters (or go there to join!) Check out my blog and forums: www.dbtekpro.com

More Related