您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
问题描述:
在gtid模式下 ,mha发生故障切换 ,如果Linux主机还存活 ,不会去比对master的日志,获取差异日志 ,有导致数据丢失的风险 。
问题修复:
找到 MasterFailover.pm 文件 ,将下文! 去掉
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); }
去掉后的代码
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); }
找到 apply_binlog_to_master 函数定义的位置
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"); }
修改后的代码 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"); }
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。