当前位置:Gxlcms > 数据库问题 > mysql高可用研究之主从+MHA架构

mysql高可用研究之主从+MHA架构

时间:2021-07-01 10:21:17 帮助过:12人阅读

Node工具包(这些工具通常由MHA Manager的脚本触发,无需人为操作)主要包括以下几个工具:

  1. <span style="color: #000000;">save_binary_logs 保存和复制master的二进制日志
  2. apply_diff_relay_logs 识别差异的中继日志事件并将其差异的事件应用于其他的slave
  3. filter_mysqlbinlog 去除不必要的ROLLBACK事件(MHA已不再使用这个工具)
  4. purge_relay_logs 清除中继日志(不会阻塞SQL线程)</span>

基本工作流程大致如下:

(1) Manager定期监控Master,监控时间间隔由参数ping_interval决定,缺省为3秒钟一次;可利用其自身的监控功能,也可调用第三方软件来监控;MHA自身提供了两种监控方式:SELECT(执行SELECT 1)和CONNECT(创建连接/断开连接),

        主要由ping_type参数决定,默认是select方式。

(2) 当监测到Master故障时,调用SSH脚本对所有Node执行一次检查,包括如下几个方面:

        ――MySQL实例是否可以连接;

        ――Master服务器是否可以SSH连通;

    ――检查SQL Thread的状态;

    ――检查哪些Server死掉了,哪些Server是活动的,以及活动的Slave实例;

    ――检查Slave实例的配置及复制过滤规则;

    ――最后退出监控脚本并返回代表特殊意义代码。

(3) 开始Master故障切换,包括如下几个子阶段:

    ――Phase 1: Configuration Check Phase

        在这个阶段,若某个Slave实例的SQL Thread停止了,则会自动启动它;并再次确认活动的Servers及Slaves。

    ――Phase 2: Dead Master Shutdown Phase

        在这个阶段,首先调用master_ip_failover_script,若HA是基于VIP实现的,则关闭VIP,若是基于目录数据库实现的,则修改映射记录。然后调用shutdown_script脚本强制关闭主机,以避免服务重启时,发生脑裂。

    ――Phase 3: Master Recovery Phase

   又包括如下3个子阶段:

     Phase 3.1: Getting Latest Slaves Phase

    检查各个Slave,获取最近的和最旧的binary log file和position,并检查各个Slave成为Master的优先级,依赖于candidate_master、no_master、 [server_xxx]顺序、binary log差异量等因素。

     Phase 3.2: Saving Dead Master‘s Binlog Phase

    若dead master所在服务器依然可以通过SSH连通,则提取dead master的binary log,提取日志的起点就是上一步获取的最新的binary log file和position,直到最后一条事件日志,并在dead master本地的工作目录(由参数remote_workdir决定)中

           创建文件保存这些提取到的日志,然后将该文件拷贝到Manager服务器的工作 目录下(由参数manager_workdir决定)。若dead master系统就无法连接,也就不存在差异的binary log了。MHA还要对各个Slave节点进行健康检查,主要是SSH连通性。

    Phase 3.3: Determining New Master Phase

    接下来调用apply_diff_relay_logs命令恢复Slave的差异日志,这个差异日志指的是各个Slave之间的relay log。恢复完成后,所有的Slave数据是一致的,此时就可以根据优先级选择New Master了。

    Phase 3.4: New Master Diff Log Generation Phase

    这里是生成dead master和new master之间的差异日志,即将Phase 3.2保存的binary log拷贝到New Master的工作目录中(remote_workdir)。

    Phase 3.5: Master Log Apply Phase

    将上一步拷贝的差异日志恢复到New Master上,若发生错误,也可手动恢复。然后获取New Master的binlog name和position,以便其它Slave从这个新的binlog name和position开始复制。最后会开启New Master的写权限,即将read_only参数设置为0。

    ――Phase 4: Slaves Recovery Phase

    Phase 4.1: Starting Parallel Slave Diff Log Generation Phase

    生成Slave与New Slave之间的差异日志,并将该日志拷贝到各Slave的工作目录下,这部分日志dead master和new master之间差异的那部分日志,因为各个Slave在Phase 3.3阶段已经同步了。

    Phase 4.2: Starting Parallel Slave Log Apply Phase

    在各个Slave上应用这部分差异日志,然后通过CHANGE MASTER TO命令将这些Slave指向新的New Master,最后开始复制(start slave)。

    ――Phase 5: New master cleanup phase

    清理New Master其实就是重置slave info,即取消原来的Slave信息。至此整个Master故障切换过程完成。

######################################################################################################################################

二、【实验部分】

  1. <span style="font-size: 14px;"><strong>1、【环境说明】:默认三台机器上都已安装mysql5.6,且主从复制已经配置完成。<br></strong></span><br>主库:<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129(读写)</span><span style="color: #000000;">
  2. 从1: </span><span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span><span style="color: #000000;">(指定的接管主库)(只读)
  3. 从2: </span><span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132<span style="color: #000000;">(只读)</span></span><span style="color: #000000;">
  4. vip: </span><span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.100</span>

技术分享

 

这里需要设置两个从库为只读库,不建议将它写入配置文件,因为有个从库随时会切换为主库。如下:

  1. set global read_only=<span style="color: #800080;">1</span>

2、配置三台机器之间的信任机制(省)

     目的:机器之间能够无需输入密码进行访

3、安装mha软件

  • 安装:每台机器都要安装node,manager节点建议安装到单独的一台机器上或者一个不用切换为主的从库上
    1. #安装可能需要的依赖包<br>[root@node1 software]# <span style="color: #0000ff;">yum</span> <span style="color: #0000ff;">install</span> <span style="color: #0000ff;">perl</span>-DBD-<span style="color: #000000;">MySQL
    2. [root@node1 software]# </span><span style="color: #0000ff;">yum</span> <span style="color: #0000ff;">install</span> <span style="color: #0000ff;">perl</span>-Config-<span style="color: #000000;">Tiny
    3. [root@node1 software]# </span><span style="color: #0000ff;">yum</span> <span style="color: #0000ff;">install</span> <span style="color: #0000ff;">perl</span>-Parallel-ForkManager*<span style="color: #000000;">.rpm
    4. [root@node1 software]# </span><span style="color: #0000ff;">yum</span> <span style="color: #0000ff;">install</span> <span style="color: #0000ff;">perl</span>-Mail-Sender*<span style="color: #000000;">.rpm
    5. [root@node1 software]# </span><span style="color: #0000ff;">yum</span> <span style="color: #0000ff;">install</span> <span style="color: #0000ff;">perl</span>-Mail-Sendmail*<span style="color: #000000;">.rpm
    6. [root@node1 software]# </span><span style="color: #0000ff;">yum</span> <span style="color: #0000ff;">install</span> <span style="color: #0000ff;">perl</span>-Log-Dispatch*<span style="color: #000000;">.rpm <br>#安装mha,这里用rpm包安装,默认在/usr/bin
    7. [root@node1 software]# </span><span style="color: #0000ff;">yum</span> <span style="color: #0000ff;">install</span> mha4mysql-node-<span style="color: #800080;">0.56</span>-<span style="color: #800080;">0</span><span style="color: #000000;">.el6.noarch.rpm
    8. [root@node1 software]# </span><span style="color: #0000ff;">yum</span> <span style="color: #0000ff;">install</span> mha4mysql-manager-<span style="color: #800080;">0.56</span>-<span style="color: #800080;">0</span>.el6.noarch.rpm

4、配置主库服务器的vip并测试

这里通过脚本手动创建vip,如下:

  1. [root@node1 scripts]# <span style="color: #0000ff;">cat</span> init_vip.<span style="color: #0000ff;">sh</span><span style="color: #000000;">
  2. vip</span>=<span style="color: #800000;">"</span><span style="color: #800000;">192.168.1.100/32</span><span style="color: #800000;">"</span>
  3. /sbin/ip addr add $vip dev eth0

【测试】到任意从库ping 192.168.245.100 --看是否连上vip

         mysql -h 192.168.223.100 -udarren -pdarren    --是否连上vip数据库

 如果都能够连接上,表示vip设置成功了。

5、配置mha及启动

(1)创建mha监控用户(在主库执行,这样每个服务器都有这个用户了)

  1. mysql> grant all privileges on *.* to <span style="color: #800000;">‘</span><span style="color: #800000;">root</span><span style="color: #800000;">‘</span>@<span style="color: #800000;">‘</span><span style="color: #800000;">%</span><span style="color: #800000;">‘</span> identified by <span style="color: #800000;">‘</span><span style="color: #800000;">123456</span><span style="color: #800000;">‘</span><span style="color: #000000;">;
  2. Query OK, </span><span style="color: #800080;">0</span> rows affected (<span style="color: #800080;">0.00</span><span style="color: #000000;"> sec)
  3. mysql</span>><span style="color: #000000;"> flush privileges;
  4. Query OK, </span><span style="color: #800080;">0</span> rows affected (<span style="color: #800080;">0.01</span> sec)

(2)修改mha配置文件

  • 在修改配置文件前,注意一个知识点,须将从库上的relay log自动清除设置为OFF,因为MySQL数据库主从复制在缺省情况下从库的relay logs会在SQL线程执行完毕后被自动删除,但是对于MHA场景下,对于某些滞后从库的恢复依赖于其他从库的relay log,因此采取禁用自动删除功能以及定期清理的办法。对于清理过多过大的relay log需要注意引起的复制延迟资源开销等。MHA可通过purge_relay_logs脚本及配合cronjob来完成此项任务。

purge_relay_logs的主要功能:
  a、为relay日志创建硬链接(最小化批量删除大文件导致的性能问题)
  b、SET GLOBAL relay_log_purge=1; FLUSH LOGS; SET GLOBAL relay_log_purge=0;
  c、删除relay log(rm –f  /path/to/archive_dir/*)

  1. <strong><span style="color: #000000;">purge_relay_logs的用法及相关参数
  2. </span><span style="color: #800080;">1</span> purge_relay_logs --</strong><span style="color: #000000;"><strong>help</strong>
  3. Usage:
  4. purge_relay_logs </span>--user=root --password=rootpass --host=<span style="color: #800080;">127.0</span>.<span style="color: #800080;">0.1</span>
  5. <strong><span style="color: #800080;">2</span><span style="color: #000000;"> 参数描述
  6. </span></strong>--<span style="color: #000000;">user 用户名,缺省为root
  7. </span>--<span style="color: #000000;">password 密码
  8. </span>--<span style="color: #000000;">port 端口号
  9. </span>--host 主机名,缺省为127.<span style="color: #800080;">0.0</span>.<span style="color: #800080;">1</span>
  10. --workdir 指定创建relay log的硬链接的位置,默认是/var/<span style="color: #000000;">tmp,成功执行脚本后,硬链接的中继日志文件被删除,由于系统不同分区创建硬链接文件会失败,故需要执行硬链接具体位置,建议指定为relay log相同的分区
  11. </span>--disable_relay_log_purge 默认情况下,如果参数relay_log_purge=<span style="color: #800080;">1</span>,脚本不做任何处理,自动退出.设定该参数,脚本会将relay_log_purge设置为0,当清理relay log之后,最后将参数设置为OFF(<span style="color: #800080;">0</span><span style="color: #000000;">)<br>
  12. </span><strong><span style="color: #800080;">3</span></strong><span style="color: #000000;"><strong> 定制清理relay log cronjob</strong>
  13. pureg_relay_logs脚本在不阻塞SQL线程的情况下自动清理relay log。对于不断产生的relay log直接将该脚本部署到crontab以实现按天或按小时定期清理。
  14. $ crontab </span>-<span style="color: #000000;">l
  15. # purge relay logs at 5am
  16. </span><span style="color: #800080;">0</span> <span style="color: #800080;">5</span> * * * app /usr/bin/purge_relay_logs --user=root --password=PASSWORD --disable_relay_log_purge >> /var/log/masterha/purge_relay_logs.log <span style="color: #800080;">2</span>>&<span style="color: #800080;">1</span>
  • 在我们的两个从库上设置relaylog为OFF:
  1. (product)root@<span style="color: #800080;">127.0</span>.<span style="color: #800080;">0.1</span> [(none)]> set global relay_log_purge=<span style="color: #800080;">0</span><span style="color: #000000;">;
  2. Query OK, </span><span style="color: #800080;">0</span> rows affected (<span style="color: #800080;">0.00</span> sec)
  • 然后通过定时任务,每隔一天定时清除relaylog:
  1. <span style="color: #000000;">#清除脚本
  2. #</span>!/bin/<span style="color: #000000;">bash
  3. user</span>=<span style="color: #000000;">root
  4. </span><span style="color: #0000ff;">passwd</span>=<span style="color: #000000;">root
  5. port</span>=<span style="color: #800080;">3306</span><span style="color: #000000;">
  6. log_dir</span>=<span style="color: #800000;">‘</span><span style="color: #800000;">/data/masterha/log</span><span style="color: #800000;">‘</span><span style="color: #000000;">
  7. work_dir</span>=<span style="color: #800000;">‘</span><span style="color: #800000;">/data</span><span style="color: #800000;">‘</span><span style="color: #000000;">
  8. purge</span>=<span style="color: #800000;">‘</span><span style="color: #800000;">/usr/bin/purge_relay_logs</span><span style="color: #800000;">‘</span>
  9. <span style="color: #0000ff;">if</span> [ ! -<span style="color: #000000;">d $log_dir ]
  10. </span><span style="color: #0000ff;">then</span>
  11. <span style="color: #0000ff;">mkdir</span> $log_dir -<span style="color: #000000;">p
  12. </span><span style="color: #0000ff;">fi</span><span style="color: #000000;">
  13. $purge </span>--user=$user --password=$<span style="color: #0000ff;">passwd</span> --disable_relay_log_purge --port=$port --workdir=$work_dir >> $log_dir/purge_relay_logs.log <span style="color: #800080;">2</span>>&<span style="color: #800080;">1</span><span style="color: #000000;">
  14. #定时任务
  15. crontab </span>-<span style="color: #000000;">e
  16. #每天早上5点10分执行
  17. </span><span style="color: #800080;">10</span> <span style="color: #800080;">5</span> * * * <span style="color: #0000ff;">sh</span> /data/scripts/purge_relay_log.<span style="color: #0000ff;">sh</span>
  • 修改配置文件:

到manager节点的/etc下面新建masterha目录,并将mha需要的配置初始化文件拷贝到该目录下:

  1. [root@node3 ~]# cd /<span style="color: #000000;">etc
  2. [root@node3 etc]# <span style="color: #0000ff;">mkdir masterha<br>#创建以下mha日志目录,没有则报错<br></span>[root@node3 etc]#</span>mkdir -p /var/log/masterha/app1
  1. <span style="color: #000000;">[root@node3 mastermha]# ll
  2. total <span style="color: #800080;">32
  3. -rw-r--r--. <span style="color: #800080;">1 root root <span style="color: #800080;">503 Nov <span style="color: #800080;">9 <span style="color: #800080;">01:<span style="color: #800080;">26<span style="color: #000000;"> app1.conf
  4. -rwxr-xr-x. <span style="color: #800080;">1 root root <span style="color: #800080;">55 Nov <span style="color: #800080;">9 <span style="color: #800080;">01:<span style="color: #800080;">26 drop_vip.<span style="color: #0000ff;">sh
  5. -rwxr-xr-x. <span style="color: #800080;">1 root root <span style="color: #800080;">55 Nov <span style="color: #800080;">9 <span style="color: #800080;">01:<span style="color: #800080;">26 init_vip.<span style="color: #0000ff;">sh
  6. -rw-r--r--. <span style="color: #800080;">1 root root <span style="color: #800080;">357 Nov <span style="color: #800080;">9 <span style="color: #800080;">01:<span style="color: #800080;">26<span style="color: #000000;"> masterha_default.conf
  7. -rwxr-xr-x. <span style="color: #800080;">1 root root <span style="color: #800080;">3888 Nov <span style="color: #800080;">9 <span style="color: #800080;">01:<span style="color: #800080;">26<span style="color: #000000;"> master_ip_failover
  8. -rwxr-xr-x. <span style="color: #800080;">1 root root <span style="color: #800080;">10298 Nov <span style="color: #800080;">9 <span style="color: #800080;">01:<span style="color: #800080;">26 master_ip_online_change</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>

然后修改vip的值:在masterha目录下执行grep "vip" *,将会列出所有文件中vip变量,然后一一修改为192.168.245.100。

修改app1.conf文件:

 

  1. <span style="color: #000000;">#mha manager工作目录
  2. manager_workdir </span>= /var/log/masterha/<span style="color: #000000;">app1
  3. manager_log </span>= /var/log/masterha/app1/<span style="color: #000000;">app1.log
  4. remote_workdir </span>= /var/log/masterha/<span style="color: #000000;">app1
  5. user</span>=<span style="color: #000000;">root
  6. password</span>=<span style="color: #000000;">root
  7. ssh_user</span>=<span style="color: #000000;">root
  8. repl_user</span>=<span style="color: #000000;">repl
  9. repl_password</span>=<span style="color: #000000;">repl4slave
  10. ping_interval</span>=<span style="color: #800080;">1</span><span style="color: #000000;">
  11. shutdown_script</span>=<span style="color: #800000;">""</span><span style="color: #000000;">
  12. master_ip_online_change_script</span>=<span style="color: #800000;">""</span><span style="color: #000000;">
  13. report_script</span>=<span style="color: #800000;">""</span><span style="color: #000000;">
  14. [server1]
  15. </span><span style="color: #0000ff;">hostname</span>=<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span><span style="color: #000000;">
  16. master_binlog_dir </span>= /data/mysql/mysql_3306/<span style="color: #000000;">logs
  17. candidate_master</span>=<span style="color: #800080;">1</span><span style="color: #000000;">
  18. check_repl_delay</span>=<span style="color: #800080;">0</span><span style="color: #000000;">
  19. [server2]
  20. </span><span style="color: #0000ff;">hostname</span>=<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span><span style="color: #000000;">
  21. master_binlog_dir</span>=/data/mysql/mysql_3306/<span style="color: #000000;">logs
  22. candidate_master</span>=<span style="color: #800080;">1</span><span style="color: #000000;">
  23. check_repl_delay</span>=<span style="color: #800080;">0</span><span style="color: #000000;">
  24. [server3]
  25. </span><span style="color: #0000ff;">hostname</span>=<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132</span><span style="color: #000000;">
  26. port</span>=<span style="color: #800080;">3306</span>

 

 

  • 检查mha环境并启动
  1. <span style="color: #000000;">#检查MHA Manger到所有MHA Node的SSH连接状态:
  2. [root@node3 masterha]# </span>/usr/bin/masterha_check_ssh --conf=/etc/masterha/<span style="color: #000000;">app1.conf
  3. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">24</span>:<span style="color: #800080;">21</span> <span style="color: #800080;">2015</span> - [warning] Global configuration <span style="color: #0000ff;">file</span> /etc/<span style="color: #000000;">masterha_default.cnf not found. Skipping.
  4. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">24</span>:<span style="color: #800080;">21</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] Reading application default configuration from /etc/masterha/<span style="color: #000000;">app1.conf..
  5. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">24</span>:<span style="color: #800080;">21</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] Reading server configuration from /etc/masterha/<span style="color: #000000;">app1.conf..
  6. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">24</span>:<span style="color: #800080;">21</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span><span style="color: #000000;">] Starting SSH connection tests..
  7. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">24</span>:<span style="color: #800080;">24</span> <span style="color: #800080;">2015</span> -<span style="color: #000000;"> [debug]
  8. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">24</span>:<span style="color: #800080;">21</span> <span style="color: #800080;">2015</span> - [debug] Connecting via SSH from root@<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span>:<span style="color: #800080;">22</span>) to root@<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span>:<span style="color: #800080;">22</span><span style="color: #000000;">)..
  9. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">24</span>:<span style="color: #800080;">23</span> <span style="color: #800080;">2015</span> -<span style="color: #000000;"> [debug] ok.
  10. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">24</span>:<span style="color: #800080;">23</span> <span style="color: #800080;">2015</span> - [debug] Connecting via SSH from root@<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span>:<span style="color: #800080;">22</span>) to root@<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132</span>:<span style="color: #800080;">22</span><span style="color: #000000;">)..
  11. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">24</span>:<span style="color: #800080;">24</span> <span style="color: #800080;">2015</span> -<span style="color: #000000;"> [debug] ok.
  12. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">24</span>:<span style="color: #800080;">25</span> <span style="color: #800080;">2015</span> -<span style="color: #000000;"> [debug]
  13. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">24</span>:<span style="color: #800080;">22</span> <span style="color: #800080;">2015</span> - [debug] Connecting via SSH from root@<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span>:<span style="color: #800080;">22</span>) to root@<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span>:<span style="color: #800080;">22</span><span style="color: #000000;">)..
  14. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">24</span>:<span style="color: #800080;">23</span> <span style="color: #800080;">2015</span> -<span style="color: #000000;"> [debug] ok.
  15. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">24</span>:<span style="color: #800080;">23</span> <span style="color: #800080;">2015</span> - [debug] Connecting via SSH from root@<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span>:<span style="color: #800080;">22</span>) to root@<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132</span>:<span style="color: #800080;">22</span><span style="color: #000000;">)..
  16. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">24</span>:<span style="color: #800080;">25</span> <span style="color: #800080;">2015</span> -<span style="color: #000000;"> [debug] ok.
  17. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">24</span>:<span style="color: #800080;">25</span> <span style="color: #800080;">2015</span> -<span style="color: #000000;"> [debug]
  18. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">24</span>:<span style="color: #800080;">22</span> <span style="color: #800080;">2015</span> - [debug] Connecting via SSH from root@<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132</span>:<span style="color: #800080;">22</span>) to root@<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span>:<span style="color: #800080;">22</span><span style="color: #000000;">)..
  19. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">24</span>:<span style="color: #800080;">24</span> <span style="color: #800080;">2015</span> -<span style="color: #000000;"> [debug] ok.
  20. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">24</span>:<span style="color: #800080;">24</span> <span style="color: #800080;">2015</span> - [debug] Connecting via SSH from root@<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132</span>:<span style="color: #800080;">22</span>) to root@<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span>:<span style="color: #800080;">22</span><span style="color: #000000;">)..
  21. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">24</span>:<span style="color: #800080;">25</span> <span style="color: #800080;">2015</span> -<span style="color: #000000;"> [debug] ok.
  22. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">24</span>:<span style="color: #800080;">25</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] All SSH connection tests passed successfully.
技术分享
  1. <span style="color: #000000;">#检查主从复制环境
  2. [root@node3 masterha]# </span>/usr/bin/masterha_check_repl --conf=/etc/masterha/<span style="color: #000000;">app1.conf
  3. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">08</span> <span style="color: #800080;">2015</span> - [warning] Global configuration <span style="color: #0000ff;">file</span> /etc/<span style="color: #000000;">masterha_default.cnf not found. Skipping.
  4. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">08</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] Reading application default configuration from /etc/masterha/<span style="color: #000000;">app1.conf..
  5. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">08</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] Reading server configuration from /etc/masterha/<span style="color: #000000;">app1.conf..
  6. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">08</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] MHA::MasterMonitor version <span style="color: #800080;">0.56</span><span style="color: #000000;">.
  7. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">09</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] GTID failover mode = <span style="color: #800080;">0</span><span style="color: #000000;">
  8. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">09</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span><span style="color: #000000;">] Dead Servers:
  9. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">09</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span><span style="color: #000000;">] Alive Servers:
  10. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">09</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] <span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span>:<span style="color: #800080;">3306</span><span style="color: #000000;">)
  11. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">09</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] <span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span>:<span style="color: #800080;">3306</span><span style="color: #000000;">)
  12. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">09</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] <span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132</span>:<span style="color: #800080;">3306</span><span style="color: #000000;">)
  13. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">09</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span><span style="color: #000000;">] Alive Slaves:
  14. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">09</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] <span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span>:<span style="color: #800080;">3306</span>) Version=<span style="color: #800080;">5.6</span>.<span style="color: #800080;">23</span>-log (oldest major version between slaves) log-<span style="color: #000000;">bin:enabled
  15. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">09</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] Replicating from <span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span>:<span style="color: #800080;">3306</span><span style="color: #000000;">)
  16. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">09</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] Primary candidate <span style="color: #0000ff;">for</span><span style="color: #000000;"> the new Master (candidate_master is set)
  17. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">09</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] <span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132</span>:<span style="color: #800080;">3306</span>) Version=<span style="color: #800080;">5.6</span>.<span style="color: #800080;">21</span>-log (oldest major version between slaves) log-<span style="color: #000000;">bin:enabled
  18. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">09</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] Replicating from <span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span>:<span style="color: #800080;">3306</span><span style="color: #000000;">)
  19. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">09</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] Current Alive Master: <span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span>:<span style="color: #800080;">3306</span><span style="color: #000000;">)
  20. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">09</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span><span style="color: #000000;">] Checking slave configurations..
  21. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">09</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] read_only=<span style="color: #800080;">1</span> is not set on slave <span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span>:<span style="color: #800080;">3306</span><span style="color: #000000;">).
  22. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">09</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] read_only=<span style="color: #800080;">1</span> is not set on slave <span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132</span>:<span style="color: #800080;">3306</span><span style="color: #000000;">).
  23. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">09</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span><span style="color: #000000;">] Checking replication filtering settings..
  24. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">09</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] binlog_do_db= , binlog_ignore_db=<span style="color: #000000;">
  25. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">09</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span><span style="color: #000000;">] Replication filtering check ok.
  26. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">09</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] GTID (with auto-<span style="color: #000000;">pos) is not supported
  27. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">09</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span><span style="color: #000000;">] Starting SSH connection tests..
  28. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">12</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span><span style="color: #000000;">] All SSH connection tests passed successfully.
  29. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">12</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span><span style="color: #000000;">] Checking MHA Node version..
  30. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">13</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span><span style="color: #000000;">] Version check ok.
  31. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">13</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span><span style="color: #000000;">] Checking SSH publickey authentication settings on the current master..
  32. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">13</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] HealthCheck: SSH to <span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span><span style="color: #000000;"> is reachable.
  33. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">14</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] Master MHA Node version is <span style="color: #800080;">0.56</span><span style="color: #000000;">.
  34. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">14</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] Checking recovery script configurations on <span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span>:<span style="color: #800080;">3306</span><span style="color: #000000;">)..
  35. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">14</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] Executing command: save_binary_logs --command=test --start_pos=<span style="color: #800080;">4</span> --binlog_dir=/data/mysql/mysql_3306/logs --output_file=/var/log/masterha/app1/save_binary_logs_test --manager_version=<span style="color: #800080;">0.56</span> --start_file=mysql-bin.<span style="color: #800080;">000023</span><span style="color: #000000;">
  36. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">14</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] Connecting to root@<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span>:<span style="color: #800080;">22</span><span style="color: #000000;">)..
  37. Creating </span>/var/log/masterha/app1 <span style="color: #0000ff;">if</span><span style="color: #000000;"> not exists.. ok.
  38. Checking output directory is accessible or not..
  39. ok.
  40. Binlog found at </span>/data/mysql/mysql_3306/logs, up to mysql-bin.<span style="color: #800080;">000023</span><span style="color: #000000;">
  41. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">15</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] Binlog setting check <span style="color: #0000ff;">done</span><span style="color: #000000;">.
  42. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">15</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span><span style="color: #000000;">] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers..
  43. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">15</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] Executing command : apply_diff_relay_logs --command=test --slave_user=<span style="color: #800000;">‘</span><span style="color: #800000;">root</span><span style="color: #800000;">‘</span> --slave_host=<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span> --slave_ip=<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span> --slave_port=<span style="color: #800080;">3306</span> --workdir=/var/log/masterha/app1 --target_version=<span style="color: #800080;">5.6</span>.<span style="color: #800080;">23</span>-log --manager_version=<span style="color: #800080;">0.56</span> --relay_log_info=/data/mysql/mysql_3306/data/relay-log.<span style="color: #0000ff;">info</span> --relay_dir=/data/mysql/mysql_3306/data/ --slave_pass=<span style="color: #000000;">xxx
  44. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">15</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] Connecting to root@<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span>:<span style="color: #800080;">22</span><span style="color: #000000;">)..
  45. Checking slave recovery environment settings..
  46. Opening </span>/data/mysql/mysql_3306/data/relay-log.<span style="color: #0000ff;">info</span><span style="color: #000000;"> ... ok.
  47. Relay log found at </span>/data/mysql/mysql_3306/data, up to relay-bin.<span style="color: #800080;">000009</span><span style="color: #000000;">
  48. Temporary relay log </span><span style="color: #0000ff;">file</span> is /data/mysql/mysql_3306/data/relay-bin.<span style="color: #800080;">000009</span><span style="color: #000000;">
  49. Testing mysql connection and privileges..Warning: Using a password on the command line interface can be insecure.
  50. </span><span style="color: #0000ff;">done</span><span style="color: #000000;">.
  51. Testing mysqlbinlog output.. </span><span style="color: #0000ff;">done</span><span style="color: #000000;">.
  52. Cleaning up test </span><span style="color: #0000ff;">file</span>(s).. <span style="color: #0000ff;">done</span><span style="color: #000000;">.
  53. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">15</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] Executing command : apply_diff_relay_logs --command=test --slave_user=<span style="color: #800000;">‘</span><span style="color: #800000;">root</span><span style="color: #800000;">‘</span> --slave_host=<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132</span> --slave_ip=<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132</span> --slave_port=<span style="color: #800080;">3306</span> --workdir=/var/log/masterha/app1 --target_version=<span style="color: #800080;">5.6</span>.<span style="color: #800080;">21</span>-log --manager_version=<span style="color: #800080;">0.56</span> --relay_log_info=/data/mysql/data/relay-log.<span style="color: #0000ff;">info</span> --relay_dir=/data/mysql/data/ --slave_pass=<span style="color: #000000;">xxx
  54. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">15</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] Connecting to root@<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132</span>:<span style="color: #800080;">22</span><span style="color: #000000;">)..
  55. Checking slave recovery environment settings..
  56. Opening </span>/data/mysql/data/relay-log.<span style="color: #0000ff;">info</span><span style="color: #000000;"> ... ok.
  57. Relay log found at </span>/data/mysql/data, up to node3-relay-bin.<span style="color: #800080;">000007</span><span style="color: #000000;">
  58. Temporary relay log </span><span style="color: #0000ff;">file</span> is /data/mysql/data/node3-relay-bin.<span style="color: #800080;">000007</span><span style="color: #000000;">
  59. Testing mysql connection and privileges..Warning: Using a password on the command line interface can be insecure.
  60. </span><span style="color: #0000ff;">done</span><span style="color: #000000;">.
  61. Testing mysqlbinlog output.. </span><span style="color: #0000ff;">done</span><span style="color: #000000;">.
  62. Cleaning up test </span><span style="color: #0000ff;">file</span>(s).. <span style="color: #0000ff;">done</span><span style="color: #000000;">.
  63. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">16</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] Slaves settings check <span style="color: #0000ff;">done</span><span style="color: #000000;">.
  64. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">16</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span><span style="color: #000000;">]
  65. </span><span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.129</span>:<span style="color: #800080;">3306</span><span style="color: #000000;">) (current master)
  66. </span>+--<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span>:<span style="color: #800080;">3306</span><span style="color: #000000;">)
  67. </span>+--<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132</span>(<span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132</span>:<span style="color: #800080;">3306</span><span style="color: #000000;">)
  68. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">16</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] Checking replication health on <span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.131</span><span style="color: #000000;">..
  69. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">16</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span><span style="color: #000000;">] ok.
  70. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">16</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] Checking replication health on <span style="color: #800080;">192.168</span>.<span style="color: #800080;">245.132</span><span style="color: #000000;">..
  71. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">16</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span><span style="color: #000000;">] ok.
  72. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">16</span> <span style="color: #800080;">2015</span> -<span style="color: #000000;"> [warning] master_ip_failover_script is not defined.
  73. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">16</span> <span style="color: #800080;">2015</span> -<span style="color: #000000;"> [warning] shutdown_script is not defined.
  74. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">37</span>:<span style="color: #800080;">16</span> <span style="color: #800080;">2015</span> - [<span style="color: #0000ff;">info</span>] Got exit code <span style="color: #800080;">0</span><span style="color: #000000;"> (Not master dead).
  75. MySQL Replication Health is OK.</span>
View Code

如果遇到这个报错:

  1. Can<span style="color: #800000;">‘</span><span style="color: #800000;">t exec "mysqlbinlog": No such file or directory at /usr/share/perl5/vendor_perl/MHA/BinlogManager.pm line 106.</span>
  2. mysqlbinlog version command failed with rc <span style="color: #800080;">1</span>:<span style="color: #800080;">0</span><span style="color: #000000;">, please verify PATH, LD_LIBRARY_PATH, and client options
  3. at </span>/usr/bin/apply_diff_relay_logs line <span style="color: #800080;">493</span><span style="color: #000000;">
  4. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">32</span>:<span style="color: #800080;">36</span> <span style="color: #800080;">2015</span> - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln205] Slaves settings check failed!<span style="color: #000000;">
  5. Mon Nov </span><span style="color: #800080;">16</span> <span style="color: #800080;">01</span>:<span style="color: #800080;">32</span>:<span style="color: #800080;">36</span> <span style="color: #800080;">2015</span> - [e

人气教程排行