drupal con my sql ha 2008 08 29
DESCRIPTION
TRANSCRIPT
![Page 1: Drupal Con My Sql Ha 2008 08 29](https://reader034.vdocument.in/reader034/viewer/2022042623/54c901964a795979348b45c1/html5/thumbnails/1.jpg)
High Availability Solutions for High Availability Solutions for MySQLMySQL
Lenz GrimmerLenz Grimmer
2008-08-29 2008-08-29
DrupalCon 2008, Szeged, HungaryDrupalCon 2008, Szeged, Hungary
![Page 2: Drupal Con My Sql Ha 2008 08 29](https://reader034.vdocument.in/reader034/viewer/2022042623/54c901964a795979348b45c1/html5/thumbnails/2.jpg)
Agenda
● High Availability in General● MySQL Replication● MySQL Cluster● DRBD● Links/Tools
![Page 3: Drupal Con My Sql Ha 2008 08 29](https://reader034.vdocument.in/reader034/viewer/2022042623/54c901964a795979348b45c1/html5/thumbnails/3.jpg)
Why High Availability Matters
● Downtime is expensive● You miss $$$● Your Boss complains● New Site visitors won't come back
![Page 4: Drupal Con My Sql Ha 2008 08 29](https://reader034.vdocument.in/reader034/viewer/2022042623/54c901964a795979348b45c1/html5/thumbnails/4.jpg)
What Is HA Clustering?
● One service goes down → others take over its work
● IP address takeover, service takeover ● Not designed for high-performance● Not designed for high troughput (load
balancing)
![Page 5: Drupal Con My Sql Ha 2008 08 29](https://reader034.vdocument.in/reader034/viewer/2022042623/54c901964a795979348b45c1/html5/thumbnails/5.jpg)
Split-Brain
● Communications failures can lead to separated partitions of the cluster
● If those partitions each try and take control of the cluster, then it's called a split-brain condition
● If this happens, then bad things will happenhttp://linux-ha.org/BadThingsWillHappen
● Use Fencing or Moderatation/Arbitration to avoid it
![Page 6: Drupal Con My Sql Ha 2008 08 29](https://reader034.vdocument.in/reader034/viewer/2022042623/54c901964a795979348b45c1/html5/thumbnails/6.jpg)
Eliminating the SPOF
● Identify what will fail● Disks
● Find out what can fail● Network cables● OOM● Power supplies
![Page 7: Drupal Con My Sql Ha 2008 08 29](https://reader034.vdocument.in/reader034/viewer/2022042623/54c901964a795979348b45c1/html5/thumbnails/7.jpg)
Rules of High Availability
● Prepare for failure● Keep it simple, stupid (KISS)● Complexity is the enemy of reliability● Test your setup frequently
![Page 8: Drupal Con My Sql Ha 2008 08 29](https://reader034.vdocument.in/reader034/viewer/2022042623/54c901964a795979348b45c1/html5/thumbnails/8.jpg)
MySQL Replication
● One-way, statement-based● One Master, many Slaves● Asynchronous – Slaves can lag● Master maintains binary logs & index● Easy to set up● Built into MySQL● Replication is single-threaded
![Page 9: Drupal Con My Sql Ha 2008 08 29](https://reader034.vdocument.in/reader034/viewer/2022042623/54c901964a795979348b45c1/html5/thumbnails/9.jpg)
MySQL Replication Overview
Web/AppServer
Web/AppServer
Read & Write
MySQL Master
I/OThread
SQLThread
Write
RelayLog
MySQL Slave
mysqld
Daten
Index &Binlogs
mysqld
DataBinlogReplication
![Page 10: Drupal Con My Sql Ha 2008 08 29](https://reader034.vdocument.in/reader034/viewer/2022042623/54c901964a795979348b45c1/html5/thumbnails/10.jpg)
Replication Topologies
Master > Slave
Masters > Slave (Multi-Source)
Master < > Master (Multi-Master)
Master > Slaves
Ring (Multi-Master)
Master > Slave > Slaves
![Page 11: Drupal Con My Sql Ha 2008 08 29](https://reader034.vdocument.in/reader034/viewer/2022042623/54c901964a795979348b45c1/html5/thumbnails/11.jpg)
Replication & HA
● Combined with Heartbeat● Virtual IP takeover● Slave gets promoted to Master● Side benefits: load balancing & backup● Tricky to fail back● No automatic conflict resolution● Proper failover needs to be scripted
![Page 12: Drupal Con My Sql Ha 2008 08 29](https://reader034.vdocument.in/reader034/viewer/2022042623/54c901964a795979348b45c1/html5/thumbnails/12.jpg)
Master-Master Replication
● Useful for easier failover● Not suitable for load-balancing
● Writes still end up on both machines● Neither machine has the authorative data
● Don't write to both masters!● Use Sharding or Partitioning instead
(e.g. MySQL Proxy)
![Page 13: Drupal Con My Sql Ha 2008 08 29](https://reader034.vdocument.in/reader034/viewer/2022042623/54c901964a795979348b45c1/html5/thumbnails/13.jpg)
MySQL Cluster
● Shared nothing● Automatic partitioning● Distributed Fragments● Synchronous replication● Fast automatic fail-over of data nodes● Automatic resynchronization● Transparent to Application● Supports Transactions
![Page 14: Drupal Con My Sql Ha 2008 08 29](https://reader034.vdocument.in/reader034/viewer/2022042623/54c901964a795979348b45c1/html5/thumbnails/14.jpg)
MySQL Cluster
● In-memory tables● Not suitable for all query patterns● Not suitable for large datasets● Latency matters● Can be combined with MySQL
Replication
![Page 15: Drupal Con My Sql Ha 2008 08 29](https://reader034.vdocument.in/reader034/viewer/2022042623/54c901964a795979348b45c1/html5/thumbnails/15.jpg)
![Page 16: Drupal Con My Sql Ha 2008 08 29](https://reader034.vdocument.in/reader034/viewer/2022042623/54c901964a795979348b45c1/html5/thumbnails/16.jpg)
DRBD
● Distributed Replicated Block Device● “Raid-1 over network”● Synchronous block replication● Automatic resync on recover● Application-agnostic● Can mask local I/O errors● Active/passive configuration
![Page 17: Drupal Con My Sql Ha 2008 08 29](https://reader034.vdocument.in/reader034/viewer/2022042623/54c901964a795979348b45c1/html5/thumbnails/17.jpg)
DRBD & Heartbeat
● Heartbeat mounts file system on failover (passive node becomes active)
● Data only accessible on the active node● (LVM snapshots can work around this)● Increased I/O Latency● Failover is “cold” (fsck, log recovery,
buffers/caches)
![Page 18: Drupal Con My Sql Ha 2008 08 29](https://reader034.vdocument.in/reader034/viewer/2022042623/54c901964a795979348b45c1/html5/thumbnails/18.jpg)
Requirements MySQL Replication
Availa
bili
ty
No Yes Yes No
No No Yes Yes
Varies Varies < 30s < 3sAuto resync of data No No Yes Yes
Yes Yes MySQL Replication
Scala
bili
ty MySQL Replication MySQL Replication MySQL Replication YesRead-intensive Yes Yes MySQL Replication YesWrite-intensive No No Possible Yes#Nodes/Cluster Master/Slave(s) Master/Slave(s) Active/Passive 255
MySQL Replication & Heartbeat
MySQL, Heartbeat & DRBD
MySQL Cluster
Automated IP FailoverAutomated DB FailoverTypical Failover time
Geographic redundancy
MySQL Replication
Built-in load balancing
![Page 19: Drupal Con My Sql Ha 2008 08 29](https://reader034.vdocument.in/reader034/viewer/2022042623/54c901964a795979348b45c1/html5/thumbnails/19.jpg)
Related tools / Links
● Linux Heartbeathttp://linux-ha.org/
● DRBDhttp:/drbd.org/
● Linux Cluster Information Centerhttp://www.lcic.org/ha.html
● Red Hat Cluster Suitehttp://www.redhat.com/cluster_suite/
● Sun Open High Availability Clusterhttp://opensolaris.org/os/project/ha-mysql/
![Page 20: Drupal Con My Sql Ha 2008 08 29](https://reader034.vdocument.in/reader034/viewer/2022042623/54c901964a795979348b45c1/html5/thumbnails/20.jpg)
Tools/Links
● MySQL Multi-Master Replication Managerhttp://code.google.com/p/mysql-master-master/
● Maatkithttp://maatkit.sourceforge.net/
● Mon – scheduler and alert managementhttp://www.kernel.org/software/mon/
● Continuent Tungsten Replicatorhttps://community.continuent.com/community/tungsten-replicator
![Page 21: Drupal Con My Sql Ha 2008 08 29](https://reader034.vdocument.in/reader034/viewer/2022042623/54c901964a795979348b45c1/html5/thumbnails/21.jpg)
Q & A
Questions, Comments?