問題描述:?
創(chuàng)新互聯(lián)公司是一家從事企業(yè)網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)制作、網(wǎng)站設(shè)計(jì)、行業(yè)門戶網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計(jì)制作的專業(yè)網(wǎng)站制作公司,擁有經(jīng)驗(yàn)豐富的網(wǎng)站建設(shè)工程師和網(wǎng)頁設(shè)計(jì)人員,具備各種規(guī)模與類型網(wǎng)站建設(shè)的實(shí)力,在網(wǎng)站建設(shè)領(lǐng)域樹立了自己獨(dú)特的設(shè)計(jì)風(fēng)格。自公司成立以來曾獨(dú)立設(shè)計(jì)制作的站點(diǎn)上千。
在gtid模式下? ,mha發(fā)生故障切換 ,如果Linux主機(jī)還存活? ,不會(huì)去比對(duì)master的日志,獲取差異日志 ,有導(dǎo)致數(shù)據(jù)丟失的風(fēng)險(xiǎn) 。
問題修復(fù):
找到?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 函數(shù)定義的位置
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"); ??}