Sunteți pe pagina 1din 11

Guidelines for Using MySQL with Double-Take

Guidelines for Using MySQL with Double-Take Revision 1.0.0 published September 2007 Double-Take, GeoCluster, and NSI are registered trademarks of Double-Take Software, Inc. Balance, Double-Take for Virtual Systems, Double-Take for Virtual Servers, and Double-Take ShadowCaster are trademarks of Double-Take Software, Inc. Microsoft, Windows, the Windows logo, and SQL Server are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. MySQL is a registered trademark of MySQL AB in the United States, the European Union and other countries. All other trademarks are the property of their respective companies. 2007 Double-Take Software, Inc. All rights reserved.

Double-Take Support for Application Failover


The Double-Take file system replication process is application independent and replicates any file system changes (including permissions and attributes) written to NTFS, FAT or FAT32 file systems by any application or process, subject to specific exceptions called out in the Users Guide or readme file. Maintaining point-in-time consistent file system replicas and providing server monitoring and automatic or manual failover of the server name and IP address are the primary functions of Double-Take, and Double-Take Software offers support to qualified customers should these functions fail to operate in accordance with our published documentation, regardless of what application or process is manipulating the data. Double-Take Software may provide application notes and other documents that provide implementation guidelines on how to use Double-Take functions and replicas to manually or automatically failover or recover many popular third-party applications and a general process to accomplish failover or recovery of many other third-party applications. While these steps are believed to be accurate for the specific configuration, Double-Take version, and application versions originally tested, due to the number of possible configurations and variables, Double-Take Software can only test selected combinations and may provide only limited support for the operation and configuration of third-party applications or the behavior of those applications before, during, or after failover, in its discretion. In cases where Double-Take Software has no direct access to or experience with a particular application or configuration, Double-Take Software support may also be limited to only the actual replication of the file system data and failover (name and IP address) of the server. For assistance in validating, implementing or troubleshooting these or other possible configurations with third-party applications, Double-Take Software and its partners may offer professional services on a fee basis to apply best practices for assisting with third-party applications to recover automatically or manually using replicated data. This, and any other, application note is provided solely for the convenience of our customers and is not intended to bind Double-Take Software to any obligation. Although we try to provide quality information, Double-Take Software makes no claims, promises or guarantees about the accuracy, completeness, or adequacy of the information contained in this document.

Table of Contents
Document Overview ................................................................................................................... 1
Audience ........................................................................................................................................................................................................ 1 Expectations .................................................................................................................................................................................................. 1 Related documentation .............................................................................................................................................................................. 1 Getting help .................................................................................................................................................................................................. 1

Solution Overview ....................................................................................................................... 2


Configuration ................................................................................................................................................................................................ 2 Modifying the sample script files .............................................................................................................................................................. 2 Configuring the replication set ................................................................................................................................................................. 2 Managing MySQL services .......................................................................................................................................................................... 3 Enabling compression ................................................................................................................................................................................. 3 Configuring memory usage ........................................................................................................................................................................ 3

Sample Implementation ............................................................................................................. 4


Requirements ................................................................................................................................................................................................ 4 Install software on the source .................................................................................................................................................................. 4 Install and configure software on the target ......................................................................................................................................... 4 Configure and begin mirroring and replication ..................................................................................................................................... 4 Configure failover ........................................................................................................................................................................................ 5 Begin monitoring the source for failure ................................................................................................................................................. 6 Restore your data ........................................................................................................................................................................................ 7

1. Document Overview
This document is a Double-Take application note. An application note provides guidelines on the use of Double-Take in a specific environment. This document contains:
Document OverviewExplains what an application note contains, how it should be used, what you need to know before trying to use the application note, and where you can go for more information. Solution OverviewExplains how the application works with Double-Take and describes the considerations that you

must weigh when implementing your Double-Take solution. Review this section to make sure that you understand the theory involved with using Double-Take and your application. Includes both basics, such as system requirements, as well as configuration and environment-specific topics, such as interactions with specific clients or special considerations for WAN (Wide Area Network) environments. Pay special attention to those topics that are directly related to your environment.
Sample ImplementationDescribes a specific example of how to use Double-Take for this solution. Use these

procedures as a guideline for creating your own implementation. Because no two environments or configurations are exactly the same, you will probably need to implement additional or different steps than what is documented here in order to make the solution work in your environment.

1.1. Audience
This document is written for network and application administrators who have a working understanding of the applications and environments where the Double-Take solution is to be deployed. You may need to expand on the documented information in order to customize the solution to fit your environment. Before you use this application note, you should have an understanding of: Double-Take MySQL

1.2. Expectations
Application notes are intended to provide a framework for configuring a Double-Take solution in a specific environment and to draw attention to decisions you will need to make when configuring your solution. Because there are an infinite number of possible configuration, network, and environment scenarios, application notes contain general configuration guidelines as well as an example configuration procedure that has been tested for a specific environment. This document assumes that you are comfortable working with your operating system, Double-Take, and MySQL.

1.3. Related documentation


Before you begin to configure your solution, make sure that you have complete documentation for your operating system, application, and Double-Take. This application note does not provide step-by-step instructions for using standard operating system, application, and Double-Take functionality. The following documents contain additional information that you may need while setting up this solution: Double-Take Users Guide or online documentation Reference guides or documentation for your version of MySQL

1.4. Getting help


Double-Take Software has application notes that describe how to configure Double-Take with a variety of popular third-party applications. These application notes are available on the Application Notes page of the Double-Take Software support web site (http://support.doubletake.com). For help using Double-Take, refer to the Double-Take online manual or online help. Double-Take Software offers professional services on a fee basis to assist you in identifying the best practices for implementing a solution in your environment. Visit http://www.doubletake.com/what-we-offer/services/ for more information.

1 of 8

2. Solution Overview
MySQL is an open-source relational database management system for Microsoft Windows server-based systems. Double-Take provides real-time enterprise data protection and replication. Double-Take can be used to provide high availability for your MySQL database. This document describes the steps necessary to configure Double-Take to provide high availability for Windows 2003 servers running MySQL. These procedures allow a secondary server to assume the identity and role of a failed MySQL server while maintaining the availability of MySQL services with minimal disruption or data loss. To complete these instructions, you will install MySQL and Double-Take, and configure Double-Take for replication and failover. Due to the complexities of these applications, this document is intended for network administrators with experience installing, configuring, and maintaining network applications including Double-Take and MySQL.

2.1. Configuration
In this solution, a single server is configured to act as the MySQL server. Double-Take is used to replicate and failover the MySQL server database to a Double-Take target machine. In the event of a source failure, the clients are directed to the target server. Failed Source (Offline) Target

Source Name: Indy Original source IP: 125.7.82.43 MySQL Double-Take

Target Name: Jersey and Indy Target IP: 125.7.82.67 and 125.7.82.43 MySQL Double-Take

MySQL GUI client User and application requests are sent to the target by locating the sources original IP address or hostname

2.2. Modifying the sample script files


Sample batch files are available at http://support.doubletake.com. After you modify the sample scripts, save them with a new name to remove the SAMPLE_ prefix. Copy the scripts to the directory where Double-Take is installed. The sample batch files provided are only examples. Because no two environments or configurations are exactly the same, you MUST modify the sample scripts in order to make the solution work in your environment.

2.3. Configuring the replication set


MySQL creates multiple files for each database. You must make sure that all necessary files are included in the replication set so that they will be available on the target server. For a default MySQL installation, you must include the following in your replication set:
INI files. Select all .ini files included in the MySQL root installation path (for example, c:\Program Files\MySQL\MySQL Servr 5.0) log files. Select all log files in the Data folder in the MySQL root installation path (for example, c:\Program Files\MySQL\MySQL Servr 5.0\data) Database folder, including all database files. Select the entire folder for the relevant database(s) in the Data folder in the MySQL root installation path (for example, c:\Program Files\MySQL\MySQL Servr 5.0\data)

You do not need to replicate the application files or any other files, since they already exist on the target machine.

2 of 8

2.4. Managing MySQL services


The following service will need to be started on the target server when failover is initiated, and stopped on the target server prior to initiating failback to the source. MySQL_<instance name> You can create a script to start and stop this service at the appropriate times by using failover and failback scripts. Because no two environments are exactly the same, you will need to make sure that you are addressing all services relevant for your environment.

2.5. Enabling compression


By enabling compression, you can reduce the amount of bandwidth needed to transmit Double-Take data. When compression is enabled, the data is compressed before it is transmitted from the source. When the target receives the compressed data, it uncompresses it and then writes it to disk. On a default Double-Take connection, compression is disabled. Because the files that should be included in a replication set can generate a significant amount of data, you should enable compression for the connection. For more information about enabling compression, see the Double-Take Users Guide. However, keep in mind that the process of compressing data impacts processor useage. If you notice an impact on performance while compression is enabled in your environment, either adjust to a lower level of compression, or leave compression disabled.

2.6. Configuring memory usage


Double-Take uses memory to queue operations and data on both the source and target. Since the source server is typically running a production application, it is important that the amount of memory Double-Take and the other applications use does not exceed the amount of RAM in the system. If the applications require more memory than there is RAM, the system will begin to swap pages of memory to disk and the system performance will degrade. Using Microsoft SQL Server as an example, for instance, SQL Server will use all of the available system memory when needed by default, and it may use almost all of the system memory during high-load operations. These high-load operations are precisely what cause Double-Take to need memory to queue the data being changed by SQL Server. On a server with 1 GB of RAM running SQL Server and Double-Take, you might configure SQL Server to use only 512 MB and Double-Take to use 256 MB, leaving 256 MB for the operating system and other applications on the system. Many other server applications will use almost all system memory by default, so it is important to check and configure applications appropriately, particularly on high-capacity servers.

3 of 8

3. Sample Implementation
This section describes an example of how to configure Double-Take and MySQL. Use these procedures as a guideline for creating your own implementation. Because no two environments or configurations are exactly the same, you will probably need to implement additional or different steps than what is documented here in order to make the solution work in your environment.

3.1. Requirements
For this scenario, your system must meet the following requirements: Licensed copies of Microsoft Windows Server 2003 with service pack 1 or later MySQL server, version 5.0 or later Licensed copies of Double-Take 4.5 or later

3.2. Install software on the source


1. 2.

Install MySQL on the source, if it is not already installed. Record the drive and directory where MySQL is installed. The default directory for MySQL is <drive>:\Program
Files\MySQL\MySQL Server 5.0

MySQL Installation Drive and Directory:


3.

Install Double-Take on the source machine using the installation defaults. See the Double-Take Getting Started guide for details.

3.3. Install and configure software on the target


1. 2.

Install Double-Take on the target server using the installation defaults. See the Double-Take Getting Started guide for details. (Optional) Configure the target to allow services to interact with the desktop (so that the scripts will display on the console when they are run):
a. b.

Select Start, Programs, Administrative Tools, Services and double-click the Double-Take service. Select the Log On tab. Select the Allow Service to Interact with Desktop check box and click OK.

3. 4.

Install MySQL on the target using the same drive and directory specifications recorded in step 2 of Install software on the source on page 4. The MySQL installation must be identical on the source and target. By default, MySQL services are set to automatic startup. You must stop the services listed in Managing MySQL services on page 3 and set them to manual startup on the target. This ensures that all MySQL files are closed on the target and the Double-Take source can replicate the changes. On the target, enable Block Checksum All Files on a Difference Mirror and click OK.

5.

3.4. Configure and begin mirroring and replication


1. 2. 3. 4. 5. 6. 7. 8.

Select Start, Programs, Double-Take, Management Console. Double-click your source machine to log on. Right-click on the source and select Properties. On the Source tab, enable Block Checksum All Files on a Difference Mirror and click OK. Right-click your source machine and select New, Replication Set and enter the desired name for the replication set. Select the MySQL data you wish to protect. For more information about what you should include in your replication set, see Configuring the replication set on page 2. Right-click the replication set name and select Save to save the replication set. Drag and drop the replication set onto the target. The Connection Manager dialog box opens.

4 of 8

9.

The Source Server, Target Server, Replication Set, and Route fields will automatically be populated. If you have multiple IP addresses on your target, verify the Route field is set to the correct network path. (For detailed information on connecting a source and target, see the Double-Take User's Guide.) target.

10. Select One to One to map the replication set data from the source to an identical volume/directory structure on the 11. On the Orphans tab, select the Move/Delete Orphan Files checkbox. 12. On the Mirroring tab, select the type of mirror, either Full or File Differences, to perform. NOTE:

If the target has been previously mirrored to or restored, select File differences with the Use block checksum option so that only the changed data is sent across the network.

13. Click Connect to start the mirror and replication processes. NOTE:

If you start MySQL and mount the replicated databases on the target, or if the data on the target is otherwise modified, the data on the source and target will no longer match. If the updated data on the target is not needed, perform a full or difference with block checksum mirror from the source to the target. If the updated data on the target is needed, restore the data from the target to the source.

3.5. Configure failover


The following steps should be performed on the target server.
1.

If a failure occurs, you will want the MySQL services to start on the target machine automatically. To do this, create a batch file called failover.bat using the sample batch file below. The following script should be run after failover has completed. Save the batch file to the same directory where your Double-Take files are installed.
NOTE:

These sample batch files are available on the Double-Take Software support web site at http://support.doubletake.com. After you modify the sample scripts, save them with a new name to remove the sample_ prefix. Copy the scripts to the directory where Double-Take is installed. The sample batch files provided are only examples. Because no two environments or configurations are exactly the same, you MUST modify the sample scripts in order to make the solution work in your environment. sample_failover.bat

rem ***SAMPLE*** failover script for MySQL rem This sample batch file is provided as an example only. Because no two environments or rem configurations are exactly the same, you MUST modify this script in order to make the rem solution work in your environment. rem You may need to modify which services are started depending on your version of MySQL. net start Mysql 2.

After a failure is resolved, you will be ready to bring your source back online. At this time, you will want to stop the MySQL services on the target automatically. To do this, create a batch file called failback.bat using the sample batch file below. Save the batch file to the same directory where your Double-Take files are installed. sample_failback.bat
rem ***SAMPLE*** failback script for MySQL rem This sample batch file is provided as an example only. Because no two environments or rem configurations are exactly the same, you MUST modify this script in order to make the rem solution work in your environment. rem You may need to modify which services are started depending on your version of MySQL. net stop Mysql

5 of 8

3.6. Begin monitoring the source for failure


1. 2. 3. 4.

On the target, select Start, Programs, Double-Take, Failover Control Center. Select the target machine from the list of available machines. If the target you need is not displayed, click Add Target, enter the machine name, click OK, and then click Login. To add a monitor for the selected target, click Add Monitor. Type the name of the source machine and click OK. The Monitor Settings window will open. In the left pane of the Monitor Settings window, mark the IP address that is going to failover. Verify that the correct NIC is selected in the right-hand pane under Current IP Address(es).

5.

Highlight the machine name under Names to Monitor and click Scripts. Specify the scripts that were created earlier using failover.bat for the target post-failover script and failback.bat for the target pre-failback script.
NOTE:

The scripts are processed using the same account running the Double-Take service.

6.

Click OK to go back to the Monitor Settings dialog box and then click OK to begin monitoring the source machine.

For information on monitoring failover, see the Double-Take Users Guide. In the event of a source machine failure, your target machine is now ready to stand in for your source. If the source server fails, the following will occur: The Failover Control Center will count down to zero, and a dialog box will appear on the target server indicating the failure. You may initiate failover by clicking OK. After clicking OK, the target server will assume the IP address and server name of the source server. The failover scripts will execute, starting the MySQL services on the target server. The target server is now standing in for the source MySQL server. Clients may access MySQL services on the target server just as if it were the original source.

6 of 8

3.7. Restore your data


If your source experiences a failure, such as a power, network, or disk failure, your target machine will stand in for the source while you resolve the source machine issues. During the source machine downtime, data is updated on the target machine. When your source machine is ready to come back online, the data is no longer current and must be updated with the new data on the target machine.
1. 2.

Verify that your source machine is not connected to the network. If it is, disconnect it. Resolve the source machine problem that caused the failure.
NOTE:

If you must rebuild your hard drive, continue with step 3. If you do not need to rebuild your hard drive, verify that the Double-Take connection on the source has been disconnected (right-click the connection in the Double-Take Management Console and select Disconnect) and then continue with step 6.

3. 4. 5. 6.

Install Windows. Since your source machine is not connected to the network, go ahead and use the sources original name and IP address. Install Double-Take using the installation defaults. Install MySQL using the same drive and directory settings recorded in step 2 of Install software on the source on page 4.
Verify that MySQL is not running on the source. The MySQL services must not be running at this time. Depending on the type of failure, your services may be set to manual startup but could still be running. Stop any MySQL services that are running.

7. 8. 9.

On the target, select Start, Programs, Double-Take, Failover Control Center. Select the target machine that is currently standing in for the failed source. Select the failed source and click Failback. The pre-failback script entered during the failover configuration stops the MySQL services on the target so that no additional changes can be made.

10. You will be prompted to determine if you want to continue monitoring the source server. Do not choose Continue or Stop at this time. 11. Connect the source machine to the network. 12. After the source is back online, select whether or not you want to continue monitoring this source machine (Continue or Stop). NOTE:

Verify that the Double-Take connection on the source has been disconnected (right-click the connection in the Double-Take Management Console and select Disconnect).

13. To begin the restoration process, open the Double-Take Management Console and select Tools, Restoration Manager. NOTE:

You can also run the Double-Take DTCL automated restoration script, which can be found in the Double-Take Users Guide, to complete the remaining steps in this section.

14. Complete the appropriate fields as described below. Original SourceThe name of the source machine where the data originally resided. Restore FromThe name of the target machine that contains the replicated data. Replication SetThe name of the replication set to be restored. Restore ToThe name of the machine where the data will be restored. This may or may not be the same as the

original source machine.


15. Identify the correct drive mappings for the data and any other restoration options necessary. For detailed information on

the restoration options, see the Double-Take Users Guide.


16. Select the Use block checksum comparison/delta block transfer option. 17. On the Orphans tab, select Delete Orphaned Files. 18. Verify that the selections you have made are correct and click Restore. The restoration procedure time will vary

depending on the amount of data that you have to restore.


19. After the restoration is complete, start the MySQL services on the source machine. 20. Reestablish the Double-Take replication set connection.

7 of 8

21. On the Mirroring tab, select File differences with the Use block checksum option. NOTE:

If the target has been previously mirrored to or restored, select File differences with the Use block checksum option so that only the changed data is sent across the network.

At this time, your data is restored back to your source machine, the source machine is again the primary MySQL server, and, if you selected to continue failover monitoring, the target is available to stand in for the source in the event of a failure.

8 of 8

S-ar putea să vă placă și