MySQL MHA简介及其优点

Jun 07, 2016 pm 04:33 PM
oracle データベース

MHA是众多使用MySQL数据库企业高可用的不二选择,它简单易用,功能强大,实现了基于MySQL replication架构的自动主从故障转移,本

MHA是众多使用MySQL数据库企业高可用的不二选择,它简单易用,功能强大,实现了基于MySQL replication架构的自动主从故障转移,本文主要使用原文描述MHA的主要特性及其优点,尽可能通过原文来理解透彻,供大家参考。

一、MHA的主要特性

MHA performs automating master failover and slave promotion with minimal downtime, usually within 10-30 seconds. MHA prevents replication consistency problems and saves on expenses of having to acquire additional servers. All this with zero performance degradation, no complexity (easy-to-install) and requiring no change to existing deployments.

MHA also provides scheduled online master switching, safely changing the currently running master to a new master, within mere seconds (0.5-2 seconds) of downtime (blocking writes only).

MHA provides the following functionality, and can be useful in many deployments in which high availability, data integrity and near non-stop master maintenance are required.

Automated master monitoring and failover(自动监控Master以及故障转移)

MHA can monitor MySQL masters in an existing replication environment, performing automatic master failover upon detection of master failure. MHA guarantees the consistency of all the slaves by identifying differential relay log events from the most current slave and applying them to all the other slaves, including those slaves which still haven't received the latest relay log events. MHA can normally perform failover in a matter of seconds: 9-12 seconds to detect master failure, optionally 7-10 seconds to power off the master machine to avoid split brain, and a few seconds to apply differential relay logs to the new master. Total downtime is normally 10-30 seconds. A specific slave can be designated as a candidate master (setting priorities) in a configuration file. Since MHA maintains consistency between slaves, any slave can be promoted to become the new master. Consistency problems, which would ordinarily cause sudden replication failure, will not occur.

Interactive (manually initiated) Master Failover(交互模式,,手动触发Master故障转移)

MHA can be configured for manually initiated (non-automatic), interactive failover, without monitoring the master.

Non-interactive master failover (非交互模式Master故障转移)

Non-interactive, automatic master failover without monitoring the master is also supported. This feature is especially useful when MySQL master software monitoring is already in use. For example, you can use Pacemaker(Heartbeat) for detecting master failure and virtual IP address takeover, while using MHA for master failover and slave promotion.

Online switching master to a different host(在线切换Master到异机)

It is often necessary to migrate an existing master to a different machine, like when the current master has H/W RAID controller or RAM problems, or when you want to replace it with a faster machine, etc. This is not a master crash, but scheduled master maintenance is required. Scheduled master maintenance should be done as quickly as possible, since it entails partial downtime (master writes are disabled). On the other hand, you should block/kill current running sessions very carefully because consistency problems between different masters may occur (i.e "updating master1, updating master 2, committing master1, getting error on committing master 2" will result in data inconsistency). Both fast master switch and graceful blocking writes are required.

MHA provides graceful master switching within 0.5-2 seconds of writer blockage. 0.5-2 seconds of writer downtime is often acceptable, so you can switch masters even without allocating a scheduled maintenance window. Actions such as upgrading to higher versions, faster machine, etc. become much easier.

二、MHA的优点

Master failover and slave promotion can be done very quickly

MHA normally can do failover in seconds (9-12 seconds to detect master failure, optionally 7-10 seconds to power off the master machine to avoid split brain, a few seconds for applying differential relay logs to the new master, so total downtime is normally 10-30 seconds), as long as slaves does not delay replication seriously. After recovering the new master, MHA recovers the rest slaves in parallel. Even though you have tens of slaves, it does not affect master recovery time, and you can recover slaves very quickly.

DeNA uses MHA on 150+ {master, slaves} environments. When one of the master crashed, MHA completed failover in 4 seconds. Doing failover in 4 seconds is never possible with traditional active/passive clustering solution.

Master crash does not result in data inconsistency

When the current master crashes, MHA automatically identifies differential relay log events between slaves, and applies to each slave. So finally all slaves can be in sync, as long as all slave servers are alive. By using together with Semi-Synchronous Replication, (almost) no data loss can also be guaranteed.

No need to modify current MySQL settings (MHA works with regular MySQL (5.0 or later))

One of the most important design principles of MHA is to make MHA easy to use as long as possible. MHA works with existing traditional MySQL 5.0+ master-slaves replication environments. Though many other HA solutions require to change MySQL deployment settings, MHA does not force such tasks for DBAs. MHA works with the most common two-tier single master and multiple slaves environments. MHA works with both asynchronous and semi-synchronous MySQL replication. Starting/Stopping/Upgrading/Downgrading/Installing/Uninstalling MHA can be done without changing (including starting/stopping) MySQL replication. When you need to upgrade MHA to newer versions, you don't need to stop MySQL. Just replace with newer MHA versions and restart MHA Manager is fine.

このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

Video Face Swap

Video Face Swap

完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

ホットツール

メモ帳++7.3.1

メモ帳++7.3.1

使いやすく無料のコードエディター

SublimeText3 中国語版

SublimeText3 中国語版

中国語版、とても使いやすい

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール

SublimeText3 Mac版

SublimeText3 Mac版

神レベルのコード編集ソフト(SublimeText3)

MySQL:世界で最も人気のあるデータベースの紹介 MySQL:世界で最も人気のあるデータベースの紹介 Apr 12, 2025 am 12:18 AM

MySQLはオープンソースのリレーショナルデータベース管理システムであり、主にデータを迅速かつ確実に保存および取得するために使用されます。その実用的な原則には、クライアントリクエスト、クエリ解像度、クエリの実行、返品結果が含まれます。使用法の例には、テーブルの作成、データの挿入とクエリ、および参加操作などの高度な機能が含まれます。一般的なエラーには、SQL構文、データ型、およびアクセス許可、および最適化の提案には、インデックスの使用、最適化されたクエリ、およびテーブルの分割が含まれます。

オラクルを開けない場合はどうすればよいですか オラクルを開けない場合はどうすればよいですか Apr 11, 2025 pm 10:06 PM

Oracleのソリューションを開くことはできません。1。データベースサービスを開始します。 2。リスナーを開始します。 3.ポートの競合を確認します。 4.環境変数を正しく設定します。 5.ファイアウォールまたはウイルス対策ソフトウェアが接続をブロックしないことを確認してください。 6.サーバーが閉じているかどうかを確認します。 7. RMANを使用して破損したファイルを回復します。 8。TNSサービス名が正しいかどうかを確認します。 9.ネットワーク接続を確認します。 10。Oracleソフトウェアを再インストールします。

なぜMySQLを使用するのですか?利点と利点 なぜMySQLを使用するのですか?利点と利点 Apr 12, 2025 am 12:17 AM

MySQLは、そのパフォーマンス、信頼性、使いやすさ、コミュニティサポートに選択されています。 1.MYSQLは、複数のデータ型と高度なクエリ操作をサポートし、効率的なデータストレージおよび検索機能を提供します。 2.クライアントサーバーアーキテクチャと複数のストレージエンジンを採用して、トランザクションとクエリの最適化をサポートします。 3.使いやすく、さまざまなオペレーティングシステムとプログラミング言語をサポートしています。 4.強力なコミュニティサポートを提供し、豊富なリソースとソリューションを提供します。

Oracle Cursorを閉じる問題を解決する方法 Oracle Cursorを閉じる問題を解決する方法 Apr 11, 2025 pm 10:18 PM

Oracle Cursorの閉鎖問題を解決する方法には、次のものが含まれます。 Scopeが終了した後に自動的に閉じるように、for update句のカーソルを宣言します。使用句のカーソルを宣言して、関連するPL/SQL変数が閉じられたときに自動的に閉じるようにします。例外処理を使用して、例外の状況でカーソルが閉じていることを確認します。接続プールを使用して、カーソルを自動的に閉じます。自動送信を無効にし、カーソルの閉鎖を遅延させます。

Oracle Loopでカーソルを作成する方法 Oracle Loopでカーソルを作成する方法 Apr 12, 2025 am 06:18 AM

Oracleでは、forループループは動的にカーソルを作成できます。手順は次のとおりです。1。カーソルタイプを定義します。 2。ループを作成します。 3.カーソルを動的に作成します。 4。カーソルを実行します。 5。カーソルを閉じます。例:カーソルをサイクルごとに作成して、上位10人の従業員の名前と給与を表示できます。

Oracleデータベースを停止する方法 Oracleデータベースを停止する方法 Apr 12, 2025 am 06:12 AM

Oracleデータベースを停止するには、次の手順を実行します。1。データベースに接続します。 2。すぐにシャットダウンします。 3.シャットダウンは完全に中止します。

Oracle Dynamic SQLを作成する方法 Oracle Dynamic SQLを作成する方法 Apr 12, 2025 am 06:06 AM

SQLステートメントは、Oracleの動的SQLを使用して、ランタイム入力に基づいて作成および実行できます。手順には、次のものが含まれます。動的に生成されたSQLステートメントを保存するための空の文字列変数を準備します。 executeを即座に使用するか、ステートメントを準備して、動的なSQLステートメントをコンパイルおよび実行します。バインド変数を使用して、ユーザー入力またはその他の動的値を動的SQLに渡します。実行するか、実行するか、動的SQLステートメントを実行します。

HDFSでCentosを構成するために必要な手順 HDFSでCentosを構成するために必要な手順 Apr 14, 2025 pm 06:42 PM

CENTOSシステムにHadoop分散ファイルシステム(HDFS)を構築するには、複数のステップが必要です。この記事では、簡単な構成ガイドを提供します。 1.初期段階でJDKをインストールする準備:すべてのノードにJavadevelopmentKit(JDK)をインストールすると、バージョンはHadoopと互換性がある必要があります。インストールパッケージは、Oracleの公式Webサイトからダウンロードできます。環境変数構成: /etc /プロファイルファイルを編集し、JavaおよびHadoop環境変数を設定して、システムがJDKとHadoopのインストールパスを見つけることができるようにします。 2。セキュリティ構成:SSHパスワードなしログインSSHキーを生成する:各ノードでSSH-KeyGenコマンドを使用する

See all articles