MySql High Availability Class Part 1

214 359 0
MySql High Availability Class Part 1

Đ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

Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates le b a fer ly c a J ns a r t n o an s de ) om Gui c ng dent i p p Stu o h s his @ t g n e a s MySQL zh to uHigh Availability c a j ( Revision 2.1 se g n n e a c li h nZ PRESENTED BY SUN MICROSYSTEMS, INC MYSQL TRAINING SERVICES training@mysql.com http://www.mysql.com/training/ STUDENT GUIDE © Sun Microsystems, Inc 2008 Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates lyn Jac ble era nsf -tra non sa ) de com t Gui n ng ppi ude sho is St ng@ e th zha o us (jac e t ng licens Zha MySQL High Availability MySQL High Availability Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates This is the training guide for the MySQL High Availability training course This training guide was developed using the MySQL 6.2 Cluster Carrier Grade edition Sun Microsystems would like to thank the many individuals that played a part in bringing this training material to the numerous students who will benefit from the knowledge and effort that each of these contributors put into the training Even though there were a large number of contributions from many Sun Microsystems (formerly MySQL) personnel, the following list of contributors played a vital role in developing this material and ensuring that its contents were accurate, timely and most of all presented in a way that would benefit those that are utilizing it for the benefit of improving their skills with MySQL Harrison Fisk, Course Designer, Subject Matter Expert Max Mether, Lead Project Manager, Subject Matter Expert Lars Thalmann, Subject Matter Expert le b a fer ns a r t n Bernhard Ocklin, Subject Matter Expert o an s Morgan Tocker, Subject Matter Expert de ) om Gui Jeff Gorton, Course Editor c ng dent i p MySQL High Availability Training Guide p Stu o h Copyright © 2008 by Sun Microsystems, Inc s his @ g n guideusshall e tbe reproduced, stored in a retrieval system, or transmitted by any a All rights reserved No part of thish training z means, electronic, mechanical, c or otherwise, without the written permission of Sun Microsystems, torecording, a photocopying, j e ( Inc No patent liability is assumed with respect to the use information contained herein Although every precaution has s training guide, ofSunthe Microsystems g n n been taken in the preparation of this and the associated contributors assume no e lic Nor is any liability assumed for damages haerrors or omissions responsibilityZfor resulting from the use of the information n contained herein y acl JFirst Printing: August 2008 Mikael Ronström, Subject Matter Expert Trademarks The copyright to this training guide is owned by Sun Microsystems MySQL® and the MySQL logo are registered trademarks of the Sun Microsystems MySQL product Other trademarks and registered trademarks referred to in this manual are the property of their respective owners, and are used for identification purposes only Warning and Disclaimers Every effort has been made to make this training guide as complete and accurate as possible to meet the needs of the training herein, but no warranty or fitness is implied The information provided is on an “as is” basis i Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates MySQL High Availability le b a fer ns a r t n o an s de ) om Gui c ng dent i p p Stu o h s his @ t g n e a s zh to u c a j ( se g n n e lic Z n ly c a J ii MySQL High Availability Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates Conventions Used in This Training Guide This training guide uses certain typographical conventions: • TEXT IN THIS STYLE is used for SQL statements; database, table, and column names; program listings and source code; and environment variables Example: “To reload the grant tables, use the FLUSH PRIVILEGES statement.” • Text in this style indicates input that you type in examples • Text in this style indicates the names of executable programs and scripts, examples being mysql (the MySQL command line client program) and mysqld (the MySQL server executable) • Text in this style is used for variable input for which you should substitute a value of your own choosing • Filenames and directory names are written like this: “The global my.cnf file is located in the /etc directory.” • Character sequences are written like this: “To specify a wildcard, use the '%' character.” • Text in this style is used for emphasis When commands are shown that are meant to be executed from within a particular program, the prompt shown preceding the command indicates which command to use For example, shell> indicates a command that you execute from your login shell, and mysql> indicates a statement that you execute from the mysql client program: shell> type a shell command here mysql> type a mysql statement here The “shell” is your command interpreter On Linux, this is typically a program such as sh, csh, or bash On Windows, the equivalent program is command.com or cmd.exe, typically run in a console window When you enter a command or statement shown in an example, not type the prompt shown in the example Database, table, and column names must often be substituted into statements To indicate that such substitution is necessary, this manual uses db_name, tbl_name, and col_name For example, you might see a statement like this: mysql> SELECT col_name FROM db_name.tbl_name; This means that if you were to enter a similar statement, you would supply your own database, table, and column names, perhaps like this: mysql> SELECT author_name FROM biblio_db.author_list; SQL keywords are not case sensitive and may be written in any lettercase This training guide uses uppercase In syntax descriptions, square brackets ('[' and ']') indicate optional words or clauses For example, in the following statement, IF EXISTS is optional: DROP TABLE [IF EXISTS] tbl_name When a syntax element consists of a number of alternatives, the alternatives are separated by vertical bars ('|') When one member from a set of choices may be chosen, the alternatives are listed within square brackets ('[' and ']'): TRIM([[BOTH | LEADING | TRAILING] [remstr] FROM] str) When one member from a set of choices must be chosen, the alternatives are listed within braces ('{' and '}'): {DESCRIBE | DESC} tbl_name [col_name | wild] An ellipsis ( ) indicates the omission of a section of a statement, typically to provide a shorter version of more complex syntax For example, INSERT SELECT is shorthand for the form of INSERT statement that is followed by a SELECT statement An ellipsis can also indicate that the preceding syntax element of a statement may be repeated In the following example, multiple reset_option values may be given, with each of those after the first preceded by commas: RESET reset_option [,reset_option] Commands for setting shell variables are shown using Bourne shell syntax For example, the sequence to set the CC environment variable and run the configure command looks like this in Bourne shell syntax: shell> CC=gcc /configure If you are using csh or tcsh, you must issue commands somewhat differently: shell> setenv CC gcc and shell> /configure le b a fer ns a r t n o an s de ) om Gui c ng dent i p p Stu o h s his @ t g n e a s zh to u c a j ( se g n n e lic Z n ly c a J iii MySQL High Availability Supporting Images Used in This Training Guide The following is a summary of the standard images used in this manual to support the instruction: Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates IMAGE NAME DESCRIPTION Preparation This image is used to describe the steps required to be completed prior to performing a hands-on exercise Written Exam This image is used to identify that the student is going to be tested upon the material previously presented in the instructional material le b a fer ly c a J ns a r t n o an s de ) i is used to convey to mThis image Further Practice u o c G that there is a final Lab ntstudentto complete ng dethe i exercise prior to the p p u completion of the chapter t ho is S s @ Notes th gStudent This image identifies an area on a n e a s h u page designated for students to z o c t write notes associated with the a j e ( s class g n n lice a h nZ This image is used throughout the Slide Number 123 InLine Lab Throughout the course the instructor will conduct labs in line with the instruction, which are designed to help you to understand the “nuts and bolts” (inner-workings) of the topic Boxes course guide to indicate the existence and number of a corresponding instruction slide iv MySQL High Availability COURSE OBJECTIVES Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates This course is designed for experienced database administrators and system architects that want to analyze and form a basis of understanding different high availability options, including clustering and replication solutions within MySQL This course will provide the tools required to make the decision of what high availability solution is appropriate and how to implement a system with the correct design At the completion of this course, you should be able to: • Examine the design and limitations of MySQL replication • Describe the design and limitations around a shared-disk fail over solution • Analyze the design and limitations of MySQL cluster • Understand the differences with third-party clustering solutions, such as m/cluster • Develop a plan to implement the appropriate high availability solution le b a fer ns a r t n o • Describe the future development path of the different solutions an s • Discuss the different fail over solutions inherit in a high availability hadesign ) de i m u o c • Understand different cluster setups depending upon operating system G choices, such as LVM, Windows t n Cluster Agent, Veritas Cluster Agent, etc ing p tude p o Son highly available solutions • Explore the impact of different backup sh solutions s i @ h t tasks and how to maintain high availability while performing g maintenance n e • Identify the effects ofadifferent s these operations zh to u c a j ( se g n n e lic Z n • Analyze the performance impact of a high availability decision • Recognize the business decision side of the solutions, such as cost and risk ly c a J v Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates lyn Jac ble era nsf -tra non sa ) de com t Gui n ng ppi ude sho is St ng@ e th zha o us (jac e t ng licens Zha MySQL High Availability Table of Contents INTRODUCTION 1-1 1.1 Learning Objectives 1-1 1.2 The MySQL Overview 1-2 1.2.1 MySQL Partners 1-3 1.3 MySQL Products 1-4 1.3.1 MySQL Database Products 1-4 1.3.2 MySQL GUI Tools 1-6 1.3.3 Other MySQL Tools 1-6 1.3.4 MySQL Drivers 1-7 1.3.5 Solutions for Embedding MySQL 1-7 1.4 MySQL Services 1-8 1.4.1 MySQL Training 1-8 1.4.2 MySQL Certification 1-8 1.4.3 MySQL Consulting 1-8 1.4.4 MySQL Support 1-8 1.5 Community vs Enterprise 1-9 1.6 Supported Operating Systems 1-11 1.7 MySQL Certification Program 1-12 1.8 Training Curriculum Paths 1-13 1.9 MySQL Website 1-15 1.9.1 MySQL Community Web Page 1-16 1.10 Installing MySQL 1-18 1.11 Installing the "world" database 1-22 1.12 Chapter Summary 1-23 INTRODUCTION TO MYSQL HIGH AVAILABILITY 2-1 2.1 Overview 2-1 2.2 What is High Availability? 2-2 2.2.1 Availability defined 2-2 2.2.2 Downtime 2-4 2.2.3 Scheduled vs Unplanned Downtime 2-5 2.2.4 Business Impact 2-6 2.3 Overview of Availability Terminology 2-7 2.3.1 Asynchronous vs Synchronous 2-7 2.3.2 Replication vs Clustering 2-7 2.3.3 Shared-nothing vs Shared-disk 2-8 2.4 Third Party Software 2-9 2.4.1 Linux-HA 2-9 2.4.2 Windows Clustering 2-9 2.4.3 Veritas Cluster Agent 2-9 2.4.4 Red Hat Cluster Suite 2-9 2.5 Heartbeat 2-10 2.5.1 Configuration 2-10 2.5.2 Hardware 2-10 2.6 Summary 2-11 MYSQL REPLICATION 3-1 3.1 Overview 3-1 3.2 Basic architecture 3-2 3.3 Binary logging 3-2 3.3.1 Statement Based Binary Logging 3-5 3.3.2 Row based binary logging 3-5 3.3.3 Row Based vs Statement Based Binary Logging 3-6 3.4 Replication threads and files 3-9 3.4.1 Replication threads 3-9 3.4.2 Replication files 3-9 3.5 Setting up MySQL Replication 3-10 Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates le b a fer ns a r t n o an s de ) om Gui c ng dent i p p Stu o h s his @ t g n e a s zh to u c a j ( se g n n e lic Z n ly c a J TOC-i Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates MySQL High Availability 3.6 Monitoring MySQL Replication 3-13 3.6.1 Error Log 3-14 3.6.2 Replication Slave I/O Thread States 3-15 3.6.3 Replication Slave SQL Thread States 3-16 3.7 Advantages and Disadvantages of MySQL Replication 3-20 3.8 Advanced Replication Topologies 3-21 3.8.1 Two-way Replication 3-21 3.8.2 Circular Replication 3-24 3.9 Other Uses of Replication 3-26 3.9.1 Controlled Switchover 3-26 3.9.2 Online Schema Changes 3-26 3.9.3 Software Upgrades 3-27 3.10 Replication Optimization 3-29 3.10.1 Different Storage Engines 3-29 3.10.2 Different Startup Variables 3-29 3.10.3 Different Logical Structure 3-30 3.10.4 Different Hardware 3-30 3.11 Summary 3-33 MYSQL CLUSTER 4-1 4.1 Overview 4-1 4.2 Architecture 4-2 4.2.1 Introduction 4-2 4.2.2 Node types 4-2 4.2.3 Data storage 4-3 4.2.4 High Availability 4-3 4.2.5 Limitations of MySQL Cluster 4-6 4.2.6 Common use cases 4-6 4.3 Setup of MySQL Cluster 4-8 4.3.1 Cluster Configuration 4-8 4.3.1.1 Other Configuration Files 4-10 4.3.2 Starting the Cluster 4-12 4.4 Managing the Cluster 4-13 4.4.1 Logging 4-15 4.5 Cluster Asynchronous Replication 4-18 4.6 Cluster Pros and Cons 4-19 4.7 Summary 4-22 SHARED DISK CLUSTERING 5-1 5.1 Overview 5-1 5.2 Shared Disk Clustering Overview 5-2 5.2.1 Active-Active vs Active-Passive 5-2 5.3 Active-Passive Setups 5-3 5.4 Active-Active Clustering 5-4 5.5 Usage cases 5-8 5.5.1 Pros and Cons 5-8 5.5.2 Combining with Replication 5-9 5.6 Summary 5-10 OTHER CLUSTERING 6-1 6.1 Learning Objectives 6-1 6.2 Continuent uni/cluster® Product Architecture 6-2 6.2.1 Application Overview 6-2 6.2.2 Access Continuent uni/cluster with MySQL 6-2 6.2.3 Inside the controller 6-3 6.3 DRBD Details 6-5 6.3.1 DRBD Compared to Other Technologies 6-5 6.3.2 Configuring DRBD for MySQL 6-7 le b a fer ns a r t n o an s de ) om Gui c ng dent i p p Stu o h s his @ t g n e a s zh to u c a j ( se g n n e lic Z n ly c a J TOC-ii MySQL High Availability Appendix B - Basic vi Commands Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates Deleting Text The following commands allow you to delete text x delete single character under cursor Nx delete N characters, starting with character under cursor dw delete the single word beginning with character under cursor dNw delete N words beginning with character under cursor; e.g., d5w deletes words D delete the remainder of the line, starting with current cursor position dd delete entire current line Ndd or dNd delete N lines, beginning with the current line; e.g., 5dd deletes lines le b a fer ns a r t n o Nyy or yNy copy (yank, cut) the next N lines, including the current line, into n the buffer a s p put (paste) the line(s) in the buffer into the text aftera line h the current e ) om Guid c Other Commands ng dent i Searching Text p p Sword tu or phase by another To locate instances of A common occurrence in text editings ish too replace one s i particular sets of characters (or strings), commands @ use the thfollowing g n e /string search a h tforward usfor occurrence of string in text z o c ?string e backward for occurrence of string in text (ja nsearch s g n n lice move to next occurrence of search string a h N move to next occurrence of search string in opposite direction nZ y l acDetermining Line Numbers Cutting and Pasting Text The following commands allow you to copy and paste text yy copy (yank, cut) the current line into the buffer J Being able to determine the line number of the current line or the total number of lines in the file being edited is sometimes useful :.= returns line number of current line at bottom of screen := returns the total number of lines at bottom of screen ^g provides the current line number, along with the total number of lines, in the file at the bottom of the screen Page B-4 MySQL High Availability Appendix B - Basic vi Commands Saving and Reading Files Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates These commands permit you to input and output files other than the named file with which you are currently working :r filename read file named filename and insert after current line (the line with cursor) :w write current contents to file named in original vi call :w newfile write current contents to a new file named newfile :12,35w smallfile write the contents of the lines numbered 12 through 35 to a new file named smallfile :w! prevfile write current contents over a pre-existing file named prevfile le b a fer ns a r t n o an s de ) om Gui c ng dent i p p Stu o h s his @ t g n e a s zh to u c a j ( se g n n e lic Z n ly c a J Page B-5 Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates lyn Jac ble era nsf -tra non sa ) de com t Gui n ng ppi ude sho is St ng@ e th zha o us (jac e t ng licens Zha Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates MySQL High Availability Appendix C ly c a J ns a r t n o an TEST QUESTION hKEYS s a e ) om Guid c ng dent i p p Stu o h s his @ t g n e a s zh to u c a j ( se g n n e lic Z n le b a fer Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates lyn Jac ble era nsf -tra non sa ) de com t Gui n ng ppi ude sho is St ng@ e th zha o us (jac e t ng licens Zha MySQL High Availability Appendix C: Test Question Keys Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates Appendix C Test Question Keys Chapter – MySQL Replication Quiz 3-G (Page 3-31) What happens if you delete the binary logs before a slave can download them? How can you fix it? Replication will stop working as the slave can not received the missing updates The only way you can fix it is by loading in a new snapshot from the master taken after the deleted binary logs section What are the two proper ways of managing binary logs on a master? le b a fer ns a r t n o a Each thread acts independent of the other an s b Long running SQL statements will not block the download a ofenewer binary logs hslave ) c Internet connection issues between the master and will d have less of an impact i m u o d Slave is more likely to be caught up if the master fails c tot download G binary logs to make resuming g continue e If replication stops working, slavencan n i p tude replication faster p o Can you create a new slave with a single step sh hisofScopying over the data directory from an existing shutdown slave? Why or why not? @ t g sinformation n e a Yes All of the needed replication stored in the master.info and relay-log.info files which h to unormally So inisaddition are stored in c thezdata directory to getting all of the data, you also get the ato automatically j e ( needed files setup replication g cens n a 5.h Why wouldliyou want to use row-based replication in MySQL 5.1? n Z Many different reasons: a PURGE MASTER LOGS b Expire_logs_days What are some advantages of using two threads on the slave for replication? ly c a J a You want to replicate using MySQL Cluster b You are using non-deterministic user created functions c You are using a function that does not replicate with statement based such as UUID What are two scenarios where you might want to use the Blackhole storage engine with replication? Relay slave or filter slave What two things can change data when read_only is set on? a Root user (anyone with the SUPER privilege) b Replication SQL thread Why should you be careful when using replication for your first level of high availability fail over? Replication is asynchronous, so you can lose data when you fail over to the slave MySQL maintenance operations, such as optimize What are some examples when you might want to a controlled switchover? a b c Hardware/OS maintenance on the master MySQL server upgrade Schema alterations Page C-1 MySQL High Availability Appendix C: Test Question Keys 10 Name three places you can view information about replication on the slave server Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates a SHOW SLAVE STATUS b SHOW PROCESSLIST c Error log 11 Why you need to take appropriate planning actions when you want to use two-way replication? MySQL does not collision handling, so you need to be sure that collisions can not happen or are handled by your application Chapter – Other Clustering Quiz 6-A (from page 6-13) Does DRBD support dual primaries? Yes, but MySQL does not What operating systems does DRBD support? le b a fer ns a r t n o What is the minimum number of communication paths you must have between primary and secondary n a nodes? s a h a ) de i m u o b (to avoid split-brains) g c ent G n i c p tud p o d sh his S @ g se t Describe a split-brain scenario: n a uconsider themselves to be primary nodes An example of a split brain zh bothtnodes A split brain is when o c a j ( se g n could be if a single communication link between primary and secondary was used, and the link was n e lic Z n disconnected Both nodes would not be able to differentiate between disconnect and failure and would Linux DRBD 8.0 and beyond require a 2.6 kernel ly c a J assume the primary role Page C-2 Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates MySQL High Availability Appendix D ly c a J ns a r t n o FURTHER PRACTICEaLAB n s de ) SOLUTIONS om Gui c ng dent i p p Stu o h s his @ t g n e a s zh to u c a j ( se g n n e lic Z n le b a fer Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates lyn Jac ble era nsf -tra non sa ) de com t Gui n ng ppi ude sho is St ng@ e th zha o us (jac e t ng licens Zha MySQL High Availability Appendix D: Further Practice Lab Solutions Appendix D Further Practice Lab Solutions Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates Chapter – MySQL Cluster Further Practice 4-F Find a second machine, or find another student to work together on this set of exercises Create a new cluster with data nodes (one on each machine), MySQL servers (one on each machine) and the management client on one machine a Shutdown all existing members including the MySQL servers le b a fer b Create the new config.ini defining the cluster on the system with the management server ns a r t n o d Start the management node an s a e hWhy ) • You will get a warning when you this, dyou get this message? i m u o G t g cis running Since the management server same system with a data n n i eserverongoesthedown, p d node, this can lead to issues u if that causing you to lose p t o h both nodes at the same time This is due to how the arbitration works S s hisserver with the management @ g se t n a uwith the initial flag e Start zhthe datatnodes o c a j ( se g n • This will delete all existing data n e lic Z n f Start the MySQL servers c Edit the /etc/my.cnf files to both point to the management server ly c a J g Login and issue a show tables on the world database Import the world.sql into the world database The world database is now empty on the system mysql world < world.sql Alter them to be of the ndbcluster type ALTER TABLE City ENGINE=ndbcluster; ALTER TABLE Country ENGINE=ndbcluster; ALTER TABLE CountryLanguage ENGINE=ndbcluster; Issue a show tables on both systems Issue an insert on the City table on one system Try to select the inserted row on the other system Do you see it? Both systems now see the same three tables Page D-1 Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates MySQL High Availability Appendix D: Further Practice Lab Solutions Issue a kill –9 on the data node (kill both pids) that is on the system without the management server Can you still access the data on both servers? YES Restart the killed node and after it is started (verify with the management client), issue a kill –9 on the data node on system with the management server Can you still access the data? YES Restart the killed node and verify it is restarted Now perform a kill –9 on the management server Can you still access the data? YES 10 Restart the management server and the data node Login and verify everything is up and running Now kill both the management server and the data node on it with kill –9 at the same time Can you still access the data? NO 11 Investigate the node logs to see if you can see the cause of the shutdown of the second node Why did it shutdown? le b a fer ns a r t n o an s de ) om Gui c ng dent i p p Stu o h sand compare is the message received now and before? Are they 13 Check the node log again @ h t g ntimes itushutdown e due to arbitration failing Arbitration occurs in both similar? Yes Both a s h actual network o in crashes because both actions look the same to the other nodes tand acz ssplits j e ( g cethennetwork, does the node automatically rejoin? 14.nRe-enable a li h n Z 15 Edit your config.ini file to add StopOnError = under the [NDBD DEFAULT] The node log should have a message similar to: Node 3: Forced node shutdown completed Initiated by signal Caused by error 2305: 'Arbitrator shutdown, please investigate error(s) on other node(s)(Arbitration error) This means that due to the arbitrator and the node both going down at the same time, it could not get arbitration to approve so it shutdown itself 12 Restart the cluster, verify it is restarted and the data is still present Disable the network (either pull the network cable, or use ifconfig eth0 down) on the non-management server machine Can you access the data from either machine? You can access the data on the machine with the management server, but not the other one ly c a J section Restart the management node Attempt to access the data Does it work? No By default the node will shutdown entirely if it has an error 16 Start the shutdown data node Attempt to access the data Does it work? YES 17 Restart the other data node Attempt to access the data? Does it work? YES 18 What is this process we just did called? This is called a rolling restart You can that with the following procedure: Change the config.ini Restart the management server Restart each node in turn in order to propagate the change without ever losing data accessibility 19 Disable the network (either pull the network cable, or use ifconfig eth0 down) on the non-management server machine Verify the data node has left the cluster Re-enable the network Does the node automatically rejoin now? YES 20 How can we prevent the other node from going down if we lose the machine that has the management server? Test your theory You need to have another machine that runs the management server Setup another cluster with the management server on a separate system and test it out Page D-2 Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates MySQL High Availability Appendix E ly c a J ns a r t n o SEQUOIA CLUSTERING an s de ) om Gui c ng dent i p p Stu o h s his @ t g n e a s zh to u c a j ( se g n n e lic Z n le b a fer Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates lyn Jac ble era nsf -tra non sa ) de com t Gui n ng ppi ude sho is St ng@ e th zha o us (jac e t ng licens Zha MySQL High Availability Appendix E: Sequoia Clustering Appendix E Sequoia Clustering Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates Sequoia is an open source, middleware java solution for clustering any JDBC database product It was formerly known by the name C-JDBC There is work ongoing to allow it to work for more than just Java, but that support is still relatively immature The way Sequoia works is by sitting in-between your Java application and the normal MySQL JDBC driver, Connector/J So your application will make a JDBC call using the Sequoia driver, which communicates to the Sequoia controller The Sequoia controller then will perform logic on the query based on your configuration and dispatch the query further on to one or more servers Technically the underlying databases can even be of different database vendors Sequoia uses a concept it calls RAIDb (Redundant Array of Inexpensive Databases) to control how data is partitioned and replicated There are different levels depending on your performance vs availability tradeoffs RAIDb-0 is full partitioning of data In this setup, each table is only stored once across all of the database servers So if you have 10 tables with database servers, you might have 3, 3, and tables on each server The tables themselves are not partitioned, but the entire tables can be When you make a request that accesses multiple tables, the Controller will use rewriting rules contained in it to send the requests out to all of the servers necessary In theory, due to this distribution of queries, it should lead to load balancing and higher overall performance It is possible to customize these rules to optimize individual queries your application performs le b a fer ly c a J ns a r t n o an s de ) om Gui c ng dent i p p Stu o h s his @ t g n e a s zh to u Next is what they call RAIDb-1, which is c a j e ( when every database server contains the full amount of tables is best for redundancy, however it g censof write statements very much, since theyThishave n doesa not help scalability to be applied to all servers i l h n ZFinally we have RAIDb-2, which is a hybrid model Each table is guaranteed to have at least two copies across the system, but can be configured beyond that to specify how many copies for each table and where to store the copies In addition to all of these levels, it is also possible to nest levels So you might have a RAIDb-0 controller that dispatches to a set of RAIDb-1 controllers, which then hit MySQL underneath The controller, in addition to doing all of the query decomposition mentioned above, also is a central source for monitoring, logging, caching, and resynchronization The controller is setup to keep track of what servers are alive and to load balance the requests as possible across the available systems For adding new nodes and restoring nodes, it uses a system that takes backups as well as being able to replay a centralized journal to get a node up-to-date before entering it into the available pool It can normally this in a near online fashion depending on how the underlying database can take a snapshot The controller also has a built in request cache it uses in order to attempt to speed up requests whenever possible There is commercial support from Continuent (www.continuent.com) Page E-1 Unauthorized reproduction or distribution prohibited Copyright© 2010, Oracle and/or its affiliates lyn Jac ble era nsf -tra non sa ) de com t Gui n ng ppi ude sho is St ng@ e th zha o us (jac e t ng licens Zha [...]... Reorganization 7 -11 7.5 Schema Alterations 7 -13 7.6 Index Optimizations 7 -14 7.7 Conclusions 7 -16 7.8 Summary 7 -17 8 HIGH AVAILABILITY CONCLUSIONS 8 -1 8 .1 Overview 8 -1 8.2 Overview of Availability Tools 8-2 8.2 .1 Replication 8-2 8.2.2 MySQL Cluster ... _ Page 1- 2 MySQL High Availability 1. 2 .1 Unauthorized reproduction or distribution prohibited Copyright© 2 010 , Oracle and/or its affiliates 11 MySQL Partners MySQL has had the privilege of forming alliances with excellent partners and attracting some of the most impressive customers in the industry! When you join our ranks, you are joining a winning team with a wide variety of MySQL implementations... _ Page 1- 7 MySQL High Availability 1. 4 1. 4 .1 MySQL Training Sun Microsystems offers a comprehensive set of MySQL training courses that give you a competitive edge in building world -class database solutions 19 Unauthorized reproduction or distribution prohibited Copyright© 2 010 , Oracle and/or its affiliates MySQL Services • Courses can be chosen individually, as part of a bundle, and/or... Copyright© 2 010 , Oracle and/or its affiliates MySQL High Availability 6.4 DRBD and Heartbeat 6-9 6.4 .1 Configuring DRBD and Heartbeat 6-9 6.4.2 Example failover scenarios 6 -10 6.4.3 Node Fencing and STONITH devices 6 -11 6.5 Other DRBD Benefits 6 -11 6.6 Additional Resources 6 -12 6.7 Summary 6 -17 7 SYSTEM... _ Page 1- 15 MySQL High Availability 27 1. 9 .1 MySQL Community Web Page Unauthorized reproduction or distribution prohibited Copyright© 2 010 , Oracle and/or its affiliates The MySQL Community web page is located at http:/ / dev .mysql. com and is maintained by Sun Microsystems, Inc/ This is the main support tool for the MySQL open source community and can provide valuable... as root This step creates a group called mysql that will only be used for running the MySQL server le b a r 10 With the mysql group created, it is now time to This user, mysql, will be the user that the MySQL eserver f s create a mysql user assigned to this group by typing will run under an r the following command: t on /usr/sbin/useradd -g mysql mysql n a s 11 MySQL initially has no databases installed... _ Page 1- 21 MySQL High Availability 1. 11 Installing the "world" database Unauthorized reproduction or distribution prohibited Copyright© 2 010 , Oracle and/or its affiliates 30 MySQL provides three example databases to be used for testing server features and training These databases can be found on the MySQL website documentation page; http://dev .mysql. com/doc/ The ‘world’ database... _ Page 1- 1 MySQL High Availability 1. 2 MySQL is a Relational Database Management System (RDBMS) that was originally developed by MySQL AB’ It was (and continues to be) developed and marketed as a family of high performance, affordable database servers and tools Contributing to building the missioncritical, high- volume systems and products worldwide is what makes MySQL the world’s most... licens Zha MySQL High Availability 1 8 INTRODUCTION 1. 1 Learning Objectives Unauthorized reproduction or distribution prohibited Copyright© 2 010 , Oracle and/or its affiliates This chapter introduces you to MySQL products and services In this chapter, you will learn: • The origin and status of the MySQL company • The MySQL products and professional services that are available • The definition of MySQL Enterprise... Services page lyn the MySQL home page Jac _ _ _ Page 1- 17 MySQL High Availability 1. 10 Installing MySQL Unauthorized reproduction or distribution prohibited Copyright© 2 010 , Oracle and/or its affiliates 29 The recommended method for downloading the MySQL Cluster Carrier

Ngày đăng: 25/11/2016, 19:08

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan