SlideShare a Scribd company logo
1 of 22
Download to read offline
High Availability Solutions for
           MySQL


Lenz Grimmer
<lenz@grimmer.com>
2008-08-29
DrupalCon 2008, Szeged, Hungary
Agenda
●   High Availability in General
●   MySQL Replication
●   MySQL Cluster
●   DRBD
●   Links/Tools
Why High Availability Matters
●   Downtime is expensive
●   You miss $$$
●   Your Boss complains
●   New Site visitors won't come back
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)
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
    happen
    http://linux-ha.org/BadThingsWillHappen
●   Use Fencing or Moderatation/Arbitration to
    avoid it
Eliminating the SPOF
●   Identify what will fail
    ●   Disks
●   Find out what can fail
    ●   Network cables
    ●   OOM
    ●   Power supplies
Rules of High Availability
●   Prepare for failure
●   Keep it simple, stupid (KISS)
●   Complexity is the enemy of reliability
●   Test your setup frequently
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
MySQL Replication Overview
        Read & Write


            Web/App
             Server
                                                                      Write

                                                 Relay
                                                  Log



                  mysqld                              I/O              SQL
                                                    Thread            Thread

                       Index &
                       Binlogs
Daten


                                 Replication                 Binlog            Data

                                               mysqld

    MySQL Master                                         MySQL Slave
Replication Topologies
Master > Slave                          Master > Slaves




Master > Slave > Slaves            Masters > Slave (Multi-Source)




                                         Ring (Multi-Master)
Master < > Master (Multi-Master)
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
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)
MySQL Cluster

●   Shared nothing
●   Automatic partitioning
●   Distributed Fragments
●   Synchronous replication
●   Fast automatic fail-over of data nodes
●   Automatic resynchronization
●   Transparent to Application
●   Supports Transactions
MySQL Cluster
●   In-memory tables
●   Not suitable for all query patterns
●   Not suitable for large datasets
●   Latency matters
●   Can be combined with MySQL
    Replication
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
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)
MySQL Replication &   MySQL, Heartbeat &    MySQL
                  Requirements       MySQL Replication       Heartbeat               DRBD            Cluster
               Automated IP
               Failover                     No                  Yes                   Yes               No
               Automated DB
Availability




               Failover                     No                   No                   Yes              Yes
               Typical Failover
               time                       Varies               Varies                < 30s             < 3s
               Auto resync of data         No                   No                    Yes              Yes
               Geographic                                                                             MySQL
               redundancy                  Yes                  Yes            MySQL Replication    Replication
               Built-in load
Scalability




               balancing             MySQL Replication   MySQL Replication     MySQL Replication       Yes
               Read-intensive              Yes                 Yes             MySQL Replication       Yes
               Write-intensive             No                  No                  Possible            Yes
               #Nodes/Cluster         Master/Slave(s)     Master/Slave(s)       Active/Passive         255
Related tools / Links
●   Linux Heartbeat
    http://linux-ha.org/
●   DRBD
    http:/drbd.org/
●   Linux Cluster Information Center
    http://www.lcic.org/ha.html
●   Red Hat Cluster Suite
    http://www.redhat.com/cluster_suite/
●   Sun Open High Availability Cluster
    http://opensolaris.org/os/project/ha-mysql/
Tools/Links
●   MySQL Multi-Master Replication
    Manager
    http://code.google.com/p/mysql-master-master/
●   Maatkit
    http://maatkit.sourceforge.net/
●   Mon – scheduler and alert management
    http://www.kernel.org/software/mon/
●   Continuent Tungsten Replicator
    https://community.continuent.com/community/tungsten-replicator
Q&A




Questions, Comments?
Thank you!
Lenz Grimmer <lenz@grimmer.com>

More Related Content

What's hot

Galera cluster - SkySQL Paris Meetup 17.12.2013
Galera cluster - SkySQL Paris Meetup 17.12.2013Galera cluster - SkySQL Paris Meetup 17.12.2013
Galera cluster - SkySQL Paris Meetup 17.12.2013MariaDB Corporation
 
Galera cluster for MySQL - Introduction Slides
Galera cluster for MySQL - Introduction SlidesGalera cluster for MySQL - Introduction Slides
Galera cluster for MySQL - Introduction SlidesSeveralnines
 
PERFORMANCE_SCHEMA and sys schema
PERFORMANCE_SCHEMA and sys schemaPERFORMANCE_SCHEMA and sys schema
PERFORMANCE_SCHEMA and sys schemaFromDual GmbH
 
RESTEasy Reactive: Why should you care? | DevNation Tech Talk
RESTEasy Reactive: Why should you care? | DevNation Tech TalkRESTEasy Reactive: Why should you care? | DevNation Tech Talk
RESTEasy Reactive: Why should you care? | DevNation Tech TalkRed Hat Developers
 
The Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialThe Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialJean-François Gagné
 
How Booking.com avoids and deals with replication lag
How Booking.com avoids and deals with replication lagHow Booking.com avoids and deals with replication lag
How Booking.com avoids and deals with replication lagJean-François Gagné
 
Getting ready to java 8
Getting ready to java 8Getting ready to java 8
Getting ready to java 8DataArt
 
M|18 Under the Hood: Galera Cluster
M|18 Under the Hood: Galera ClusterM|18 Under the Hood: Galera Cluster
M|18 Under the Hood: Galera ClusterMariaDB plc
 
What's New in MySQL 5.7
What's New in MySQL 5.7What's New in MySQL 5.7
What's New in MySQL 5.7Olivier DASINI
 
M|18 PolarDB: Extending Shared-storage to MyRocks
M|18 PolarDB: Extending Shared-storage to MyRocksM|18 PolarDB: Extending Shared-storage to MyRocks
M|18 PolarDB: Extending Shared-storage to MyRocksMariaDB plc
 
M|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change MethodsM|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change MethodsMariaDB plc
 
M|18 Creating a Reference Architecture for High Availability at Nokia
M|18 Creating a Reference Architecture for High Availability at NokiaM|18 Creating a Reference Architecture for High Availability at Nokia
M|18 Creating a Reference Architecture for High Availability at NokiaMariaDB plc
 
Getting ready to java 8
Getting ready to java 8Getting ready to java 8
Getting ready to java 8Strannik_2013
 
MySQL Parallel Replication by Booking.com
MySQL Parallel Replication by Booking.comMySQL Parallel Replication by Booking.com
MySQL Parallel Replication by Booking.comJean-François Gagné
 
The Real Thing: Java Virtual Machine
The Real Thing: Java Virtual MachineThe Real Thing: Java Virtual Machine
The Real Thing: Java Virtual MachineFrontech
 
DIY: A distributed database cluster, or: MySQL Cluster
DIY: A distributed database cluster, or: MySQL ClusterDIY: A distributed database cluster, or: MySQL Cluster
DIY: A distributed database cluster, or: MySQL ClusterUlf Wendel
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with serverEugene Yokota
 
Almost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
Almost Perfect Service Discovery and Failover with ProxySQL and OrchestratorAlmost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
Almost Perfect Service Discovery and Failover with ProxySQL and OrchestratorJean-François Gagné
 

What's hot (20)

Galera cluster - SkySQL Paris Meetup 17.12.2013
Galera cluster - SkySQL Paris Meetup 17.12.2013Galera cluster - SkySQL Paris Meetup 17.12.2013
Galera cluster - SkySQL Paris Meetup 17.12.2013
 
Galera cluster for MySQL - Introduction Slides
Galera cluster for MySQL - Introduction SlidesGalera cluster for MySQL - Introduction Slides
Galera cluster for MySQL - Introduction Slides
 
PERFORMANCE_SCHEMA and sys schema
PERFORMANCE_SCHEMA and sys schemaPERFORMANCE_SCHEMA and sys schema
PERFORMANCE_SCHEMA and sys schema
 
RESTEasy Reactive: Why should you care? | DevNation Tech Talk
RESTEasy Reactive: Why should you care? | DevNation Tech TalkRESTEasy Reactive: Why should you care? | DevNation Tech Talk
RESTEasy Reactive: Why should you care? | DevNation Tech Talk
 
The Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialThe Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication Tutorial
 
How Booking.com avoids and deals with replication lag
How Booking.com avoids and deals with replication lagHow Booking.com avoids and deals with replication lag
How Booking.com avoids and deals with replication lag
 
Getting ready to java 8
Getting ready to java 8Getting ready to java 8
Getting ready to java 8
 
M|18 Under the Hood: Galera Cluster
M|18 Under the Hood: Galera ClusterM|18 Under the Hood: Galera Cluster
M|18 Under the Hood: Galera Cluster
 
What's New in MySQL 5.7
What's New in MySQL 5.7What's New in MySQL 5.7
What's New in MySQL 5.7
 
M|18 PolarDB: Extending Shared-storage to MyRocks
M|18 PolarDB: Extending Shared-storage to MyRocksM|18 PolarDB: Extending Shared-storage to MyRocks
M|18 PolarDB: Extending Shared-storage to MyRocks
 
M|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change MethodsM|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change Methods
 
M|18 Creating a Reference Architecture for High Availability at Nokia
M|18 Creating a Reference Architecture for High Availability at NokiaM|18 Creating a Reference Architecture for High Availability at Nokia
M|18 Creating a Reference Architecture for High Availability at Nokia
 
How to Monitor MySQL
How to Monitor MySQLHow to Monitor MySQL
How to Monitor MySQL
 
Getting ready to java 8
Getting ready to java 8Getting ready to java 8
Getting ready to java 8
 
MySQL Parallel Replication by Booking.com
MySQL Parallel Replication by Booking.comMySQL Parallel Replication by Booking.com
MySQL Parallel Replication by Booking.com
 
The Real Thing: Java Virtual Machine
The Real Thing: Java Virtual MachineThe Real Thing: Java Virtual Machine
The Real Thing: Java Virtual Machine
 
DIY: A distributed database cluster, or: MySQL Cluster
DIY: A distributed database cluster, or: MySQL ClusterDIY: A distributed database cluster, or: MySQL Cluster
DIY: A distributed database cluster, or: MySQL Cluster
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with server
 
Scaling the Rails
Scaling the RailsScaling the Rails
Scaling the Rails
 
Almost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
Almost Perfect Service Discovery and Failover with ProxySQL and OrchestratorAlmost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
Almost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
 

Viewers also liked

武汉大学2010新生住宿指南
武汉大学2010新生住宿指南武汉大学2010新生住宿指南
武汉大学2010新生住宿指南liufabin 66688
 
中山大学2010新生住宿指南
中山大学2010新生住宿指南中山大学2010新生住宿指南
中山大学2010新生住宿指南liufabin 66688
 
天津大学2010新生住宿指南
天津大学2010新生住宿指南天津大学2010新生住宿指南
天津大学2010新生住宿指南liufabin 66688
 
复旦2010新生住宿指南
复旦2010新生住宿指南复旦2010新生住宿指南
复旦2010新生住宿指南liufabin 66688
 
人大2010新生住宿指南
人大2010新生住宿指南人大2010新生住宿指南
人大2010新生住宿指南liufabin 66688
 
北京师范大学2010新生住宿指南
北京师范大学2010新生住宿指南北京师范大学2010新生住宿指南
北京师范大学2010新生住宿指南liufabin 66688
 
清华2010新生住宿指南
清华2010新生住宿指南清华2010新生住宿指南
清华2010新生住宿指南liufabin 66688
 
南京大学2010新生住宿指南
南京大学2010新生住宿指南南京大学2010新生住宿指南
南京大学2010新生住宿指南liufabin 66688
 
Best Practices of HA and Replication of PostgreSQL in Virtualized Environments
Best Practices of HA and Replication of PostgreSQL in Virtualized EnvironmentsBest Practices of HA and Replication of PostgreSQL in Virtualized Environments
Best Practices of HA and Replication of PostgreSQL in Virtualized EnvironmentsJignesh Shah
 

Viewers also liked (9)

武汉大学2010新生住宿指南
武汉大学2010新生住宿指南武汉大学2010新生住宿指南
武汉大学2010新生住宿指南
 
中山大学2010新生住宿指南
中山大学2010新生住宿指南中山大学2010新生住宿指南
中山大学2010新生住宿指南
 
天津大学2010新生住宿指南
天津大学2010新生住宿指南天津大学2010新生住宿指南
天津大学2010新生住宿指南
 
复旦2010新生住宿指南
复旦2010新生住宿指南复旦2010新生住宿指南
复旦2010新生住宿指南
 
人大2010新生住宿指南
人大2010新生住宿指南人大2010新生住宿指南
人大2010新生住宿指南
 
北京师范大学2010新生住宿指南
北京师范大学2010新生住宿指南北京师范大学2010新生住宿指南
北京师范大学2010新生住宿指南
 
清华2010新生住宿指南
清华2010新生住宿指南清华2010新生住宿指南
清华2010新生住宿指南
 
南京大学2010新生住宿指南
南京大学2010新生住宿指南南京大学2010新生住宿指南
南京大学2010新生住宿指南
 
Best Practices of HA and Replication of PostgreSQL in Virtualized Environments
Best Practices of HA and Replication of PostgreSQL in Virtualized EnvironmentsBest Practices of HA and Replication of PostgreSQL in Virtualized Environments
Best Practices of HA and Replication of PostgreSQL in Virtualized Environments
 

Similar to Drupal Con My Sql Ha 2008 08 29

MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability SolutionsLenz Grimmer
 
Mysqlhacodebits20091203 1260184765-phpapp02
Mysqlhacodebits20091203 1260184765-phpapp02Mysqlhacodebits20091203 1260184765-phpapp02
Mysqlhacodebits20091203 1260184765-phpapp02Louis liu
 
MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability SolutionsLenz Grimmer
 
Buytaert kris my_sql-pacemaker
Buytaert kris my_sql-pacemakerBuytaert kris my_sql-pacemaker
Buytaert kris my_sql-pacemakerkuchinskaya
 
RDS for MySQL, No BS Operations and Patterns
RDS for MySQL, No BS Operations and PatternsRDS for MySQL, No BS Operations and Patterns
RDS for MySQL, No BS Operations and PatternsLaine Campbell
 
Cloudcon East Presentation
Cloudcon East PresentationCloudcon East Presentation
Cloudcon East Presentationbr7tt
 
Cloudcon East Presentation
Cloudcon East PresentationCloudcon East Presentation
Cloudcon East Presentationbr7tt
 
Seminar : &quot;The Future of MySQL - Roadmap to Success&quot; session MySQL ...
Seminar : &quot;The Future of MySQL - Roadmap to Success&quot; session MySQL ...Seminar : &quot;The Future of MySQL - Roadmap to Success&quot; session MySQL ...
Seminar : &quot;The Future of MySQL - Roadmap to Success&quot; session MySQL ...Software Park Thailand
 
Introduction to XtraDB Cluster
Introduction to XtraDB ClusterIntroduction to XtraDB Cluster
Introduction to XtraDB Clusteryoku0825
 
MariaDB Galera Cluster - Simple, Transparent, Highly Available
MariaDB Galera Cluster - Simple, Transparent, Highly AvailableMariaDB Galera Cluster - Simple, Transparent, Highly Available
MariaDB Galera Cluster - Simple, Transparent, Highly AvailableMariaDB Corporation
 
MySQL HA Alternatives 2010
MySQL  HA  Alternatives 2010MySQL  HA  Alternatives 2010
MySQL HA Alternatives 2010Kris Buytaert
 
Master master vs master-slave database
Master master vs master-slave databaseMaster master vs master-slave database
Master master vs master-slave databaseWipro
 
Has MySQL grown up?
Has MySQL grown up?Has MySQL grown up?
Has MySQL grown up?Mark Stanton
 
Running MariaDB in multiple data centers
Running MariaDB in multiple data centersRunning MariaDB in multiple data centers
Running MariaDB in multiple data centersMariaDB plc
 
My sql with enterprise storage
My sql with enterprise storageMy sql with enterprise storage
My sql with enterprise storageCaroline_Rose
 

Similar to Drupal Con My Sql Ha 2008 08 29 (20)

MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability Solutions
 
Mysqlhacodebits20091203 1260184765-phpapp02
Mysqlhacodebits20091203 1260184765-phpapp02Mysqlhacodebits20091203 1260184765-phpapp02
Mysqlhacodebits20091203 1260184765-phpapp02
 
MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability Solutions
 
Buytaert kris my_sql-pacemaker
Buytaert kris my_sql-pacemakerBuytaert kris my_sql-pacemaker
Buytaert kris my_sql-pacemaker
 
RDS for MySQL, No BS Operations and Patterns
RDS for MySQL, No BS Operations and PatternsRDS for MySQL, No BS Operations and Patterns
RDS for MySQL, No BS Operations and Patterns
 
Cloudcon East Presentation
Cloudcon East PresentationCloudcon East Presentation
Cloudcon East Presentation
 
Cloudcon East Presentation
Cloudcon East PresentationCloudcon East Presentation
Cloudcon East Presentation
 
Seminar : &quot;The Future of MySQL - Roadmap to Success&quot; session MySQL ...
Seminar : &quot;The Future of MySQL - Roadmap to Success&quot; session MySQL ...Seminar : &quot;The Future of MySQL - Roadmap to Success&quot; session MySQL ...
Seminar : &quot;The Future of MySQL - Roadmap to Success&quot; session MySQL ...
 
Introduction to XtraDB Cluster
Introduction to XtraDB ClusterIntroduction to XtraDB Cluster
Introduction to XtraDB Cluster
 
MariaDB Galera Cluster - Simple, Transparent, Highly Available
MariaDB Galera Cluster - Simple, Transparent, Highly AvailableMariaDB Galera Cluster - Simple, Transparent, Highly Available
MariaDB Galera Cluster - Simple, Transparent, Highly Available
 
MySQL highav Availability
MySQL highav AvailabilityMySQL highav Availability
MySQL highav Availability
 
MySQL HA Alternatives 2010
MySQL  HA  Alternatives 2010MySQL  HA  Alternatives 2010
MySQL HA Alternatives 2010
 
Master master vs master-slave database
Master master vs master-slave databaseMaster master vs master-slave database
Master master vs master-slave database
 
Has MySQL grown up?
Has MySQL grown up?Has MySQL grown up?
Has MySQL grown up?
 
Running MySQL in AWS
Running MySQL in AWSRunning MySQL in AWS
Running MySQL in AWS
 
MySQL高可用
MySQL高可用MySQL高可用
MySQL高可用
 
Running MariaDB in multiple data centers
Running MariaDB in multiple data centersRunning MariaDB in multiple data centers
Running MariaDB in multiple data centers
 
My sql with enterprise storage
My sql with enterprise storageMy sql with enterprise storage
My sql with enterprise storage
 
MySQL HA
MySQL HAMySQL HA
MySQL HA
 
Redis ndc2013
Redis ndc2013Redis ndc2013
Redis ndc2013
 

More from liufabin 66688

北大2010新生住宿指南
北大2010新生住宿指南北大2010新生住宿指南
北大2010新生住宿指南liufabin 66688
 
Mysql Replication Excerpt 5.1 En
Mysql Replication Excerpt 5.1 EnMysql Replication Excerpt 5.1 En
Mysql Replication Excerpt 5.1 Enliufabin 66688
 
Application Partitioning Wp
Application Partitioning WpApplication Partitioning Wp
Application Partitioning Wpliufabin 66688
 
090507.New Replication Features(2)
090507.New Replication Features(2)090507.New Replication Features(2)
090507.New Replication Features(2)liufabin 66688
 
High Performance Mysql
High Performance MysqlHigh Performance Mysql
High Performance Mysqlliufabin 66688
 
high performance mysql
high performance mysqlhigh performance mysql
high performance mysqlliufabin 66688
 
Refactoring And Unit Testing
Refactoring And Unit TestingRefactoring And Unit Testing
Refactoring And Unit Testingliufabin 66688
 
Refactoring Simple Example
Refactoring Simple ExampleRefactoring Simple Example
Refactoring Simple Exampleliufabin 66688
 

More from liufabin 66688 (14)

北大2010新生住宿指南
北大2010新生住宿指南北大2010新生住宿指南
北大2010新生住宿指南
 
Optimzing mysql
Optimzing mysqlOptimzing mysql
Optimzing mysql
 
Mysql Replication Excerpt 5.1 En
Mysql Replication Excerpt 5.1 EnMysql Replication Excerpt 5.1 En
Mysql Replication Excerpt 5.1 En
 
Application Partitioning Wp
Application Partitioning WpApplication Partitioning Wp
Application Partitioning Wp
 
090507.New Replication Features(2)
090507.New Replication Features(2)090507.New Replication Features(2)
090507.New Replication Features(2)
 
Mysql Replication
Mysql ReplicationMysql Replication
Mysql Replication
 
High Performance Mysql
High Performance MysqlHigh Performance Mysql
High Performance Mysql
 
high performance mysql
high performance mysqlhigh performance mysql
high performance mysql
 
Lecture28
Lecture28Lecture28
Lecture28
 
Refactoring And Unit Testing
Refactoring And Unit TestingRefactoring And Unit Testing
Refactoring And Unit Testing
 
Refactoring Simple Example
Refactoring Simple ExampleRefactoring Simple Example
Refactoring Simple Example
 
Refactoring Example
Refactoring ExampleRefactoring Example
Refactoring Example
 
Refactoring 重构
Refactoring 重构Refactoring 重构
Refactoring 重构
 
Refactoring
RefactoringRefactoring
Refactoring
 

Drupal Con My Sql Ha 2008 08 29

  • 1. High Availability Solutions for MySQL Lenz Grimmer <lenz@grimmer.com> 2008-08-29 DrupalCon 2008, Szeged, Hungary
  • 2. Agenda ● High Availability in General ● MySQL Replication ● MySQL Cluster ● DRBD ● Links/Tools
  • 3. Why High Availability Matters ● Downtime is expensive ● You miss $$$ ● Your Boss complains ● New Site visitors won't come back
  • 4. 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)
  • 5. 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 happen http://linux-ha.org/BadThingsWillHappen ● Use Fencing or Moderatation/Arbitration to avoid it
  • 6. Eliminating the SPOF ● Identify what will fail ● Disks ● Find out what can fail ● Network cables ● OOM ● Power supplies
  • 7. Rules of High Availability ● Prepare for failure ● Keep it simple, stupid (KISS) ● Complexity is the enemy of reliability ● Test your setup frequently
  • 8. 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
  • 9. MySQL Replication Overview Read & Write Web/App Server Write Relay Log mysqld I/O SQL Thread Thread Index & Binlogs Daten Replication Binlog Data mysqld MySQL Master MySQL Slave
  • 10. Replication Topologies Master > Slave Master > Slaves Master > Slave > Slaves Masters > Slave (Multi-Source) Ring (Multi-Master) Master < > Master (Multi-Master)
  • 11. 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
  • 12. 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)
  • 13. MySQL Cluster ● Shared nothing ● Automatic partitioning ● Distributed Fragments ● Synchronous replication ● Fast automatic fail-over of data nodes ● Automatic resynchronization ● Transparent to Application ● Supports Transactions
  • 14. MySQL Cluster ● In-memory tables ● Not suitable for all query patterns ● Not suitable for large datasets ● Latency matters ● Can be combined with MySQL Replication
  • 15.
  • 16. 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
  • 17. 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)
  • 18. MySQL Replication & MySQL, Heartbeat & MySQL Requirements MySQL Replication Heartbeat DRBD Cluster Automated IP Failover No Yes Yes No Automated DB Availability Failover No No Yes Yes Typical Failover time Varies Varies < 30s < 3s Auto resync of data No No Yes Yes Geographic MySQL redundancy Yes Yes MySQL Replication Replication Built-in load Scalability balancing MySQL Replication MySQL Replication MySQL Replication Yes Read-intensive Yes Yes MySQL Replication Yes Write-intensive No No Possible Yes #Nodes/Cluster Master/Slave(s) Master/Slave(s) Active/Passive 255
  • 19. Related tools / Links ● Linux Heartbeat http://linux-ha.org/ ● DRBD http:/drbd.org/ ● Linux Cluster Information Center http://www.lcic.org/ha.html ● Red Hat Cluster Suite http://www.redhat.com/cluster_suite/ ● Sun Open High Availability Cluster http://opensolaris.org/os/project/ha-mysql/
  • 20. Tools/Links ● MySQL Multi-Master Replication Manager http://code.google.com/p/mysql-master-master/ ● Maatkit http://maatkit.sourceforge.net/ ● Mon – scheduler and alert management http://www.kernel.org/software/mon/ ● Continuent Tungsten Replicator https://community.continuent.com/community/tungsten-replicator
  • 22. Thank you! Lenz Grimmer <lenz@grimmer.com>