1. Trang chủ
  2. » Công Nghệ Thông Tin

high availability mysql cookbook

276 505 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 276
Dung lượng 5,95 MB

Nội dung

www.it-ebooks.info High Availability MySQL Cookbook Over 50 simple but incredibly effective recipes focusing on different methods of achieving high availability for MySQL databases Alex Davies BIRMINGHAM - MUMBAI www.it-ebooks.info High Availability MySQL Cookbook Copyright © 2010 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, Packt Publishing, nor its dealers or distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: April 2010 Production Reference: 1220410 Published by Packt Publishing Ltd. 32 Lincoln Road Olton Birmingham, B27 6PA, UK. ISBN 978-1-847199-94-2 www.packtpub.com Cover Image by Vinayak Chittar (vinayak.chittar@gmail.com) www.it-ebooks.info Credits Author Alex Davies Reviewers Marc Delisle Kai 'Oswald' Seidler Acquisition Editor Sarah Cullington Development Editor Darshana D. Shinde Technical Editors Charumathi Sankaran Vishal Wadkar Copy Editor Leonard D'Silva Indexer Rekha Nair Editorial Team Leader Aanchal Kumar Project Team Leader Priya Mukherji Project Coordinator Prasad Rai Proofreader Lynda Sliwoski Graphics Geetanjali Sawant Production Coordinator Aparna Bhagat Cover Work Aparna Bhagat www.it-ebooks.info About the Author Alex Davies was involved early with the MySQL Cluster project and wrote what, at the time, was the first simple guide for MySQL Cluster after working with MySQL for many years and routinely facing the challenge of high availability. Alex has continued to use MySQL Cluster and many other high-availability techniques with MySQL. Currently employed as a system and virtualization architect for a large e-Gaming company, Alex has also had the fortune to work for companies of all sizes ranging from Google to countless tiny startups. In writing this book, I owe an enormous debt of gratitude to the developers and members of the wide MySQL community. The quality of the freely- available software and documentation is surpassed only by the friendliness and helpfulness of so many members of the community and it's always a pleasure to work with MySQL. I am deeply grateful to my colleague Alessandro Orsaria who spent an enormous amount of his valuable time offering suggestions and correcting errors in the drafts of this book. The final version is much stronger as a result and any remaining errors are entirely my own. www.it-ebooks.info About the Reviewers Marc Delisle is a member of the MySQL Developers Guild, which regroups community developers because of his involvement with phpMyAdmin. He started contributing to this popular MySQL web interface in December 1998, when he made the first multi-language version. He has been actively involved with this software project since May 2001 as a developer and project administrator. Marc has worked at Cegep de Sherbrooke, Québec, Canada, as an application programmer and network manager since 1980. He has also been teaching networking, security, and PHP / MySQL application development. Marc lives in Sherbrooke with his wife and they enjoy spending time with their four children. Marc authored the first ever Packt Publishing book, Mastering phpMyAdmin for Effective MySQL Management, and its revised editions. He also wrote Creating your MySQL Database: Practical Design Tips and Techniques, again with Packt Publishing. I would like to thank the fine team at Packt for the support in reviewing this book. www.it-ebooks.info Kai 'Oswald' Seidler was born in Hamburg in 1970. He graduated from Technical University of Berlin with a Diplom Informatiker degree (Master of Science equivalent) in Computer Science. In the 90s, he created and managed Germany's biggest IRCnet server, irc.fu-berlin.de, and co-managed one of the world's largest anonymous FTP servers, ftp.cs.tu-berlin.de. He professionally set up his first public web server in 1993. From 1993 until 1998, he was member of Projektgruppe Kulturraum Internet, a research project on net culture and network organization. In 2002, he co-founded Apache Friends and created the multi-platform Apache web server bundle XAMPP. Around 2005, XAMPP became the most popular Apache stack worldwide. In 2006, his third book, Das XAMPP-Handbuch was published by Addison Wesley. Currently, he's working as Technology evangelist for web-tier products at Sun Microsystems. www.it-ebooks.info Table of Contents Preface 1 Chapter 1: High Availability with MySQL Cluster 7 Introduction 7 Designing a MySQL Cluster 8 Creating an initial cluster conguration le—cong.ini 17 Installing a management node 20 Starting a management node 23 Installing and starting storage nodes 26 Installing and starting SQL nodes 32 Creating a MySQL Cluster table 35 Restarting a MySQL Cluster without downtime 38 Recovering from a cluster shutdown 42 Chapter 2: MySQL Cluster Backup and Recovery 47 Introduction 47 Importing SQL les to a MySQL server and converting them to MySQL Cluster 49 Taking an online backup of a MySQL Cluster 54 Restoring from a MySQL Cluster online backup 59 Restricting write access to a MySQL Cluster with single-user mode 64 Taking an ofine backup with MySQL Cluster 69 Chapter 3: MySQL Cluster Management 75 Introduction 75 Conguring multiple management nodes 76 Obtaining usage information 80 Adding storage nodes online 84 Replicating between MySQL Clusters 91 Replication between clusters with a backup channel 97 www.it-ebooks.info ii Table of Contents User-dened partitioning 100 Disk-based tables 104 Calculating DataMemory and IndexMemory 109 Chapter 4: MySQL Cluster Troubleshooting 115 Introduction 115 Single storage node failure 116 Multiple storage node failures 120 Storage node partitioning and arbitration 123 Debugging MySQL Clusters 126 Seeking help 130 NIC teaming with MySQL Cluster 131 Chapter 5: High Availability with MySQL Replication 139 Introduction 139 Designing a replication setup 140 Conguring a replication master 146 Conguring a replication slave without syncing data 150 Conguring a replication slave, migrating data with a simple SQL dump 152 Using LVM to reduce downtime on a master when bringing a slave online 153 Replication safety tricks 156 Multi Master Replication Manager (MMM): initial installation 158 Multi Master Replication Manager (MMM): installing the MySQL nodes 162 Multi Master Replication Manager (MMM): installing monitoring node 166 Managing and using Multi Master Replication Manager (MMM) 169 Chapter 6: High Availability with MySQL and Shared Storage 175 Introduction 175 Preparing a Linux server for shared storage 176 Conguring two servers for shared storage MySQL 181 Conguring MySQL on shared storage with Conga 185 Fencing for high availability 191 Conguring MySQL with GFS 195 Chapter 7: High Availability with Block Level Replication 201 Introduction 201 Installing DRBD on two Linux servers 203 Manually moving services within a DRBD cluster 208 Using heartbeat for automatic failover 211 www.it-ebooks.info iii Table of Contents Chapter 8: Performance Tuning 219 Introduction 219 Tuning the Linux kernel IO 220 Tuning MySQL Cluster storage nodes 228 Tuning MySQL Cluster SQL nodes 230 Tuning queries within a MySQL Cluster 232 Tuning GFS on shared storage 233 MySQL Replication tuning 235 Appendix A: Base Installation 239 Appendix B: LVM and MySQL 243 Appendix C: Highly Available Architectures 251 Single-site architectures 251 Multi-site architectures 253 Summary of options 254 Index 255 www.it-ebooks.info [...]... migrating data with a simple SQL dump Chapter 6, High Availability with MySQL and Shared Storage highlights the techniques to achieve high availability with shared storage It covers recipes for preparing a Linux server for shared storage, configuring MySQL on shared storage with Conga, fencing for high availability, and configuring MySQL with GFS Chapter 7, High Availability with Block Level Replication covers... to design, implement, and manage a highly-available MySQL environment using MySQL Cluster, MySQL Replication, block-level replication with DRBD, and shared storage with a clustered filesystem (that is, the open source Global File System (GFS)) This book covers all the major techniques available for achieving high availability for MySQL, based on MySQL Cluster 7.0 and MySQL 5.0.77 All the recipes in this... scalability and high availability When you are considering to deploy the MySQL Cluster, it is essential to have an idea of both the problems that the MySQL Cluster will not solve and its specific requirements For a complete list of requirements and limitations, visit the online MySQL Cluster reference guide (accessible from http://dev .mysql. com/doc/) 13 www.it-ebooks.info High Availability with MySQL Cluster... data in memory) Chapter 4, MySQL Cluster Troubleshooting covers the troubleshooting aspects of MySQL Cluster It contains recipes for single-storage node failure, multiple-storage node failures, storage node partitioning and arbitration, debugging MySQL Clusters, and network redundancy with MySQL Cluster Chapter 5, High Availability with MySQL Replication covers replication of MySQL databases It contains... Linux operating system What this book covers Chapter 1, High Availability with MySQL Cluster explains how to set up a simple MySQL Cluster This chapter covers practical steps that will show you how to design, install, configure, and start a simple MySQL Cluster Chapter 2, MySQL Cluster Backup and Recovery covers the options available for backing up a MySQL Cluster and the considerations to be made at the... of MySQL Appendix C, Highly Available Architectures shows, at a high level, some different single-site and multi-site architectures  www.it-ebooks.info Preface What you need for this book The software applications required to run the recipes in this book are: • CentOS or Red Hat Enterprise Linux 5.3 • MySQL 5.0.77 • MySQL and MySQL Cluster 7.0.x This book includes the process for installing both MySQL. .. both MySQL and MySQL Cluster onto CentOS Who this book is for This book is targeted at system administrators or database administrators who have basic familiarity with Linux, the shell, and MySQL You may already have some basic MySQL experience but are looking for practical guidance for configuring high availability, as well as a reference covering all of the common options used for high availability. .. Introduction MySQL Cluster is the leading open source high availability database available today and is being used in many environments to achieve low cost "carrier grade" high availability and scalability MySQL Cluster originates from a product called Network DataBase, which was known as NDB This name has also stuck in the current software, so there are many references to NDB For example, the name of the MySQL. .. of it as "MySQL Cluster" In this chapter, we will introduce MySQL Cluster as a technology and explain how to set up a simple cluster This chapter will cover practical steps that will show you how to design, install, configure, and start a simple MySQL Cluster We'll delve deeper into more advanced tasks in the later chapters www.it-ebooks.info High Availability with MySQL Cluster Designing a MySQL Cluster... Preface High availability is a regular requirement for databases, and it can be challenging to get it right There are several different strategies for making MySQL, an open source Relational Database Management System (RDBMS), highly available This may be needed to protect the database from hardware failures, software crashes, or user errors Running a MySQL database is fairly simple, but achieving high availability . www.it-ebooks.info High Availability MySQL Cookbook Over 50 simple but incredibly effective recipes focusing on different methods of achieving high availability for MySQL databases Alex. servers for shared storage MySQL 181 Conguring MySQL on shared storage with Conga 185 Fencing for high availability 191 Conguring MySQL with GFS 195 Chapter 7: High Availability with Block Level. partitioning and arbitration, debugging MySQL Clusters, and network redundancy with MySQL Cluster. Chapter 5, High Availability with MySQL Replication covers replication of MySQL databases. It contains

Ngày đăng: 24/04/2014, 15:16

TỪ KHÓA LIÊN QUAN