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.

Bagaimana untuk memantau prestasi MySQL dengan berkesan? Gunakan alat seperti mysqladmin, showglobalstatus, perconamonitoring dan pengurusan (PMM), dan mysql enterprisemonitor. 1. Gunakan mysqladmin untuk melihat bilangan sambungan. 2. Gunakan showglobalstatus untuk melihat nombor pertanyaan. 3.Pmm menyediakan data prestasi terperinci dan antara muka grafik. 4.MySqLenterPrisemonitor menyediakan fungsi pemantauan yang kaya dan mekanisme penggera.

Perbezaan antara MySQL dan SQLServer adalah: 1) MySQL adalah sumber terbuka dan sesuai untuk sistem web dan tertanam, 2) SQLServer adalah produk komersil Microsoft dan sesuai untuk aplikasi peringkat perusahaan. Terdapat perbezaan yang signifikan antara kedua -dua enjin penyimpanan, pengoptimuman prestasi dan senario aplikasi. Apabila memilih, anda perlu mempertimbangkan saiz projek dan skalabiliti masa depan.

Dalam senario aplikasi peringkat perusahaan yang memerlukan ketersediaan yang tinggi, keselamatan maju dan integrasi yang baik, SQLServer harus dipilih bukannya MySQL. 1) SQLServer menyediakan ciri peringkat perusahaan seperti ketersediaan tinggi dan keselamatan maju. 2) Ia bersepadu dengan ekosistem Microsoft seperti VisualStudio dan PowerBI. 3) SQLServer melakukan pengoptimuman prestasi yang sangat baik dan menyokong jadual yang dioptimumkan memori dan indeks penyimpanan lajur.

Mysqlmanagescharactersetsandcollationsbyusingutf-8asthedefault, membolehkanConfigurationatdatabase, table, andcolumnlevels, andrequiringcarefulalignmenttoavoidmismatches.1) setdefaultcharactandcollationforadatabase.2) configurecharact

Pencetus MySQL adalah prosedur yang disimpan secara automatik yang dikaitkan dengan jadual yang digunakan untuk melakukan satu siri operasi apabila operasi data tertentu dilakukan. 1) Definisi dan fungsi pencetus: Digunakan untuk pengesahan data, pembalakan, dan lain-lain. 2) Prinsip kerja: Ia dibahagikan kepada sebelum dan selepas, dan menyokong pencetus peringkat baris. 3) Contoh Penggunaan: Boleh digunakan untuk merakam perubahan gaji atau mengemas kini inventori. 4) Kemahiran Debugging: Gunakan perintah showtriggers dan showcreateTrigger. 5) Pengoptimuman Prestasi: Elakkan operasi kompleks, menggunakan indeks, dan menguruskan urus niaga.

Langkah -langkah untuk membuat dan mengurus akaun pengguna di MySQL adalah seperti berikut: 1. Buat pengguna: Gunakan createuser'newuser '@' localhost'identifiedby'password '; 2. Menetapkan Kebenaran: Gunakan Grantselect, Insert, UpdateOnmydatabase.to'newuser'@'localhost '; 3. Betulkan Ralat Kebenaran: Gunakan RevokeAllPrivileSeonMydatabase.from'newuser'@'localhost '; kemudian menetapkan semula kebenaran; 4. Kebenaran Pengoptimuman: Gunakan Showgra

MySQL sesuai untuk pembangunan pesat dan aplikasi kecil dan sederhana, sementara Oracle sesuai untuk perusahaan besar dan keperluan ketersediaan yang tinggi. 1) MySQL adalah sumber terbuka dan mudah digunakan, sesuai untuk aplikasi web dan perusahaan kecil dan sederhana. 2) Oracle berkuasa dan sesuai untuk perusahaan besar dan agensi kerajaan. 3) MySQL menyokong pelbagai enjin penyimpanan, dan Oracle menyediakan fungsi peringkat perusahaan yang kaya.

Kelemahan MySQL berbanding dengan pangkalan data relasi lain termasuk: 1. Isu Prestasi: Anda mungkin menghadapi kesesakan apabila memproses data berskala besar, dan PostgreSQL melakukan lebih baik dalam pertanyaan kompleks dan pemprosesan data besar. 2. Skalabiliti: Keupayaan skala mendatar tidak sebaik Google Spanner dan Amazon Aurora. 3. Batasan Fungsian: Tidak sebaik PostgreSQL dan Oracle dalam Fungsi Lanjutan, beberapa fungsi memerlukan lebih banyak kod dan penyelenggaraan tersuai.


Alat AI Hot

Undresser.AI Undress
Apl berkuasa AI untuk mencipta foto bogel yang realistik

AI Clothes Remover
Alat AI dalam talian untuk mengeluarkan pakaian daripada foto.

Undress AI Tool
Gambar buka pakaian secara percuma

Clothoff.io
Penyingkiran pakaian AI

Video Face Swap
Tukar muka dalam mana-mana video dengan mudah menggunakan alat tukar muka AI percuma kami!

Artikel Panas

Alat panas

SublimeText3 versi Cina
Versi Cina, sangat mudah digunakan

Pelayar Peperiksaan Selamat
Pelayar Peperiksaan Selamat ialah persekitaran pelayar selamat untuk mengambil peperiksaan dalam talian dengan selamat. Perisian ini menukar mana-mana komputer menjadi stesen kerja yang selamat. Ia mengawal akses kepada mana-mana utiliti dan menghalang pelajar daripada menggunakan sumber yang tidak dibenarkan.

Notepad++7.3.1
Editor kod yang mudah digunakan dan percuma

Penyesuai Pelayan SAP NetWeaver untuk Eclipse
Integrasikan Eclipse dengan pelayan aplikasi SAP NetWeaver.

SublimeText3 Linux versi baharu
SublimeText3 Linux versi terkini