Upgrade to Pro — share decks privately, control downloads, hide ads and more …

20120426 High Availability MySQL

jnlin
April 26, 2012

20120426 High Availability MySQL

jnlin

April 26, 2012
Tweet

More Decks by jnlin

Other Decks in Technology

Transcript

  1. Agenda About Me! Typical Architecture for Websites! Why High Availability

    for databases?! Degree of High Availability! Approaches to high availability MySQL! Our Choices! Conclusion!
  2. About Me Jui-Nan Lin (؍๿Ӳ)! Section Manager of R&D Team,

    R&D Dept.! Operate MySQL for 4 year in PIXNET! Twitter: @jnlin! LinkedIn: jnlin! Email: [email protected]! !
  3. Why High Availability Hardware can fail, something can break !

    – We have broken hardware every week in PIXNET! We need maintenance window! – Upgrade Operating System/MySQL server! We don’t want to be called by my boss at 4am.
  4. Our Target Fault Tolerant! No SPOF (Single Point of Failure)!

    Easy to add repaired node back! Data Correctness! Reduce Cost! – Human Resource! – Hardware!
  5. Degree of High Availability Down Time! – 90% uptime =>

    35 days down per year! – 99% uptime => 4 days! – 99.9% uptime => 8 hours! – 99.99% uptime => 50 mins! – 99.999% uptime => 5 mins
  6. Approaches to high availability MySQL Replication – Master and Slave!

    DRBD! Master-to-Master Replication! MySQL Cluster
  7. Replication – Concept Master Slave Slave Slave Master Fail Promoted

    to master Replication Replication Replication
  8. Replication – Pros and Cons Pros! – Simple - MySQL

    feature! Cons! – Data inconsistency! • Incomplete transaction! • Replication delay!
  9. DRBD DRBD - Distributed Replicated Block Device! – RAID 1

    over the network! Relies on crash safe storage engine and file system! – InnoDB and XFS! http://www.drbd.org/!
  10. DRBD – Pros and Cons Pros! – Reliable! – Data

    Consistency! Cros! – Warm up problem!
  11. Master-to-Master Replication – Concept Writer Reader Writer/Reader Fail Replication Monitor

    Healthy
 Check Healthy
 Check Monitor Healthy
 Check Healthy
 Check
  12. Master-to-Master Replication – Pros and Cons Pros! – No “Warm

    up” Problem! – Better Resource Usage! Cons! – Same as MySQL replication! – Race condition! • Solved by fixed writer node
  13. Master-to-Master Replication – Pros and Cons Cons! – Duplicated Key

    when use auto-increment! • Solved by auto_increment_increment=2 and auto_increment_offset!
  14. Our Choices DRBD for applications which require more consistency! Master-to-Master

    Replication for applications which require high performance! Will evaluate cluster configuration in Q4
  15. Conclusion Evaluate a suitable solution ! – What degree of

    high availability do you need?! – What applications do you run?! • Web 2.0 Applications? Billing Data? Mobile Apps?! – How much budget do you have?! Aim for what is reasonable for your needs!