MySQL 高可用性

442 views

Published on

MySQL 高可用性

http://www.ossez.com/forum.php?mod=viewthread&tid=26847&fromuid=426
(出处: OSSEZ)

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
442
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
7
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

MySQL 高可用性

  1. 1. MySQL High Availability Baron Schwartz February 2011
  2. 2. Agenda ● Defining High Availability ● High Availability Techniques ● High Availability Technologies ● Recommendations (?)
  3. 3. What is High Availability? ● What is Availability? ● How high is enough? ○ "I need six nines" ● MTTR and MTBF ● Service availability versus data availability
  4. 4. Achieving HA ● Increase MTBF ○ "Best practices" and proactive measures ○ Monitoring and alerting ○ Build systems that can soft-fail or run degraded ● Reduce MTTR ○ This is reactive, not proactive ○ Add redundancy to remove SPOFs ○ Add failover/takeover capabilities
  5. 5. Increasing MTBF ● Test regularly; find failures before they matter ● Least privilege ● Keep things neat, clean, systematic ● Manage changes carefully ○ More about this in "causes of downtime" talk ● Good system architecture & design ○ Loose coupling, degraded functionality, load shedding, etc
  6. 6. Decreasing MTTR ● Two important components: 1. Notice problems quickly 2. Resolve them quickly ● Technical measures help with part 2 ○ Systems that have no SPOF, etc ○ Redundancy and failover capability
  7. 7. Data Availability ● This is a related topic, but distinct from HA ● Typically want a strong D guarantee in ACID ● Usually implemented with synchronous replication ● In practice, usually inseparable from HA ● Makes HA much harder ○ It's easy to be HA if it's OK to lose your data!
  8. 8. Technologies ● Replication ● SAN ● DRBD ● MySQL Cluster (NDB) ● Percona XtraDB Cluster (Galera) ● Clustrix and similar ● Load Balancing and Proxies
  9. 9. Replication ● The classic approach, used for years by many ● Can have very short MTTR ● Essential problem: asynchronous ● Has a "glass ceiling" ● Some failover managers available, but most aren't great
  10. 10. SAN ● "Enterprise" approach ● Really a zero-data-loss technique, not HA ● MTTR can be (very) high ● SAN is still a SPOF (can be mitigated)
  11. 11. DRBD ● Replicated storage ● "Enterprise" zero-data-loss approach ● Relatively high MTTR ● DRBD + replication historically not a great approach ● There is Percona-PRM; worth knowing about
  12. 12. Percona XtraDB Cluster ● Built on modified InnoDB + Galera sync replication library ● Multi-master, synchronous, write-anywhere ● Beta; see percona.com/software/
  13. 13. Percona XtraDB Cluster ● Strengths? ○ Transparent, familiar technology* ○ Real HA and protection from data loss ○ No lagging replicas ○ Data stored redundantly; all nodes equal ● Weaknesses? ○ As slow as the slowest node ○ Data stored redundantly; probably limits total size ○ Deadlocks and rollbacks can increase * Uses optimistic conflict resolution, not pessimistic
  14. 14. MySQL Cluster (NDB) ● Shared-nothing approach: true HA ● Not fully general-purpose, but good for lots of things ● Not "vanilla MySQL" - NDB is a separate database ● Improving rapidly; MySQL Cluster 7.2 GA today! ● Unbeatable for specific purposes
  15. 15. Clustrix et al. ● Clustrix ○ NDB-ish, but queries execute fully on the nodes ○ Validated extensively by Percona ● Xeround ○ Ditto; for the cloud; not evaluated by Percona yet ● Continuent Tungsten ○ Replacement for MySQL replication ○ Kind of an opensource GoldenGate
  16. 16. Load Balancing and Proxies ● Usually used in combination with replication ● Usually require some scripting/integration ● $YOUR_LOAD_BALANCER_HERE ● HAProxy, pen, etc ● MySQL Proxy ● ScaleBase, ScaleArc
  17. 17. Recommendations ● Sorry, too complex for these slides :) ● Usual approach: ○ Cross off unsuitable solutions ○ Examine what's left ● Anti-recommendations: ○ Be careful with replication-based HA ○ MMM can be troublesome in some configurations ○ MySQL Proxy doesn't really excel in most cases
  18. 18. Percona XtraDB Cluster ● Writes update all nodes ● Reads execute locally Comparison of Clustering Methods
  19. 19. MySQL Cluster (NDB) ● Writes update all copies of data ● Reads execute locally + distributed Comparison of Clustering Methods
  20. 20. Clustrix ● Writes update all copies of data ● Reads execute fully distributed Comparison of Clustering Methods
  21. 21. What's Percona Been Up To? http://tools.percona.com/
  22. 22. Resources ● Free webinars: www.percona.com/webinars ● White papers on preventing downtime: ○ www.percona.com/about-us/mysql-white-papers ○ "Causes of downtime" paper ○ "Preventing downtime" paper ● Slides from Percona Live DC 2012 ○ Yves's talk on Percona-PRM and MySQL Cluster ○ percona.com/live/
  23. 23. Santa Clara, CA April 10-13 Be There!

×