您好,登錄后才能下訂單哦!
問題描述:?
在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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。