Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The solution to the failure of mha in gtid mode

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

On the basis of introducing the fault solution of mha in gtid mode, this paper focuses on its concrete steps, which are simple and easy to operate, and the content of the article is compact step by step. I hope you can get something according to this article.

Problem description:

In gtid mode, mha fails over. If the Linux host is still alive, it will not compare master logs and obtain differential logs, which may lead to data loss.

Problem fix:

Find the MasterFailover.pm file, which will follow! Remove

If (! $_ server_manager- > is_gtid_auto_pos_enabled ()) {$log- > info (); $log- > info ("* Phase 3.2: Saving Dead Master's Binlog Phase..\ n"); $log- > info (); save_master_binlog ($dead_master);}

The removed code

If ($_ server_manager- > is_gtid_auto_pos_enabled ()) {$log- > info (); $log- > info ("* Phase 3.2: Saving Dead Master's Binlog Phase..\ n"); $log- > info (); save_master_binlog ($dead_master);}

Find the location defined by the apply_binlog_to_master function

Sub apply_binlog_to_master ($) {my $target = shift; my $err_file = "$g_workdir/mysql_from_binlog.err"; my $command = "cat $_ diff_binary_log | mysql-- binary-mode-- user=$target- > {mysql_escaped_user}-- password=$target- > {mysql_escaped_password}-- host=$target- > {ip}-port=$target- > {port}-vvv-unbuffered > $err_file 2 > & 1" $log- > info ("Checking if super_read_only is defined and turned on.."); my ($super_read_only_enabled, $dbh) = MHA::SlaveUtil::check_if_super_read_only ($target- > {hostname}, $target- > {ip}, $target- > {port}, $target- > {user}, $target- > {password}); if ($super_read_only_enabled) {MHA::SlaveUtil::disable_super_read_only ($dbh) } else {$log- > info ("not present or turned off, ignoring.\ n");}

Modified code cat $_ diff_binary_log

Sub apply_binlog_to_master ($) {my $target = shift; my $err_file = "$g_workdir/mysql_from_binlog.err"; my $command = "mysqlbinlog $_ diff_binary_log-- skip-gtids=true | mysql-- binary-mode-- user=$target- > {mysql_escaped_user}-- password=$target- > {mysql_escaped_password}-- host=$target- > {ip}-port=$target- > {port}-vvv-- unbuffered > $err_file 2 > & 1" $log- > info ("Checking if super_read_only is defined and turned on.."); my ($super_read_only_enabled, $dbh) = MHA::SlaveUtil::check_if_super_read_only ($target- > {hostname}, $target- > {ip}, $target- > {port}, $target- > {user}, $target- > {password}); if ($super_read_only_enabled) {MHA::SlaveUtil::disable_super_read_only ($dbh) } else {$log- > info ("not present or turned off, ignoring.\ n");}

The above is the solution to the failure of mha in gtid mode, and you need to use it yourself in order to understand the details. If you want to know more about it, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report