1,線上在用的my.cnf配置檔案的[client]段有配置default-character-set=utf8。在用masterha_check_repl --conf=/etc/masterha_default.cnf檢測 複制狀态的時候會報錯:
Wed Jan 20 03:03:43 2016 - [info] Connecting to [email protected](192.168.6.85:22)..
mysqlbinlog: unknown variable 'default-character-set=utf8'
mysqlbinlog version command failed with rc 7:0, please verify PATH, LD_LIBRARY_PATH, and client options
at /usr/bin/apply_diff_relay_logs line 493
解決方法:
因為mysqlbinlog工具檢視二進制日志時會重新讀取的mysql的配置檔案my.cnf,而不是伺服器已經加載進記憶體的配置檔案,是以可以把my.cnf的default-character-set=utf8這個參數注釋掉,但是可以不重新開機,這樣既不會對線上業務有影響,也可以避免複制狀态檢測報錯。
2,如果root使用者不允許做ssh免密碼登陸,用非root使用者部署mha的時候要把這個使用者加入到mysql組,讓其有操作binlog和relaylog的權限。
3,MHA在執行master_check_repl會調用/usr/bin/mysqlbinlog,對于源碼安裝在不同的路徑的mysql高版本則收到如下錯誤提示:
mysqlbinlog version is 3.2 (included in MySQL Client 5.0 or lower). This is not recommended. Consider upgrading MySQL Client to 5.1 or higher.
mysqlbinlog is 3.2 (included in MySQL Client 5.0 or lower), but MySQL server version is 5.5.33-log. mysqlbinlog can not parse row based events. Terminating script for safety reasons.
重新建立軟連結:
mv /usr/bin/mysqlbinlog /usr/bin/mysqlbinlog.bak
ln -sv /usr/local/ver01/percona/bin/mysqlbinlog /usr/bin/mysqlbinlog
也可以解除安裝系統目前的mysql rpm包
4,MHA在完成一次故障切換後會退出,需要手動再次開啟。
5,線上切換時的報錯:
Thu Jan 21 17:50:28 2016 - [error][/usr/lib/perl5/site_perl/5.8.8/MHA/MasterRotate.pm, ln612] We should not start online master switch when one of connections are running long updates on the current master(192.168.6.85(192.168.6.85:3306)). Currently 1 update thread(s) are running.
Details:
{'Time' => '11277','db' => undef,'Id' => '1','User' => 'event_scheduler','State' => 'Waiting on empty queue','Rows_read' => '0','Command' => 'Daemon','Rows_examined' => '0','Info' => undef,'Host' => 'localhost','Rows_sent' => '0'}
Thu Jan 21 17:50:28 2016 - [error][/usr/lib/perl5/site_perl/5.8.8/MHA/MasterRotate.pm, ln652] Got ERROR: at /usr/bin/masterha_master_switch line 53
這是由于目前主庫上開啟了event_scheduler導緻,我們可以臨時關閉下event_scheduler通過set global event_scheduler=0;待遷移完成後再開啟。
本文轉自 emma_cql 51CTO部落格,原文連結:http://blog.51cto.com/chenql/1873813