mysql whitepaper mysql ha solutions

Upload: jean-georges-pinna

Post on 09-Apr-2018

256 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    1/26

    MySQL High Availability Solutions

    An Overview of MySQL High Availability Solutions

    A MySQL Technical White Paper August 2006

    Copyright 2006, MySQL AB

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    2/26

    Table of Contents

    1 Executive Summary..............................................................................................................3

    2 High Availability Solutions from MySQL ............................................................................3 2.1 MySQL Replication ..........................................................................................................................................3 2.2 MySQL Replication for Disaster Recovery ......................................................................................................7 2.3 MySQL Cluster.................................................................................................................................................8 2.4 MySQL Cluster and Replication.....................................................................................................................12

    3 Third-Party High Availability Solutions for MySQL .........................................................13

    3.1 Linux Heartbeat & MySQL Replication ..........................................................................................................13 3.2 Linux Heartbeat, Block-Replication & MySQL ...............................................................................................15 3.3 Load Balancing with MySQL Replication.......................................................................................................17 3.4 MySQL with Shared Storage and Clustering Agents.....................................................................................19

    3.5

    High Availability/Performance Networking Dolphin SCI Interconnect ........................................................20

    3.6 Operating System Clustering Solutions .........................................................................................................21 3.7 High Availability Middleware - Continuent m/Cluster.....................................................................................21 3.8 High Availability Middleware High-Availability RSF-1.................................................................................21

    4 Implementing a MySQL High Availability Solution ..........................................................22

    4.1 MySQL Professional Services .......................................................................................................................22 4.2 MySQL Certified Partners and Products........................................................................................................23 4.3 MySQL Training .............................................................................................................................................23 4.4 MySQL Network.............................................................................................................................................23

    5 Why MySQL?.......................................................................................................................24

    5.1 Scalability and Flexibility ................................................................................................................................24 5.2 High Performance ..........................................................................................................................................24 5.3 High Availability..............................................................................................................................................24 5.4 Robust Transactional Support .......................................................................................................................24 5.5 Web and Data Warehouse Strengths ............................................................................................................24 5.6 Strong Data Protection...................................................................................................................................24 5.7 Comprehensive Application Development.....................................................................................................25 5.8 Management Ease.........................................................................................................................................25 5.9 Open Source Freedom and 24 x 7 Support...................................................................................................25 5.10 Lowest Total Cost of Ownership................................................................................................................25

    6 Conclusion ..........................................................................................................................26

    7 About MySQL......................................................................................................................26

    8 Resources ...........................................................................................................................26

    8.1 White Papers .................................................................................................................................................26 8.2 Case Studies..................................................................................................................................................26 8.3 Press Releases, News and Events................................................................................................................26 8.4 Live Webinars ................................................................................................................................................26 8.5 Webinars on Demand ....................................................................................................................................26

    Copyright 2006, MySQL AB Page 2 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    3/26

    1 Executive Summary

    In todays business world, information and the access to it, forms not only the infrastructure, but often theentire revenue model for some organizations. Therefore, maintaining the availability and access to this

    information has become increasingly more important and common place for businesses big and small.High availability has traditionally been the domain of mission and business critical systems such as,applications, databases and storage networks. However, less critical systems are beginning to takeadvantage of the many low-cost, high availability solutions currently available on the market.

    The demands placed on these information systems include not only ensuring the availability of importantdata, but also the efficient sharing of resources and the existing computing infrastructure. A highavailability solution should deliver the greatest amount of data and application availability across thediverse technology stacks currently found in many modern enterprises. These technology stacks includevarious operating systems, applications, hardware components, and can often span multiple geographiclocations. More often then not, it is a database that sits behind many of these critical applications andinformation assets. In A Guide to Database High Availability of this white paper series, we introducedgeneral database high availability architectures and concepts. We also explored some considerations to

    take into account when selecting a high availability database solution. In this paper, we will examine ingreater detail the high availability solutions provided by MySQL, including MySQL Replication and MySQLCluster. We will also include an introduction to MySQL Professional Services and the MySQL network ofcertified partners and products.

    2 High Availability Solutions from MySQL

    MySQL offers a wide array of options when selecting a high availability solution. These include MySQLReplication, MySQL Cluster, free and open-source solutions, as well as, products from our network ofcertified partners. In this section we focus on high availability solutions available directly from MySQL.

    2.1 MySQL Replication

    MySQL natively supports one-way, asynchronous replication. MySQL Replication works by simply havingone server act as a master, while one or more servers act as slaves. This is in contrast to thesynchronous replication which is a characteristic of MySQL Cluster.

    Asynchronous data replication means that data is copied from one machine to another, with a resultantdelay. Often this delay is determined by networking bandwidth, resource availability or a predeterminedtime interval set by the administrator. However, with the correct components and tuning, replication itselfcan appear to be almost instantaneous to most applications. Synchronous data replication implies thatdata is committed to one or more machines at the same time, usually via what is commonly known as atwo-phase commit.

    In standard MySQL Replication, the master server writes updates to its binary log files and maintains an

    index of those files in order to keep track of the log rotation. The binary log files serve as a record ofupdates to be sent to slave servers. When a slave connects to its master, it determines the last position ithas read in the logs on its last successful update. The slave then receives any updates which have takenplace since that time. The slave subsequently blocks and waits for the master to notify it of new updates.

    Below in Figure 1 is an illustration of a basic master to slave MySQL Replication configuration.

    Copyright 2006, MySQL AB Page 3 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    4/26

    Web/AppServer

    Web/AppServer

    Writes & ReadsWrites & Reads

    MySQL Master

    I/OThread

    SQLThread

    WritesWrites

    relaybinlog

    MySQL Slave

    mysqld

    data

    index &binlogs

    mysqld

    databinlogReplication

    Figure 1

    Replication offers the benefits of reliability, performance, and ease of use:

    In the event the master fails, the application can be designed to switch to the slave. Better response time for clients can be achieved by splitting the load for processing client queries

    between the master and slave servers. Queries which simply read data, such as SELECTs, maybe sent to the slave in order to reduce the query processing load on the master. Statements thatmodify data should be sent to the master so that the data on the master and slave do not get outof synch. This load-balancing strategy is effective if non-updating queries dominate. (This isnormally the case.)

    Another benefit of using replication is that database backups can be performed using a slaveserver without impacting the resources on the master. The master continues to process updateswhile the backup is being made.

    In Figure 2 we illustrate the above points.

    Copyright 2006, MySQL AB Page 4 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    5/26

    Master Server Slave Server

    Writes

    Index &Bin LogRotation

    Writes

    Reads

    Possible Roles Fail over server Used for performing backups Read load balancing Additional slaves allow Scale-Out

    BackupsBackups

    Writes & Reads

    Web/AppServer

    Web/AppServer

    ReplicationReplication

    Figure 2

    Although MySQL Replication can solve many high availability design issues in a simple and straightforward manner, two problems inherent to the configuration do need to be addressed by developersand/or administrators.

    First, the application interacting with the databases must become replication aware. By this we meanthat the application must be coded to write only to the master and always read from the slave.

    The second issue revolves around creating a strategy for initiating a fail over in the event of a hardware orsoftware problem on the master. Beyond that, there should also be a process for returning the system toits original configuration before the failure.

    Below in Figure 3 we illustrate how a fail over would likely be configured in a standard master to slaveconfiguration.

    Copyright 2006, MySQL AB Page 5 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    6/26

    Master Server Slave Server

    Writes

    Web/AppServer

    Web/AppServer

    ReplicationReplication

    M a n u a l

    F a i l O v e r M a n u a l

    F a i l O v e r

    X

    X

    F a i l O v e r

    X Writes & Reads

    Writes

    Index &Bin LogRotation

    X

    Figure 3

    Below in Figure 4 we illustrate some other replication topologies and the general recommendation if itsupported, support with reservations, or prohibitive.

    Copyright 2006, MySQL AB Page 6 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    7/26

    Master > Slave

    Masters > Slave (Multi-Source)

    Master < > Master (Multi-Master)

    Master > Slaves

    Circular (Multi-Master)

    Master > Slave > Slaves

    Figure 4

    Having multiple masters configured within your replication topology is possible, but does raise issues notpresent in a single master system. Special attention should be paid to understand the limitations andpossible problems of such a configuration.

    The most important issue to be aware of is the very strong possibility that the databases involved in the

    replication scheme could easily get out of synch. When you are using replication, all updates should beperformed on the master server. Otherwise, you must always be careful to avoid conflicts between theupdates users make on the master and updates they make on the other server. The strategy developersemploy in order to over come this issue, is called, conflict resolution.

    Out of the box MySQL Replication does not have automated solutions for handling conflict resolution orfail over. In order to avoid additional application coding or scripting, it may merit considering some of theother high availability solutions we will present later in the paper that automate some of these issues.

    2.2 MySQL Replication for Disaster Recovery

    MySQL Replication can be used as a transporting mechanism for enabling geographic redundancy in theevent of a local disaster. Whether you have implemented a standard MySQL server, MySQL Cluster or

    any of the high availability solutions presented in this paper, MySQL Replication gives you the ability tosupport a replicated environment to a remote location for disaster recovery purposes. Of course there arespecial requirements and considerations when implementing this type of architecture. The bandwidthspeed of the replication, the security of the transporting protocol and the expected time for applications tofail over, are some of these key considerations.

    Copyright 2006, MySQL AB Page 7 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    8/26

    2.3 MySQL Cluster

    MySQL Cluster was designed to meet the throughput and response time requirements needed by someof the most demanding enterprise applications in the world. In a nutshell, MySQL Cluster can bedescribed as a shared-nothing, synchronous database cluster which supports automatic fail over,transactions and in-memory data storage without any special networking, hardware or storage

    requirements. Designing the system in this way allows MySQL Cluster to deliver both highly availabilityand reliability, since single points of failure have been eliminated. Any node can fail without affecting thesystem as a whole. An application, for example, can continue executing transactions even though a datanode has failed. MySQL Cluster has also proven to handle tens of thousands of distributed transactionsper second, replicated across data nodes.

    As of version 5.1, MySQL Cluster supports data storage not only in main memory (RAM), but also ondisk. This arrangement allows applications to leverage the benefits of in-memory data storage, which notonly increases the performance of the application, but also limits I/O bottlenecks by asynchronouslywriting transaction logs to disk. But, with the introduction of disk-data support, ever larger data sets thatdo not require the performance characteristics granted to in-memory data, can be leveraged within thecluster.

    MySQL Cluster delivers an extremely fast fail over time with sub-second responses so your applicationscan recover quickly in the event of a software, network or hardware failure. MySQL Cluster usessynchronous replication to propagate transaction information to all the appropriate data nodes. This alsoeliminates the time consuming operation of recreating and replaying log files as is typically required byclusters employing shared-disk architectures. MySQL Cluster data nodes are also able to automaticallyrestart, recover, and dynamically reconfigure themselves in the event of failures, without developershaving to program any fail over logic into their applications.

    MySQL Cluster implements an automatic node recovery that ensures any fail over to another data nodewill contain a consistent set of data. Should all the data nodes fail due to hardware faults, MySQL Clusterensures an entire system can be safely recovered in a consistent state by using a combination ofcheckpoints and log execution. Furthermore, MySQL Cluster ensures systems are available andconsistent across geographies by enabling entire clusters to be replicated across regions.

    Below is brief description of the main components of a MySQL Cluster.

    Data Nodes are the main nodes of the system. All data is stored on these nodes. Data isreplicated between data nodes to ensure it is continuously available in case one or more of thedata nodes fail. These data nodes in turn, handle all database transactions.

    Management Nodes handle the cluster configuration and are used to change the setup of thesystem. Only one management server node is required, but there is also the option of runningadditional management nodes in order to increase the level of fault tolerance required. Themanagement node is only used at startup or during a system re-configuration, which means thecluster is operable without the management node being online.

    MySQL Nodes are the MySQL Servers accessing the clustered data nodes. By incorporating thisdesign, the MySQL Server provides developers a standard SQL interface to program theirapplications against. This eliminates the need for any special application programming in order tointeract with the cluster.

    Below in Figure 5 will illustrate an example MySQL Cluster architecture which provides a minimumdegree of redundancy for all the MySQL components. Depicted in this configuration is a 6 node clusterconsisting of:

    2 Management Node 2 Data Nodes 2 MySQL Server Nodes

    Copyright 2006, MySQL AB Page 8 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    9/26

    MySQL Server or NDB APIfor all Writes & Reads

    DataNodeDataNode

    DataNodeDataNode

    NDBStorage Engine

    ManagementServer

    ManagementServer

    NDB APINDB API

    MySQL Cluster

    Memory&

    Disk

    ManagementServer

    ManagementServer

    Web/AppServer

    Web/AppServer

    Web/AppServer

    Web/AppServer

    MySQLServerMySQLServer

    MySQLServerMySQLServer

    Figure 5

    At this point, it merits taking a closer look at how MySQL Cluster redundantly distributes data across thedata nodes. First, data stored in the cluster is broken down into data fragments. These data fragmentsare in turn replicated by the number of replicas which have been specified, across the available datanodes. For example, in the illustration depicted in Figure 6, we have taken four fragments of data and inturn, replicated and distributed them across the four available data nodes. Each fragment of data has

    been replicated twice. As a result, the cluster labels them as primary and secondary data fragments.Node Groups are then created amongst the data nodes. Data nodes which store complimentary replicascomprise Node Groups.

    Copyright 2006, MySQL AB Page 9 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    10/26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    11/26

    MySQLServerMySQLServer

    DataNodeDataNode

    DataNodeDataNode

    NDBStorage Engine

    ManagementServer

    ManagementServer

    NDB APINDB API

    MySQL Cluster

    DataNodeDataNode

    DataNodeDataNode

    MySQLServerMySQLServer

    MySQLServerMySQLServer

    ManagementServer

    ManagementServer

    MySQLServerMySQLServer

    MySQLServerMySQLServer

    Figure 8

    Copyright 2006, MySQL AB Page 11 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    12/26

    MySQLServerMySQLServer

    DataNodeDataNode

    DataNodeDataNode

    NDBStorage Engine

    ManagementServer

    ManagementServer

    NDB APINDB API

    MySQL Cluster

    DataNodeDataNode DataNodeDataNode

    MySQLServerMySQLServer

    MySQLServerMySQLServer

    ManagementServer

    ManagementServer

    MySQLServerMySQLServer

    MySQLServerMySQLServer

    X X X X

    X X X

    Figure 9

    2.4 MySQL Cluster and Replication

    MySQL 5.1 introduces support for row-based replication. Previously, MySQL Cluster was unable to takeadvantage of the default statement-based replication available in versions 4.1 and 5.0. Now, with supportfor row-based replication, there is the ability to replicate from a MySQL Cluster to another MySQL Cluster,or to other MySQL Servers and their supported storage engines. It is now possible to create the followingmaster/slave configurations:

    MySQL Cluster to MySQL Cluster MySQL Server (MyISAM, InnoDB, etc) to MySQL Cluster MySQL Cluster to MySQL Server

    Below in Figure 8 we illustrate a simple MySQL Cluster to MySQL Cluster replication architecture.

    Copyright 2006, MySQL AB Page 12 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    13/26

    Web/AppServer

    Web/AppServer

    Writes & ReadsWrites & Reads

    MySQL Master

    mysqld

    index &binlogs

    Data NodesData Nodes

    MySQL Cluster

    NDB

    binlog_index

    apply_status

    I/OThread

    SQLThread

    WritesWrites

    relaybinlog

    MySQL Slave

    mysqld

    binlog

    MySQL Cluster

    Data NodesData Nodes

    NDB

    Replication

    Figure 8

    In almost all the scenarios where MySQL replication has been traditionally leveraged in the past, MySQLCluster can now be as well. Some popular reasons for implementing MySQL Cluster Replication include:

    To enable scale-out In order to achieve higher availability within the data center or across a geographic WAN Read and write load balancing

    For use in maintenance operations such as, upgrades or backups

    3 Third-Party High Availability Solutions for MySQL

    In this section we highlight a few high availability solutions currently available from the open sourcecommunity and from our network of certified partners.

    3.1 Linux Heartbeat & MySQL Replication

    The Linux-HA project offers a high availability solution commonly referred to as Linux Heartbeat. LinuxHeartbeat ships as part of several Linux distributions, as well as, within several embedded highavailability systems. This solution can also be used for other applications besides databases servers,such as mail servers, web servers, file servers, and DNS servers.

    Linux Heartbeat implements a heartbeat-protocol. A heartbeat-protocol means that messages are sent atregular intervals between two or more nodes. If a message is not received from a node within a giveninterval, then it is assumed the node has failed and some type of fail over or recovery action is required.Linux Heartbeat is typically configured to send these heartbeat messages over standard Ethernetinterfaces, but it does also support the use of serial links.

    Copyright 2006, MySQL AB Page 13 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    14/26

    When Linux Heartbeat is initially configured, a master node is selected. When the heartbeat starts up onthe master node, it will assign a virtual IP address to the masters network interface. This interface will bethe manner in which external processes, applications and users will access the node. If the master nodefails, then another node within the cluster will start up an interface for this virtual IP address and usegratuitous ARP to ensure that all traffic bound for this address is received by this machine. (GratuitousARP (Address Resolution Protocol) is when a host sends an ARP request to resolve its own IP address.)This method of fail-over is often referred to as IP Address Takeover.

    Each virtual IP address is considered to be a resource. Resources are encapsulated as programs thatwork similarly to Unix init scripts. This means that the resource can be started and stopped, and it canbe queried to see if it is running. In this manner, Linux Heartbeat is able to start and stop these resources(virtual IPs) depending on the status of the other node that it is communicating with using this heartbeat-protocol.

    The integration of MySQL into a Linux Heartbeat system will typically exhibit the following qualities:

    Easy to configure with low architectural complexity Open source Low cost No special hardware or networking components required Virtual IP management is automatically handled Data replication will still remain asynchronous, so there could be potential issues with confirming

    that all applicable data has been transferred to the slave server in the event of a fail over The above issue may be further complicated by additional failures in the middle of a fail over Repairing a fail over can also become complex

    In Figure 10 we illustrate two MySQL Servers in a master/slave configuration in which Linux Heartbeat isleveraged.

    = Private IP =

    10.10.10.21

    Master Server Slave Server

    Linux Heartbeat= Virtual IP =

    10.10.10.10

    = Private IP =

    10.10.10.20

    Web/AppServer

    Web/AppServer

    ReplicationReplication

    Figure 10

    Copyright 2006, MySQL AB Page 14 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    15/26

    In Figure 11 we illustrate a simulated fail over in which the master MySQL Server has suffered a failure. Inturn, Linux Heartbeat automatically redirects the application to the slave server. Notice however that thedatabase administrator will have to employ some mechanism (manual or automated) to ensure that all theappropriate data has been replicated from the master to the slave in the event of a fail over.

    ReplicationReplication= Private IP =

    10.10.10.21

    Master Server Slave Server

    = Private IP =

    10.10.10.20

    X

    X

    X

    Linux Heartbeat= Virtual IP =

    10.10.10.10 F a i l O v e r

    Web/AppServer

    Web/AppServer

    Figure 11

    For more information visit: http://linux-ha.org/

    3.2 Linux Heartbeat, Block-Replication & MySQLDistributed Replicated Block Device or DRBD as it is more commonly known, is a Linux kernel moduletypically leveraged in conjunction with some scripts that runs on top of standard IP networks without anyspecial networking components. DRBD creates a distributed storage system, which can be thought of aspossessing similar attributes to that of a network RAID. At a high level, DRBD takes data, writes it to alocal disk and then transports it to another node.

    All the devices (or local partitions) which comprise the DRBD configuration have a state, which is eitherprimary or secondary. DRBD creates, on all nodes, a link between a virtual device and a local partition.All the writing is done on the primary node, which then transfers the data to a lower-level block device(local partition) and propagates the data to the remaining nodes. These secondary nodes simply transferdata to the lower-level block device. All the reads are performed on the local partitions. It should be noted

    that DRBD can also be used in conjunction with shared storage devices.In the configuration illustrated in Figure 12, we are using a combination of Linux Heartbeat for virtual IPmanagement, DRBD for storage management and standard MySQL.

    This system can be characterized with the following attributes:

    Higher complexity in the initial installation and configuration No special networking components required Excellent performance - as blocks are being replicated, not rows of data

    Copyright 2006, MySQL AB Page 15 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    16/26

    DRBD manages any inconsistencies of data during a failure DRBD hides the complexity of many required recovery actions Linux Heartbeat manages fail over and virtual IPs

    = Private IP =

    10.10.10.21

    Active Server Passive Server

    = Private IP =

    10.10.10.20

    Primary DRBD Secondary DRBDDRBD

    Linux Heartbeat= Virtual IP =

    10.10.10.10

    Web/App

    Server

    Web/App

    Server

    Figure 12

    In the event the primary node fails, DRBD will promote one of the secondary nodes to a primary state.

    DRBD operates at the disk block-level and not the file system level. In turn, if the file system being used isnot journaling-capable, a verification of the integrity of the file system should be performed after anysecondary to primary fail over.

    When the failed primary node returns to the configuration, the system may (or may not) promote it to theprimary state after the data synchronization is performed. Only data which has changed will need to beresynchronized. In this way, DRBD provides a very efficient resynchronization process. It is often possibleto have a total resynchronization time of under 5 minutes, regardless of device size (currently up to 4TB),even after the crash of an active node.

    Although DRBD has its own way of determining which node should be the primary, a cluster manager isfrequently used to handle state transitions. Along with these state transitions, the cluster manager mustalso mount the file system it uses on top of the virtual device already created by DRBD. Below in Figure13 we illustrate how a fail over would be handled in this configuration.

    Copyright 2006, MySQL AB Page 16 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    17/26

    = Private IP =

    10.10.10.21

    Active Server Passive Server

    = Private IP =

    10.10.10.20

    DRBDPrimary DRBD Secondary DRBD

    X

    X

    A c t i v e

    P r i m a r y D

    R B D

    Linux Heartbeat= Virtual IP =

    10.10.10.10

    Web/AppServer

    Web/AppServer

    X

    Figure 13

    For more information concerning DRBD visit: http://linux-ha.org/

    3.3 Load Balancing with MySQL Replication

    In this scenario we use a hardware-based load balancing solution over a software based one to manageour virtual IPs. The characteristics of this system are very similar to those of the Linux Heartbeatconfiguration described in Section 3.1. The added benefit of this configuration is that we gain a morerobust, hardware centric virtual IP management solution. Typically a hardware-based load balancingsolution will offer many more interoperability options then a software solution, which will likely be limited tothe operating systems it can run on and interact with. The configuration time and complexity for this typeof solution is usually very low. One consideration to bear in mind with this type of a solution is cost, whichcan be quite high.

    Below in Figure 14 is a system employing a hardware load balancer with MySQL Replication.

    Copyright 2006, MySQL AB Page 17 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    18/26

    = Private IP =

    10.10.10.21

    Master Server Slave Server

    = Private IP =

    10.10.10.20

    Load Balancer= Virtual IP =

    10.10.10.10

    Web/AppServer

    Web/AppServer

    ReplicationReplication

    Figure 14

    Below in Figure 15, we illustrate how the fail over of the master MySQL Server is handled.

    = Private IP =

    10.10.10.21

    Master Server Slave Server

    = Private IP =

    10.10.10.20

    Load Balancer= Virtual IP =

    10.10.10.10 F a i l O v

    e r

    X

    Web/AppServer

    Web/AppServer

    ReplicationReplicationX

    Figure 15

    Copyright 2006, MySQL AB Page 18 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    19/26

    As with the Linux Heartbeat solution, the database administrator will have to employ some mechanism(manual or automated) to ensure that all the appropriate data has been replicated from the master to theslave in the event of a fail over.

    3.4 MySQL with Shared Storage and Clustering Agents

    MySQL high availability solutions which employ shared storage and clustering agents offer manyadvantages over the configurations already presented. However, this type of a solution is typicallycharacterized as being the most expensive, as it requires additional storage, hardware and softwarecomponents.

    This type of a configuration is likely to be limited to the Active/Passive configuration. This is due to thefact that MySQL does not permit multiple instances to concurrently access the same data store. In thistype of a cluster, a fully redundant instance of each node is maintained, but is only brought online whenthe active node fails. Often times, as the name suggests, this hardware remains passive and under-utilized until a fail over is initialized. The characteristics of this type of a configuration can be listed assuch:

    High cost in terms of storage, hardware and software components Does not lend itself to a scale-out methodology Idle resources can be viewed as a liability Long fail over times Initial complexity may be high, but long-term administration should be lower Virtual IP and fail over management is all handled automatically and transparently Allows for the testing of production disaster recovery plans without disruption

    Below in Figure 15 we illustrate how a typical MySQL high availability solution may be designed inconjunction with clustering agent software.

    = Private IP =

    10.10.10.21

    Active Server Passive Server

    Cluster Management= Virtual IP =

    10.10.10.10

    Application Server

    = Private IP =

    10.10.10.20

    Cluster AgentCluster AgentCluster AgentCluster Agent

    SAN

    Copyright 2006, MySQL AB Page 19 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    20/26

    Figure 15

    Below in Figure 16 we illustrate how a fail over would be handled in this configuration.

    = Private IP =

    10.10.10.21

    Active Server Passive Server

    Cluster Management= Virtual IP =

    10.10.10.10

    Application Server

    = Private IP =

    10.10.10.20

    Cluster AgentCluster AgentCluster AgentCluster Agent

    SAN

    X A c t i v e

    X

    X

    Figure 16

    3.5 High Availability/Performance Networking Dolphin SCI Interconnect

    Dolphin SCI interconnect adapters enable users of MySQL Cluster to transparently achieve superiordatabase performance. The key to achieving overall superior performance is maximizing the efficiency ofthe underlying server cluster. Dolphin has perfected the SCI interconnect technology with the innovativeDolphin SuperSockets Software to deliver the fastest memory-to memory data transfers.

    The use of Dolphin SuperSockets requires the installation of only the Dolphin SCI hardware, device driverand the Dolphin SuperSockets Library. This leaves the existing applications and MySQL Cluster softwaretotally untouched. The Dolphin SuperSockets library ensures full transparency for all applications usingsocket communication, meaning that all versions of MySQL Cluster can be used with DolphinSuperSockets.

    Redundant SCI networks can be used for high availability applications demanding immediate fail overcapabilities. The SuperSockets software will transparently do channel bonding for increased performancewhile both redundant networks are available.

    The solution is also highly scalable from two to dozens of nodes, all connected using a low-cost SCI ring,a standard SCI switch or the innovative two or three dimensional Torus SCI topology.

    Individual database records and queries are relatively small entities of data and for clusters to be efficientand scalable, these data items need to be moved between processors with the lowest possible latencyand overhead. This is why performance and scalability of MySQL Cluster improve significantly withDolphin's interconnect.

    Copyright 2006, MySQL AB Page 20 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    21/26

    For more information visit: http://www.dolphinics.com/

    3.6 Operating System Clustering Solutions

    We have already touched on a few Linux clustering and high availability solutions, but it does also merit

    mentioning the availability of other clustering solutions which are available specifically from the operatingsystem vendors. These clustering products can be configured to work with MySQL as a service.

    Sun Solaris Sun ClusterFor more information visit http://www.sun.com/software/cluster/

    Microsoft Windows Clustering ServicesFor more information visit http://www.microsoft.com/

    Red Hat Cluster SuiteFor more information visit http://www.redhat.com/software/rha/cluster/

    3.7 High Availability Middleware - Continuent m/Cluster

    Continuent m/Cluster is the leading middleware high availability and scalability solution for MySQL.m/cluster supports all the most popular MySQL storage engine types: MyISAM, InnoDB and MEMORY.

    The product provides high availability services by ensuring any number of MySQL database servers arefully in-synch at all times. Fast and automatic fail over ensures that any server can transparently handlethe queries from a failed or out-of-service node. Load balancing ensures performance scalability. Newnodes can be added on-the-fly allowing you to add capacity without taking the system out of service.

    m/Cluster creates a single virtual database view of multiple MySQL databases and is designed tointegrate seamlessly with your MySQL-based application. The architecture of m/cluster is designed to usecommodity hardware and does not require any special hardware devices like storage area networks orload balancers.

    For more information visit: http://www.continuent.com/

    3.8 High Availability Middleware High-Availability RSF-1

    High-Availabilitys premier product, RSF-1, has been delivered to an impressive set of customersworldwide across virtually all market segments, where 24x7 application and services availability is amandatory requirement. The technology has been proven as an innovative, cost-effective solution thatmaximizes the availability of customers business IT and internet-facing functions. Although focusedmainly in the Sun Solaris and rapidly emerging Linux server markets, This technology is also available forother processor platforms including leading proprietary IBM and HP UNIX architectures, as well assystems using Intel x86 and AMD Opteron processors.

    RSF-1 resides between the storage volume management and application layers typically found in:

    Web servers Application servers Firewall servers Database servers

    RSF-1s forte is its does exactly what it says on the tin functionality which provides an uncomplicated,yet powerful, configuration and management framework enabling customers to deploy high availabilitysolutions in a matter of hours, rather than days or weeks.

    Copyright 2006, MySQL AB Page 21 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    22/26

    Through the use of optional monitoring agents for many popular databases, middleware products andend-user applications, RSF-1 is able to switch mission-critical applications and services from serversexperiencing network, hardware, operating system or application failures, to alternative servers located inthe appropriate cluster, thus minimizing downtime and impact to the customers operations.

    By incorporating feature-rich command line and GUI interfaces, RSF-1 enables manual and automatedfailure recovery for up to 200 mission-critical applications and services within a 1 64 node cluster.

    For more information visit: http://www.high-availability.com/

    4 Implementing a MySQL High Availability Solution

    In the following sections we look at several options MySQL offers for implementing, maintain andincreasing your knowledge of some of the high availability solutions we have presented.

    4.1 MySQL Professional Services

    MySQL AB offers a full range of consulting services. Whether you are starting a new project, needing to

    optimize an existing MySQL application, or migrating from a proprietary database to MySQL, we have anaffordable solution for you. A high availability solution can be realized with either MySQL Cluster orMySQL Pro; the technology can be selected during architecture and design phase. Configure MySQL orMySQL Cluster to work with HA Technologies (e.g. DRBD, SAN, Shared SCSI, Heartbeat, etc), asrequired.

    Using industry best practices and proven methodologies, your MySQL certified consultant will help youdeliver on-time and on-budget.

    Our popular packaged consulting solutions make it easy to get the help you need in a set timeframe at aset price, with no hidden costs. They are easy to budget for, easy to buy, and they will deliver resultsquickly. For each engagement, you have the undivided attention of a certified senior MySQL consultanton your premises.

    Then the MySQL High-Availability Solution is for you. Our senior consultants use proven methodologiesand expertise in database Clustering, Replication, Fail-Over, Fault-Tolerance and other HA techniques toguide your team. We cover the process of designing, testing, deploying and operating a modern databaseinfrastructure that delivers on your precise requirements for performance and high-availability.

    Our consultants are specialists in:

    Online Transaction Processing (OLTP) Data Warehousing Online Analytical Processing (OLAP) Web Portals Telecommunications Applications

    Packages offered include:

    MySQL Rapid Response Consulting MySQL Architecture & Design MySQL Performance Tuning & Optimization MySQL DBA MySQL Scale-Out, High-Availability and Replication Jumpstart MySQL Migration Jumpstart

    Copyright 2006, MySQL AB Page 22 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    23/26

    MySQL Cluster Jumpstart MySQL Remote DBA MySQL High Availability Solution Application Design Application Development Enhancements & Extensions

    For more information visit:http://www.mysql.com/consulting/

    4.2 MySQL Certified Partners and Products

    MySQL has several partners which offer high availability solutions. Weve highlight a few solutions in thecourse of this paper, but for a complete listing of high availability partners and their products, please visit:http://solutions.mysql.com/.

    4.3 MySQL TrainingMySQL offers a comprehensive set of MySQL training courses. To see the complete list of courses andschedules, visit http://www.mysql.com/training/

    MySQL 5.1 High AvailabilityThis course is designed for experienced database administrators and system architects that wantto analyze and form a basis of understanding different high availability options, includingclustering and replication solutions within MySQL. This course will provide the tools required tomake the decision of what high availability solution is appropriate and how to implement a systemwith the correct design.

    MySQL for DevelopersThis instructor-led, hands-on class will teach Developers techniques for building databaseapplications on MySQL. This course covers essential SQL for data design, querying, andprogramming. In addition, the class will prepare students for the MySQL Developer certification.

    MySQL for DBAsThis instructor led, hands-on class will teach DBAs to install, configure, tune, secure, monitor, andmanage their MySQL database servers. In addition, the class will prepare students for theMySQL DBA certification.

    4.4 MySQL Network

    MySQL Network provides a comprehensive set of enterprise-grade software, support and servicesdirectly from the developers of MySQL to ensure the highest levels of reliability, security and uptime. As aproactive service that helps you eliminate problems before they occur, MySQL Network gives youeverything you need in a single, unified offering to successfully develop and deploy business criticalapplications using MySQL. To learn more, visit http://www.mysql.com/network/

    Copyright 2006, MySQL AB Page 23 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    24/26

    5 Why MySQL?

    5.1 Scalability and Flexibility

    The MySQL database server provides the ultimate in scalability, sporting the capacity to handle deeplyembedded applications with a footprint of only 1MB to running massive data warehouses holdingterabytes of information. Platform flexibility is a stalwart feature of MySQL with all flavors of Linux, UNIX,and Windows being supported. And, of course, the open source nature of MySQL allows completecustomization for those wanting to add unique requirements to the database server.

    5.2 High Performance

    A unique storage-engine architecture allows database professionals to configure the MySQL databaseserver specifically for particular applications, with the end result being amazing performance results.Whether the intended application is a high-speed transactional processing system or a high-volume website that services a billion queries a day, MySQL can meet the most demanding performanceexpectations of any system. With high-speed load utilities, distinctive memory caches, full text indexes,and other performance-enhancing mechanisms, MySQL offers all the right ammunition for today's criticalbusiness systems.

    5.3 High Availability

    Rock-solid reliability and constant availability are hallmarks of MySQL, with customers relying on MySQLto guarantee around-the-clock uptime. MySQL offers a variety of high-availability options from high-speedmaster/slave replication configurations, to specialized Cluster servers offering instant failover, to thirdparty vendors offering unique high-availability solutions for the MySQL database server.

    5.4 Robust Transactional Support

    MySQL offers one of the most powerful transactional database engines on the market. Features includecomplete ACID (atomic, consistent, isolated, durable) transaction support, unlimited row-level locking,distributed transaction capability, and multi-version transaction support where readers never block writersand vice-versa. Full data integrity is also assured through server-enforced referential integrity, specializedtransaction isolation levels, and instant deadlock detection.

    5.5 Web and Data Warehouse Strengths

    MySQL is the de-facto standard for high-traffic web sites because of its high-performance query engine,tremendously fast data insert capability, and strong support for specialized web functions like fast full textsearches. These same strengths also apply to data warehousing environments where MySQL scales upinto the terabyte range for either single servers or scale-out architectures. Other features like mainmemory tables, B-tree and hash indexes, and compressed archive tables that reduce storagerequirements by up to eighty-percent make MySQL a strong standout for both web and businessintelligence applications.

    5.6 Strong Data Protection

    Because guarding the data assets of corporations is the number one job of database professionals,MySQL offers exceptional security features that ensure absolute data protection. In terms of databaseauthentication, MySQL provides powerful mechanisms for ensuring only authorized users have entry tothe database server, with the ability to block users down to the client machine level being possible. SSHand SSL support are also provided to ensure safe and secure connections. A granular object privilege

    Copyright 2006, MySQL AB Page 24 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    25/26

    framework is present so that users only see the data they should, and powerful data encryption anddecryption functions ensure that sensitive data is protected from unauthorized viewing. Finally, backupand recovery utilities provided through MySQL and third party software vendors allow for complete logicaland physical backup as well as full and point-in-time recovery.

    5.7 Comprehensive Application Development

    One of the reasons MySQL is the world's most popular open source database is that it providescomprehensive support for every application development need. Within the database, support can befound for stored procedures, triggers, functions, views, cursors, ANSI-standard SQL, and more. Forembedded applications, plug-in libraries are available to embed MySQL database support into nearly anyapplication. MySQL also provides connectors and drivers (ODBC, JDBC, etc.) that allow all forms ofapplications to make use of MySQL as a preferred data management server. It doesn't matter if it's PHP,Perl, Java, Visual Basic, or .NET, MySQL offers application developers everything they need to besuccessful in building database-driven information systems.

    5.8 Management Ease

    MySQL offers exceptional quick-start capability with the average time from software download toinstallation completion being less than fifteen minutes. This rule holds true whether the platform isMicrosoft Windows, Linux, Macintosh, or UNIX. Once installed, self-management features like automaticspace expansion, auto-restart, and dynamic configuration changes take much of the burden off alreadyoverworked database administrators. MySQL also provides a complete suite of graphical managementand migration tools that allow a DBA to manage, troubleshoot, and control the operation of many MySQLservers from a single workstation. Many third party software vendor tools are also available for MySQLthat handle tasks ranging from data design and ETL, to complete database administration, jobmanagement, and performance monitoring.

    5.9 Open Source Freedom and 24 x 7 Support

    Many corporations are hesitant to fully commit to open source software because they believe they can'tget the type of support or professional service safety nets they currently rely on with proprietary softwareto ensure the overall success of their key applications. The questions of indemnification come up often aswell. These worries can be put to rest with MySQL as complete around-the-clock support as well asindemnification is available through MySQL Network. MySQL is not a typical open source project as allthe software is owned and supported by MySQL AB, and because of this, a unique cost and supportmodel are available that provides a unique combination of open source freedom and trusted software withsupport.

    5.10 Lowest Total Cost of Ownership

    By migrating current database-drive applications to MySQL, or using MySQL for new developmentprojects, corporations are realizing cost savings that many times stretch into seven figures. Accomplishedthrough the use of the MySQL database server and scale-out architectures that utilize low-costcommodity hardware, corporations are finding that they can achieve amazing levels of scalability andperformance, all at a cost that is far less than those offered by proprietary and scale-up software vendors.In addition, the reliability and easy maintainability of MySQL means that database administrators don'twaste time troubleshooting performance or downtime issues, but instead can concentrate on making apositive impact on higher level tasks that involve the business side of data.

    Copyright 2006, MySQL AB Page 25 of 26

  • 8/8/2019 MySQL Whitepaper MySQL HA Solutions

    26/26

    6 Conclusion

    In this paper we set out to introduce high availability solutions available directly from MySQL, includingMySQL Replication and MySQL Cluster. We also explored some high availability solutions available fromthe open source community and highlight some solutions offered by MySQLs network of certified

    partners. We also presented the services MySQL offers in order to implement and maintain a highavailability solution leveraging MySQL Professional Services, MySQL Training and MySQL Network.

    7 About MySQL

    MySQL AB develops, markets, and supports a family of high performance, affordable database serversand tools.The company's flagship product is MySQL, the world's most popular open source database, with morethan six million active installations. Many of the world's largest organizations, including Google, SabreHoldings, The Associated Press, Suzuki and NASA, are realizing significant cost savings by using MySQLto power web sites, business-critical enterprise applications and packaged software. MySQL AB is asecond generation open source company, and supports both open source values and corporate

    customers needs in a profitable, sustainable business. For more information about MySQL, please go tohttp://www.mysql.com/

    8 Resources

    Below are links to additional high availability resources from MySQL.

    8.1 White Papers

    http://www.mysql.com/why-mysql/white-papers/

    8.2 Case Studieshttp://www.mysql.com/why-mysql/case-studies/

    8.3 Press Releases, News and Events

    http://www.mysql.com/news-and-events/

    8.4 Live Webinars

    http://www.mysql.com/news-and-events/web-seminars/

    8.5 Webinars on Demandhttp://www.mysql.com/news-and-events/on-demand-webinars/