Author: mcbrown
Date: 2007-08-04 07:43:57 +0200 (Sat, 04 Aug 2007)
New Revision: 7328
Log:
Adding HA chapter
Added:
trunk/refman-5.1/ha.xml
Added: trunk/refman-5.1/ha.xml
===================================================================
--- trunk/refman-5.1/ha.xml (rev 0)
+++ trunk/refman-5.1/ha.xml 2007-08-04 05:43:57 UTC (rev 7328)
Changed blocks: 1, Lines Added: 452, Lines Deleted: 0; 14874 bytes
@@ -0,0 +1,452 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+[
+ <!ENTITY % all.entities SYSTEM "all-entities.ent">
+ %all.entities;
+]>
+<chapter id="ha-overview">
+
+ <title>High Availability, Scalability, and DRBD</title>
+
+ <para>
+ When using MySQL you may need to ensure the availability or
+ scalability of your MySQL installation. Availability refers to the
+ ability to cope with, and if necessary recover from, failures on the
+ host, including failures of MySQL, the operating system, or the
+ hardware. Scalability refers to the ability to spread the load of
+ your application queries across multiple MySQL servers. As your
+ application and usage increases, you may need to spread the queries
+ for the application across multiple servers to improve response
+ times.
+ </para>
+
+ <para>
+ There are a number of solutions available for solving issues of
+ availability and scalability. The two primary solutions supported by
+ MySQL are MySQL Replication and MySQL Cluster. Further options are
+ available using third-party solutions such as DRBD (Distributed
+ Replicated Block Device) and Heartbeat, and more complex scenarios
+ can be solved through a combination of these technologies. These
+ tools work in different ways:
+ </para>
+
+ <itemizedlist>
+
+ <listitem>
+ <para>
+ <emphasis>MySQL Replication</emphasis> enables statements and
+ data from one MySQL server instance to be replicated to another
+ MySQL server instance. Without using more complex setups, data
+ can only be replicated from a single master server to any number
+ of slaves. The replication is asynchronous, so the
+ synchronization does not take place in real time, and there is
+ no guarantee that data from the master will have been replicated
+ to the slaves.
+ </para>
+
+ <itemizedlist>
+
+ <listitem>
+ <para>
+ <emphasis role="bold">Advantages</emphasis>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ MySQL Replication is available on all platforms supported by
+ MySQL, and since it isn't operating system-specific it can
+ operate across different platforms.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Replication is asynchronous and can be stopped and restarted
+ at any time, making it suitable for replicating over slower
+ links, partial links and even across geographical
+ boundaries.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Data can be replicated from one master to any number of
+ slaves, making replication suitable in environments with
+ heavy reads, but light writes (for example, many web
+ applications), by spreading the load across multiple slaves.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <emphasis role="bold">Disadvantages</emphasis>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Data can only be written to the master. In advanced
+ configurations, though, you can set up a multiple-master
+ configuration where the data is replicated around a ring
+ configuration.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ There is no guarantee that data on master and slaves will be
+ consistent at a given point in time. Because replication is
+ asynchronous there may be a small delay between data being
+ written to the master and it being available on the slaves.
+ This can cause problems in applications where a write to the
+ master must be available for a read on the slaves (for
+ example a web application).
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <emphasis role="bold">Recommended uses</emphasis>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Scale-out solutions that require a large number of reads but
+ fewer writes (for example, web serving).
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Logging/data analysis of live data. By replicating live data
+ to a slave you can perform queries on the slave without
+ affecting the operation of the master.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Online backup (availability), where you need an active copy
+ of the data available. You need to combine this with other
+ tools, such as custom scripts or Heartbeat. However, because
+ of the asynchronous architecture, the data may be
+ incomplete.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Offline backup. You can use replication to keep a copy of
+ the data. By replicating the data to a slave, you take the
+ slave down and get a reliable snapshot of the data (without
+ MySQL running), then restart MySQL and replication to catch
+ up. The master (and any other slaves) can be kept running
+ during this period.
+ </para>
+ </listitem>
+
+ </itemizedlist>
+
+ <para>
+ For information on setting up and configuring replication, see
+ <xref
+ linkend="replication"/>.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <emphasis>MySQL Cluster</emphasis> is a synchronous solution
+ that enables multiple MySQL instances to share database
+ information. Unlike replication, data in a cluster can be read
+ from or written to any node within the cluster, and information
+ will be distributed to the other nodes.
+ </para>
+
+ <itemizedlist>
+
+ <listitem>
+ <para>
+ <emphasis role="bold">Advantages</emphasis>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Offers multiple read and write nodes for data storage.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Provides automatic failover between nodes. Only transaction
+ information for the active node being used is lost in the
+ event of a failure.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Data on nodes is instantaneously distributed to the other
+ data nodes.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <emphasis role="bold">Disadvantages</emphasis>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Available on a limited range of platforms.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Nodes within a cluster should be connected via a LAN;
+ geographically separate nodes are not supported. However,
+ you can replicate from one cluster to another using MySQL
+ Replication, although the replication in this case is still
+ asynchronous.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <emphasis role="bold">Recommended uses</emphasis>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Applications that need very high availability, such as
+ telecoms and banking.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Applications that require an equal or higher number of
+ writes compared to reads.
+ </para>
+ </listitem>
+
+ </itemizedlist>
+
+ <para>
+ For information on MySQL Cluster, see
+ <xref linkend="mysql-cluster"/>.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <emphasis>DRBD (Distributed Replicated Block Device)</emphasis>
+ is a third-party solution from Linbit supported only on Linux.
+ DRBD creates a virtual block device (which is associated with an
+ underlying physical block device) that can be replicated from
+ the primary server to a secondary server. You create a
+ filesystem on the virtual block device, and this information is
+ then replicated, at the block level, to the secondary server.
+ </para>
+
+ <para>
+ Because the block device, not the data you are storing on it, is
+ being replicated the validity of the information is more
+ reliable than with data-only replication solutions. DRBD can
+ also ensure data integrity by only returning from a write
+ operation on the primary server when the data has been written
+ to the underlying physical block device on both the primary and
+ secondary servers.
+ </para>
+
+ <itemizedlist>
+
+ <listitem>
+ <para>
+ <emphasis role="bold">Advantages</emphasis>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Provides high availability and data integrity across two
+ servers in the event of hardware or system failure.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Ensures data integrity by enforcing write consistency on the
+ primary and secondary nodes.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <emphasis role="bold">Disadvantages</emphasis>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Only provides a method for duplicating data across the
+ nodes. Secondary nodes cannot use the DRBD device while data
+ is being replicated, and so the MySQL on the secondary node
+ cannot be simultaneously active.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Cannot provide scalability, since secondary nodes don't have
+ access to the secondary data.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <emphasis role="bold">Recommended uses</emphasis>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ High availability situations where concurrent access to the
+ data is not required, but instant access to the active data
+ in the event of a system or hardware failure is required.
+ </para>
+ </listitem>
+
+ </itemizedlist>
+
+ <para>
+ For information on configuring DRBD and configuring MySQL for
+ use with a DRBD device, see <xref linkend="replication-drbd"/>.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <emphasis>Heartbeat</emphasis> is a third party software
+ solution for Linux. It is not a data replication or
+ synchronization solution, but a solution for monitoring servers
+ and switching active MySQL servers automatically in the event of
+ failure. Heartbeat needs to be combined with MySQL Replication
+ or DRBD to provide automatic failover.
+ </para>
+ </listitem>
+
+ </itemizedlist>
+
+ <para>
+ The information and suitability of the various technologies and
+ different scenarios is summarized in the table below.
+ </para>
+
+ <informaltable>
+ <tgroup cols="5">
+ <colspec colwidth="20*"/>
+ <colspec colwidth="20*"/>
+ <colspec colwidth="20*"/>
+ <colspec colwidth="20*"/>
+ <colspec colwidth="20*"/>
+ <thead>
+ <row>
+ <entry>Requirements</entry>
+ <entry>MySQL Replication</entry>
+ <entry>MySQL Replication + Heartbeat</entry>
+ <entry>MySQL Heartbeat + DRBD</entry>
+ <entry>MySQL Cluster</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><emphasis role="bold">Availability</emphasis></entry>
+ </row>
+ <row>
+ <entry>Automated IP failover</entry>
+ <entry>No</entry>
+ <entry>Yes</entry>
+ <entry>Yes</entry>
+ <entry>No</entry>
+ </row>
+ <row>
+ <entry>Automated database failover</entry>
+ <entry>No</entry>
+ <entry>No</entry>
+ <entry>Yes</entry>
+ <entry>Yes</entry>
+ </row>
+ <row>
+ <entry>Typical failover time</entry>
+ <entry>User/script-dependent</entry>
+ <entry>Varies</entry>
+ <entry>< 30 seconds</entry>
+ <entry>< 3 seconds</entry>
+ </row>
+ <row>
+ <entry>Automatic resynchronization of data</entry>
+ <entry>No</entry>
+ <entry>No</entry>
+ <entry>Yes</entry>
+ <entry>Yes</entry>
+ </row>
+ <row>
+ <entry>Geographic redundancy support</entry>
+ <entry>Yes</entry>
+ <entry>Yes</entry>
+ <entry>Yes, when combined with MySQL Replication</entry>
+ <entry>Yes, when combined with MySQL Replication</entry>
+ </row>
+ <row>
+ <entry><emphasis role="bold">Scalability</emphasis></entry>
+ </row>
+ <row>
+ <entry>Built-in load balancing</entry>
+ <entry>No</entry>
+ <entry>No</entry>
+ <entry>No</entry>
+ <entry>Yes</entry>
+ </row>
+ <row>
+ <entry>Supports Read-intensive applications</entry>
+ <entry>Yes</entry>
+ <entry>Yes</entry>
+ <entry>Yes, when combined with MySQL Replication</entry>
+ <entry>Yes</entry>
+ </row>
+ <row>
+ <entry>Supports Write-intensive applications</entry>
+ <entry>No</entry>
+ <entry>No</entry>
+ <entry>Yes</entry>
+ <entry>Yes</entry>
+ </row>
+ <row>
+ <entry>Maximum number of nodes per group</entry>
+ <entry>One master, multiple slaves</entry>
+ <entry>One master, multiple slaves</entry>
+ <entry>One active (primary), multiple passive (secondary) nodes</entry>
+ <entry>255</entry>
+ </row>
+ <row>
+ <entry>Maximum number of slaves</entry>
+ <entry>Unlimited (reads only)</entry>
+ <entry>Unlimited (reads only)</entry>
+ <entry>Unlimited (reads only)</entry>
+ <entry>Unlimited (reads only)</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+
+ <xi:include href="../refman-common/replication-drbd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
+
+</chapter>
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r7328 - trunk/refman-5.1 | mcbrown | 4 Aug |