drupalcon mysql ha 2008-08-29
TRANSCRIPT
-
8/8/2019 DrupalCon MySQL HA 2008-08-29
1/22
High Availability Solutions forHigh Availability Solutions for
MySQLMySQL
Lenz GrimmerLenz Grimmer
2008-08-292008-08-29
DrupalCon 2008, Szeged, HungaryDrupalCon 2008, Szeged, Hungary
mailto:[email protected]:[email protected] -
8/8/2019 DrupalCon MySQL HA 2008-08-29
2/22
-
8/8/2019 DrupalCon MySQL HA 2008-08-29
3/22
Why High Availability Matters
Downtime is expensive
You miss $$$
Your Boss complains New Site visitors won't come back
-
8/8/2019 DrupalCon MySQL HA 2008-08-29
4/22
What Is HA Clustering?
One service goes down others takeover its work
IP address takeover, service takeover
Not designed for high-performance
Not designed for high troughput (loadbalancing)
-
8/8/2019 DrupalCon MySQL HA 2008-08-29
5/22
Split-Brain
Communications failures can lead toseparated partitions of the cluster
If those partitions each try and take
control of the cluster, then it's called asplit-brain condition
If this happens, then bad things will
happenhttp://linux-ha.org/BadThingsWillHappen Use Fencing or Moderatation/Arbitration to
avoid it
http://linux-ha.org/BadThingsWillHappenhttp://linux-ha.org/BadThingsWillHappen -
8/8/2019 DrupalCon MySQL HA 2008-08-29
6/22
Eliminating the SPOF
Identify what will fail
Disks
Find out what can fail
Network cables
OOM
Power supplies
-
8/8/2019 DrupalCon MySQL HA 2008-08-29
7/22
Rules of High Availability
Prepare for failure
Keep it simple, stupid (KISS)
Complexity is the enemy of reliability Test your setup frequently
-
8/8/2019 DrupalCon MySQL HA 2008-08-29
8/22
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
-
8/8/2019 DrupalCon MySQL HA 2008-08-29
9/22
-
8/8/2019 DrupalCon MySQL HA 2008-08-29
10/22
Replication Topologies
Master > Slave
Masters > Slave (Multi-Source)
Master < > Master (Multi-Master)
Master > Slaves
Ring (Multi-Master)
Master > Slave > Slaves
-
8/8/2019 DrupalCon MySQL HA 2008-08-29
11/22
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
-
8/8/2019 DrupalCon MySQL HA 2008-08-29
12/22
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)
-
8/8/2019 DrupalCon MySQL HA 2008-08-29
13/22
MySQL Cluster
Shared nothing
Automatic partitioning
Distributed Fragments Synchronous replication
Fast automatic fail-over of data nodes
Automatic resynchronization
Transparent to Application
Supports Transactions
-
8/8/2019 DrupalCon MySQL HA 2008-08-29
14/22
MySQL Cluster
In-memory tables
Not suitable for all query patterns
Not suitable for large datasets
Latency matters
Can be combined with MySQLReplication
-
8/8/2019 DrupalCon MySQL HA 2008-08-29
15/22
-
8/8/2019 DrupalCon MySQL HA 2008-08-29
16/22
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
-
8/8/2019 DrupalCon MySQL HA 2008-08-29
17/22
DRBD & Heartbeat
Heartbeat mounts file system onfailover (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)
-
8/8/2019 DrupalCon MySQL HA 2008-08-29
18/22
Requirements MySQL Replication
A
vailability
No Yes Yes No
No No Yes Yes
Varies Varies < 30s < 3s
Auto resync of data No No Yes Yes
Yes Yes MySQL Replication
Scalability
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
MySQL Replication &Heartbeat
MySQL, Heartbeat &DRBD
MySQLCluster
Automated IPFailover
Automated DBFailover
Typical Failovertime
Geographicredundancy
MySQLReplication
Built-in loadbalancing
-
8/8/2019 DrupalCon MySQL HA 2008-08-29
19/22
Related tools / Links
Linux Heartbeathttp://linux-ha.org/ DRBD
http:/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/
http://linux-ha.org/http://home/lenz/Documents/MySQL/Presentations/http:/drbd.org/http://www.lcic.org/ha.htmlhttp://www.redhat.com/cluster_suite/http://opensolaris.org/os/project/ha-mysql/http://opensolaris.org/os/project/ha-mysql/http://www.redhat.com/cluster_suite/http://www.lcic.org/ha.htmlhttp://home/lenz/Documents/MySQL/Presentations/http:/drbd.org/http://linux-ha.org/ -
8/8/2019 DrupalCon MySQL HA 2008-08-29
20/22
Tools/Links
MySQL Multi-Master ReplicationManagerhttp://code.google.com/p/mysql-master-master/
Maatkithttp://maatkit.sourceforge.net/ Mon scheduler and alert managementhttp://www.kernel.org/software/mon/ Continuent Tungsten Replicator
https://community.continuent.com/community/tungsten-replicator
http://code.google.com/p/mysql-master-master/http://maatkit.sourceforge.net/http://www.kernel.org/software/mon/https://community.continuent.com/community/tungsten-replicatorhttps://community.continuent.com/community/tungsten-replicatorhttp://www.kernel.org/software/mon/http://maatkit.sourceforge.net/http://code.google.com/p/mysql-master-master/ -
8/8/2019 DrupalCon MySQL HA 2008-08-29
21/22
-
8/8/2019 DrupalCon MySQL HA 2008-08-29
22/22
Thank you!Lenz Grimmer
mailto:[email protected]:[email protected]