Mariadb高可用MHA (四十二)

news2024/12/28 1:54:13

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档

目录

前言

一、概述    

1.1 概念

 1.2 组成

  1.3  特点

  1.4  工作原理

二、构建MHA

2.1 ssh免密登录

2.2 主从复制

2.3 MHA安装 

2.3.1所有节点安装perl环境

2.3..2 node

2.3.3 manager (只在mgt上装)

2.3.4 测试

2.3.5  故障恢复

总结



前言

MHA(Master High Availability)是一种用于MySQL和MariaDB数据库的高可用解决方案。它是由一个主节点(Master)和多个从节点(Slave)组成的集群,当主节点故障时,自动切换到一个可用的从节点上,以确保数据库的连续性和可用性。


提示:以下是本篇文章正文内容,下面案例可供参考

一、概述
    

1.1 概念


        MHA(MasterHigh Availability)是一套优秀的MySQL高可用环境下故障切换和主从复制的软件。
        MHA 的出现就是解决MySQL 单点的问题。
        MySQL故障切换过程中,MHA能做到0-30秒内自动完成故障切换操作。
        MHA能在故障切换的过程中最大程度上保证数据的一致性,以达到真正意义上的高可用。


    1.2 组成


        MHA manager
            管理节点
        MHA node
            数据节点
            每个节点上都需要安装


    1.3  特点


        自动故障切换过程中,MHA试图从宕机的主服务器上保存二进制日志,最大程度的保证数据不丢失
        使用半同步复制,可以大大降低数据丢失的风险,如果只有一个slave已经收到了最新的二进制日志,MHA可以将最新的二进制日志应用于其他所有的slave服务器上,因此可以保证所有节点的数据一致性
        目前MHA支持一主多从架构,最少三台服务,即一主两从


  1.4  工作原理


        从宕机崩溃的master 保存二进制日志事件(binlog events);
        识别含有最新的更新slave日志
        应用差异的中继日志(relay log)到其他的slave
        应用从master保存的二进制日志事件
        提升一个slave为新的master
        使其他的slave连接新的master进行复制

二、构建MHA

案例
    192.168.156.3
        manager(MHA)
            mgt
    192.168.156.4
        master
            master
    192.168.156.5
        slave
            slave1
    192.168.156.6
        slave
            slave2

每一台主机上全部安装mariadb 

[root@localhost ~]# yum install -y mariadb mariadb-server
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.huaweicloud.com
 * epel: mirrors.bfsu.edu.cn
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 mariadb.x86_64.1.5.5.68-1.el7 将被 安装
---> 软件包 mariadb-server.x86_64.1.5.5.68-1.el7 将被 安装
--> 正在处理依赖关系 perl-DBD-MySQL,它被软件包 1:mariadb-server-5.5.68-1.el7.x86_64 需要
--> 正在检查事务
---> 软件包 perl-DBD-MySQL.x86_64.0.4.023-6.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

====================================================================================================================================================
 Package                                架构                           版本                                      源                            大小
====================================================================================================================================================
正在安装:
 mariadb                                x86_64                         1:5.5.68-1.el7                            base                         8.8 M
 mariadb-server                         x86_64                         1:5.5.68-1.el7                            base                          11 M
为依赖而安装:
 perl-DBD-MySQL                         x86_64                         4.023-6.el7                               base                         140 k

事务概要
====================================================================================================================================================
安装  2 软件包 (+1 依赖软件包)

总下载量:20 M
安装大小:107 M
Downloading packages:
(1/3): perl-DBD-MySQL-4.023-6.el7.x86_64.rpm                                                                                 | 140 kB  00:00:00     
(2/3): mariadb-server-5.5.68-1.el7.x86_64.rpm                                                                                |  11 MB  00:00:03     
(3/3): mariadb-5.5.68-1.el7.x86_64.rpm                                                                                       | 8.8 MB  00:00:16     
----------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                1.2 MB/s |  20 MB  00:00:16     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : 1:mariadb-5.5.68-1.el7.x86_64                                                                                                   1/3 
  正在安装    : perl-DBD-MySQL-4.023-6.el7.x86_64                                                                                               2/3 
  正在安装    : 1:mariadb-server-5.5.68-1.el7.x86_64                                                                                            3/3 
  验证中      : 1:mariadb-server-5.5.68-1.el7.x86_64                                                                                            1/3 
  验证中      : perl-DBD-MySQL-4.023-6.el7.x86_64                                                                                               2/3 
  验证中      : 1:mariadb-5.5.68-1.el7.x86_64                                                                                                   3/3 

已安装:
  mariadb.x86_64 1:5.5.68-1.el7                                         mariadb-server.x86_64 1:5.5.68-1.el7                                        

作为依赖被安装:
  perl-DBD-MySQL.x86_64 0:4.023-6.el7                                                                                                               

完毕!

每台主机分别改名为mgt  master slave1 slave2

 进入配置文件 /etc/hosts ,添加主机

 将文件 /etc/hosts 分别拷贝给其它三台机子

[root@mgt ~]# scp /etc/hosts 192.168.156.4:/etc/
The authenticity of host '192.168.156.4 (192.168.156.4)' can't be established.
ECDSA key fingerprint is SHA256:UYOTDfnPCXDYRisvqKkyxQEEiuZnt6vtyjxyIwTT10M.
ECDSA key fingerprint is MD5:43:59:03:5c:67:80:66:f1:84:6e:ab:9d:d9:1a:b4:90.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.156.4' (ECDSA) to the list of known hosts.
root@192.168.156.4's password: 
hosts                                                                                                             100%  240    80.2KB/s   00:00    
[root@mgt ~]# scp /etc/hosts 192.168.156.5:/etc/
The authenticity of host '192.168.156.5 (192.168.156.5)' can't be established.
ECDSA key fingerprint is SHA256:UYOTDfnPCXDYRisvqKkyxQEEiuZnt6vtyjxyIwTT10M.
ECDSA key fingerprint is MD5:43:59:03:5c:67:80:66:f1:84:6e:ab:9d:d9:1a:b4:90.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.156.5' (ECDSA) to the list of known hosts.
root@192.168.156.5's password: 
hosts                                                                                                             100%  240    92.0KB/s   00:00    
[root@mgt ~]# scp /etc/hosts 192.168.156.8:/etc/
The authenticity of host '192.168.156.8 (192.168.156.8)' can't be established.
ECDSA key fingerprint is SHA256:UYOTDfnPCXDYRisvqKkyxQEEiuZnt6vtyjxyIwTT10M.
ECDSA key fingerprint is MD5:43:59:03:5c:67:80:66:f1:84:6e:ab:9d:d9:1a:b4:90.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.156.8' (ECDSA) to the list of known hosts.
root@192.168.156.8's password: 
hosts                           

 测试(分别在每一台主机上测试)mgt

[root@mgt ~]# ping master
PING master (192.168.156.4) 56(84) bytes of data.
64 bytes from master (192.168.156.4): icmp_seq=1 ttl=64 time=0.513 ms
64 bytes from master (192.168.156.4): icmp_seq=2 ttl=64 time=0.825 ms
^C
--- master ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1003ms
rtt min/avg/max/mdev = 0.513/0.669/0.825/0.156 ms
[root@mgt ~]# ping slave1
PING slave1 (192.168.156.5) 56(84) bytes of data.
64 bytes from slave1 (192.168.156.5): icmp_seq=1 ttl=64 time=0.659 ms
64 bytes from slave1 (192.168.156.5): icmp_seq=2 ttl=64 time=0.648 ms
^C
--- slave1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.648/0.653/0.659/0.026 ms
[root@mgt ~]# ping slave2
PING slave2 (192.168.156.8) 56(84) bytes of data.
64 bytes from slave2 (192.168.156.8): icmp_seq=1 ttl=64 time=0.532 ms
64 bytes from slave2 (192.168.156.8): icmp_seq=2 ttl=64 time=0.756 ms
^C
--- slave2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.532/0.644/0.756/0.112 ms

master

[root@master ~]# ping mgt
PING mgt (192.168.156.10) 56(84) bytes of data.
64 bytes from mgt (192.168.156.10): icmp_seq=1 ttl=64 time=0.339 ms
64 bytes from mgt (192.168.156.10): icmp_seq=2 ttl=64 time=0.676 ms
^C
--- mgt ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.339/0.507/0.676/0.170 ms
[root@master ~]# ping slave1
PING slave1 (192.168.156.5) 56(84) bytes of data.
64 bytes from slave1 (192.168.156.5): icmp_seq=1 ttl=64 time=0.866 ms
64 bytes from slave1 (192.168.156.5): icmp_seq=2 ttl=64 time=0.451 ms
^C
--- slave1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.451/0.658/0.866/0.209 ms
[root@master ~]# ping slave2
PING slave2 (192.168.156.8) 56(84) bytes of data.
64 bytes from slave2 (192.168.156.8): icmp_seq=1 ttl=64 time=1.00 ms
64 bytes from slave2 (192.168.156.8): icmp_seq=2 ttl=64 time=0.489 ms
^C
--- slave2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 0.489/0.746/1.003/0.257 ms

slave1

[root@slave1 ~]# ping mgt
PING mgt (192.168.156.10) 56(84) bytes of data.
64 bytes from mgt (192.168.156.10): icmp_seq=1 ttl=64 time=0.380 ms
64 bytes from mgt (192.168.156.10): icmp_seq=2 ttl=64 time=0.982 ms
^C
--- mgt ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.380/0.681/0.982/0.301 ms
[root@slave1 ~]# ping master
PING master (192.168.156.4) 56(84) bytes of data.
64 bytes from master (192.168.156.4): icmp_seq=1 ttl=64 time=0.517 ms
64 bytes from master (192.168.156.4): icmp_seq=2 ttl=64 time=0.287 ms
^C
--- master ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.287/0.402/0.517/0.115 ms
[root@slave1 ~]# ping slave2
PING slave2 (192.168.156.8) 56(84) bytes of data.
64 bytes from slave2 (192.168.156.8): icmp_seq=1 ttl=64 time=1.48 ms
64 bytes from slave2 (192.168.156.8): icmp_seq=2 ttl=64 time=0.840 ms
^C
--- slave2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.840/1.163/1.487/0.325 ms

slave2

[root@slave2 ~]# ping mgt
PING mgt (192.168.156.10) 56(84) bytes of data.
64 bytes from mgt (192.168.156.10): icmp_seq=1 ttl=64 time=0.422 ms
64 bytes from mgt (192.168.156.10): icmp_seq=2 ttl=64 time=0.437 ms
64 bytes from mgt (192.168.156.10): icmp_seq=3 ttl=64 time=0.574 ms
64 bytes from mgt (192.168.156.10): icmp_seq=4 ttl=64 time=0.874 ms
64 bytes from mgt (192.168.156.10): icmp_seq=5 ttl=64 time=0.735 ms
^C
--- mgt ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4013ms
rtt min/avg/max/mdev = 0.422/0.608/0.874/0.175 ms
[root@slave2 ~]# ping master
PING master (192.168.156.4) 56(84) bytes of data.
64 bytes from master (192.168.156.4): icmp_seq=1 ttl=64 time=0.682 ms
64 bytes from master (192.168.156.4): icmp_seq=2 ttl=64 time=0.685 ms
64 bytes from master (192.168.156.4): icmp_seq=3 ttl=64 time=0.789 ms
^C
--- master ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2033ms
rtt min/avg/max/mdev = 0.682/0.718/0.789/0.058 ms
[root@slave2 ~]# ping slave1
PING slave1 (192.168.156.5) 56(84) bytes of data.
64 bytes from slave1 (192.168.156.5): icmp_seq=1 ttl=64 time=0.477 ms
64 bytes from slave1 (192.168.156.5): icmp_seq=2 ttl=64 time=0.779 ms
64 bytes from slave1 (192.168.156.5): icmp_seq=3 ttl=64 time=0.654 ms
64 bytes from slave1 (192.168.156.5): icmp_seq=4 ttl=64 time=0.728 ms
64 bytes from slave1 (192.168.156.5): icmp_seq=5 ttl=64 time=0.756 ms
64 bytes from slave1 (192.168.156.5): icmp_seq=6 ttl=64 time=0.904 ms
^C
--- slave1 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5018ms
rtt min/avg/max/mdev = 0.477/0.716/0.904/0.132 ms

2.1 ssh免密登录

  所有节点配置hosts
        192.168.156.3    mgt
        192.168.156.4    master
        192.168.156.5    slave1
        192.168.156.6    slave2
    192.168.156.3
        ssh-keygen
        for i in 4 5 6;do ssh-copy-id root@192.168.156.$i;done
    192.168.156.4
        ssh-keygen
        for i in 3 5 6;do ssh-copy-id root@192.168.156.$i;done
    192.168.156.5
        ssh-keygen
        for i in 4 3 6;do ssh-copy-id root@192.168.156.$i;done
    192.168.156.6
        ssh-keygen
        for i in 4 5 3;do ssh-copy-id root@192.168.156.$i;done
    测试
        for i in 3 4 5;do ssh 192.168.156.$i hostname;done

[root@mgt ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:KKd91Xo5xRM8gTnd4xmNU1Ug+k3bCqu/Dafc5GV711Y root@mgt
The key's randomart image is:
+---[RSA 2048]----+
|            .+o=B|
|           .+o++o|
|          .  .*.+|
|       .   o + B |
|    . o S . + * .|
|     =   . . = oE|
|    . . . . * + =|
|       .   + X o*|
|          ..=.+oo|
+----[SHA256]-----+
[root@mgt ~]# ssh-copy-id mgt
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'mgt (192.168.156.3)' can't be established.
ECDSA key fingerprint is SHA256:UYOTDfnPCXDYRisvqKkyxQEEiuZnt6vtyjxyIwTT10M.
ECDSA key fingerprint is MD5:43:59:03:5c:67:80:66:f1:84:6e:ab:9d:d9:1a:b4:90.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@mgt's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'mgt'"
and check to make sure that only the key(s) you wanted were added.

 验证(分别在每一台机子上验证)

[root@mgt ~]# ssh master
The authenticity of host 'master (192.168.156.4)' can't be established.
ECDSA key fingerprint is SHA256:UYOTDfnPCXDYRisvqKkyxQEEiuZnt6vtyjxyIwTT10M.
ECDSA key fingerprint is MD5:43:59:03:5c:67:80:66:f1:84:6e:ab:9d:d9:1a:b4:90.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'master' (ECDSA) to the list of known hosts.
Last login: Wed Aug 16 02:16:32 2023 from 192.168.156.1
[root@master ~]# exit
登出
Connection to master closed.
[root@mgt ~]# ssh slave1
The authenticity of host 'slave1 (192.168.156.5)' can't be established.
ECDSA key fingerprint is SHA256:UYOTDfnPCXDYRisvqKkyxQEEiuZnt6vtyjxyIwTT10M.
ECDSA key fingerprint is MD5:43:59:03:5c:67:80:66:f1:84:6e:ab:9d:d9:1a:b4:90.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'slave1' (ECDSA) to the list of known hosts.
Last login: Wed Aug 16 02:17:00 2023 from 192.168.156.1
[root@slave1 ~]# exit
登出
Connection to slave1 closed.
[root@mgt ~]# ssh slave2
The authenticity of host 'slave2 (192.168.156.6)' can't be established.
ECDSA key fingerprint is SHA256:UYOTDfnPCXDYRisvqKkyxQEEiuZnt6vtyjxyIwTT10M.
ECDSA key fingerprint is MD5:43:59:03:5c:67:80:66:f1:84:6e:ab:9d:d9:1a:b4:90.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'slave2' (ECDSA) to the list of known hosts.
Last login: Wed Aug 16 02:17:30 2023 from 192.168.156.1
[root@slave2 ~]# exit
登出
Connection to slave2 closed.
[root@mgt ~]# ssh mgt
Last login: Wed Aug 16 02:16:02 2023 from 192.168.156.1
[root@mgt ~]# exit
登出
Connection to mgt closed.

2.2 主从复制

master 

 slave1

 slave2

 启动服务(三台都启动)

 master

查看状态

  slave1

  slave2

  验证

登录master ,在master 上创建库

  登录slave1 查看

  登录slave2 查看

2.3 MHA安装 

2.3.1所有节点安装perl环境

    yum install epel-release -y
    yum -y install perl-DBD-MySQL perl-ExtUtils-MakeMaker perl-Config-Tiny perl-Log-Dispatch perl-Parallel-ForkManager perl-Time-HiRes perl-CPAN

[root@mgt ~]# yum install epel-release -y
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.huaweicloud.com
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 epel-release.noarch.0.7-11 将被 安装
--> 解决依赖关系完成

依赖关系解决

=========================================================================================================================================================================
 Package                                      架构                                   版本                                   源                                      大小
=========================================================================================================================================================================
正在安装:
 epel-release                                 noarch                                 7-11                                   extras                                  15 k

事务概要
=========================================================================================================================================================================
安装  1 软件包

总下载量:15 k
安装大小:24 k
Downloading packages:
epel-release-7-11.noarch.rpm                                                                                                                      |  15 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : epel-release-7-11.noarch                                                                                                                             1/1 
  验证中      : epel-release-7-11.noarch                                                                                                                             1/1 

已安装:
  epel-release.noarch 0:7-11                                                                                                                                             

完毕!
[root@mgt ~]# yum install epel-release -y
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirror-icn.yuki.net.uk
 * extras: mirrors.cqu.edu.cn
 * updates: mirrors.jlu.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 epel-release.noarch.0.7-11 将被 升级
---> 软件包 epel-release.noarch.0.7-14 将被 更新
--> 解决依赖关系完成

依赖关系解决

=========================================================================================================================================================================
 Package                                       架构                                    版本                                  源                                     大小
=========================================================================================================================================================================
正在更新:
 epel-release                                  noarch                                  7-14                                  epel                                   15 k

事务概要
=========================================================================================================================================================================
升级  1 软件包

总下载量:15 k
Downloading packages:
epel/x86_64/prestodelta                                                                                                                           | 1.2 kB  00:00:00     
警告:/var/cache/yum/x86_64/7/epel/packages/epel-release-7-14.noarch.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 352c64e5: NOKEY
epel-release-7-14.noarch.rpm 的公钥尚未安装
epel-release-7-14.noarch.rpm                                                                                                                      |  15 kB  00:00:00     
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 检索密钥
导入 GPG key 0x352C64E5:
 用户ID     : "Fedora EPEL (7) <epel@fedoraproject.org>"
 指纹       : 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 软件包     : epel-release-7-11.noarch (@extras)
 来自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : epel-release-7-14.noarch                                                                                                                             1/2 
  清理        : epel-release-7-11.noarch                                                                                                                             2/2 
  验证中      : epel-release-7-14.noarch                                                                                                                             1/2 
  验证中      : epel-release-7-11.noarch                                                                                                                             2/2 

更新完毕:
  epel-release.noarch 0:7-14                                                                                                                                             

完毕!
[root@mgt ~]# yum -y install perl-DBD-MySQL perl-ExtUtils-MakeMaker perl-Config-Tiny perl-Log-Dispatch perl-Parallel-ForkManager perl-Time-HiRes perl-CPAN
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.bfsu.edu.cn
 * epel: mirrors.bfsu.edu.cn
 * extras: mirrors.bfsu.edu.cn
 * updates: mirrors.bfsu.edu.cn
软件包 perl-DBD-MySQL-4.023-6.el7.x86_64 已安装并且是最新版本
软件包 4:perl-Time-HiRes-1.9725-3.el7.x86_64 已安装并且是最新版本
正在解决依赖关系
--> 正在检查事务
---> 软件包 perl-CPAN.noarch.0.1.9800-299.el7_9 将被 安装
--> 正在处理依赖关系 perl(local::lib),它被软件包 perl-CPAN-1.9800-299.el7_9.noarch 需要
--> 正在处理依赖关系 perl(Digest::SHA),它被软件包 perl-CPAN-1.9800-299.el7_9.noarch 需要
---> 软件包 perl-Config-Tiny.noarch.0.2.14-7.el7 将被 安装
---> 软件包 perl-ExtUtils-MakeMaker.noarch.0.6.68-3.el7 将被 安装
--> 正在处理依赖关系 perl(ExtUtils::Packlist),它被软件包 perl-ExtUtils-MakeMaker-6.68-3.el7.noarch 需要
--> 正在处理依赖关系 perl(ExtUtils::Manifest),它被软件包 perl-ExtUtils-MakeMaker-6.68-3.el7.noarch 需要
--> 正在处理依赖关系 perl(ExtUtils::Installed),它被软件包 perl-ExtUtils-MakeMaker-6.68-3.el7.noarch 需要
--> 正在处理依赖关系 perl(ExtUtils::Install),它被软件包 perl-ExtUtils-MakeMaker-6.68-3.el7.noarch 需要
---> 软件包 perl-Log-Dispatch.noarch.0.2.41-1.el7.1 将被 安装
--> 正在处理依赖关系 perl(Params::Validate) >= 0.15,它被软件包 perl-Log-Dispatch-2.41-1.el7.1.noarch 需要
--> 正在处理依赖关系 perl(Sys::Syslog) >= 0.25,它被软件包 perl-Log-Dispatch-2.41-1.el7.1.noarch 需要
--> 正在处理依赖关系 perl(Class::Load),它被软件包 perl-Log-Dispatch-2.41-1.el7.1.noarch 需要
--> 正在处理依赖关系 perl(MIME::Lite),它被软件包 perl-Log-Dispatch-2.41-1.el7.1.noarch 需要
--> 正在处理依赖关系 perl(Mail::Send),它被软件包 perl-Log-Dispatch-2.41-1.el7.1.noarch 需要
--> 正在处理依赖关系 perl(Mail::Sender),它被软件包 perl-Log-Dispatch-2.41-1.el7.1.noarch 需要
--> 正在处理依赖关系 perl(Mail::Sendmail),它被软件包 perl-Log-Dispatch-2.41-1.el7.1.noarch 需要
--> 正在处理依赖关系 perl(Params::Validate),它被软件包 perl-Log-Dispatch-2.41-1.el7.1.noarch 需要
---> 软件包 perl-Parallel-ForkManager.noarch.0.1.18-2.el7 将被 安装
--> 正在检查事务
---> 软件包 perl-Class-Load.noarch.0.0.20-3.el7 将被 安装
--> 正在处理依赖关系 perl(Package::Stash) >= 0.14,它被软件包 perl-Class-Load-0.20-3.el7.noarch 需要
--> 正在处理依赖关系 perl(Module::Runtime) >= 0.012,它被软件包 perl-Class-Load-0.20-3.el7.noarch 需要
--> 正在处理依赖关系 perl(Module::Implementation) >= 0.04,它被软件包 perl-Class-Load-0.20-3.el7.noarch 需要
--> 正在处理依赖关系 perl(Try::Tiny),它被软件包 perl-Class-Load-0.20-3.el7.noarch 需要
--> 正在处理依赖关系 perl(Module::Runtime),它被软件包 perl-Class-Load-0.20-3.el7.noarch 需要
--> 正在处理依赖关系 perl(Data::OptList),它被软件包 perl-Class-Load-0.20-3.el7.noarch 需要
---> 软件包 perl-Digest-SHA.x86_64.1.5.85-4.el7 将被 安装
--> 正在处理依赖关系 perl(Digest::base),它被软件包 1:perl-Digest-SHA-5.85-4.el7.x86_64 需要
---> 软件包 perl-ExtUtils-Install.noarch.0.1.58-299.el7_9 将被 安装
--> 正在处理依赖关系 perl-devel,它被软件包 perl-ExtUtils-Install-1.58-299.el7_9.noarch 需要
---> 软件包 perl-ExtUtils-Manifest.noarch.0.1.61-244.el7 将被 安装
---> 软件包 perl-MIME-Lite.noarch.0.3.030-1.el7 将被 安装
--> 正在处理依赖关系 perl(MIME::Types) >= 1.28,它被软件包 perl-MIME-Lite-3.030-1.el7.noarch 需要
--> 正在处理依赖关系 perl(Email::Date::Format),它被软件包 perl-MIME-Lite-3.030-1.el7.noarch 需要
---> 软件包 perl-Mail-Sender.noarch.0.0.8.23-1.el7 将被 安装
--> 正在处理依赖关系 perl(IO::Socket::SSL),它被软件包 perl-Mail-Sender-0.8.23-1.el7.noarch 需要
--> 正在处理依赖关系 perl(Net::SSLeay),它被软件包 perl-Mail-Sender-0.8.23-1.el7.noarch 需要
---> 软件包 perl-Mail-Sendmail.noarch.0.0.79-21.el7 将被 安装
---> 软件包 perl-MailTools.noarch.0.2.12-2.el7 将被 安装
--> 正在处理依赖关系 perl(Net::SMTP::SSL),它被软件包 perl-MailTools-2.12-2.el7.noarch 需要
--> 正在处理依赖关系 perl(Date::Parse),它被软件包 perl-MailTools-2.12-2.el7.noarch 需要
--> 正在处理依赖关系 perl(Date::Format),它被软件包 perl-MailTools-2.12-2.el7.noarch 需要
---> 软件包 perl-Params-Validate.x86_64.0.1.08-4.el7 将被 安装
---> 软件包 perl-Sys-Syslog.x86_64.0.0.33-3.el7 将被 安装
---> 软件包 perl-local-lib.noarch.0.1.008010-4.el7 将被 安装
--> 正在检查事务
---> 软件包 perl-Data-OptList.noarch.0.0.107-9.el7 将被 安装
--> 正在处理依赖关系 perl(Sub::Install) >= 0.921,它被软件包 perl-Data-OptList-0.107-9.el7.noarch 需要
--> 正在处理依赖关系 perl(Params::Util),它被软件包 perl-Data-OptList-0.107-9.el7.noarch 需要
---> 软件包 perl-Digest.noarch.0.1.17-245.el7 将被 安装
---> 软件包 perl-Email-Date-Format.noarch.0.1.002-15.el7 将被 安装
---> 软件包 perl-IO-Socket-SSL.noarch.0.1.94-7.el7 将被 安装
--> 正在处理依赖关系 perl(IO::Socket::IP) >= 0.20,它被软件包 perl-IO-Socket-SSL-1.94-7.el7.noarch 需要
--> 正在处理依赖关系 perl(Net::LibIDN),它被软件包 perl-IO-Socket-SSL-1.94-7.el7.noarch 需要
--> 正在处理依赖关系 perl(Mozilla::CA),它被软件包 perl-IO-Socket-SSL-1.94-7.el7.noarch 需要
---> 软件包 perl-MIME-Types.noarch.0.1.38-2.el7 将被 安装
---> 软件包 perl-Module-Implementation.noarch.0.0.06-6.el7 将被 安装
---> 软件包 perl-Module-Runtime.noarch.0.0.013-4.el7 将被 安装
---> 软件包 perl-Net-SMTP-SSL.noarch.0.1.01-13.el7 将被 安装
---> 软件包 perl-Net-SSLeay.x86_64.0.1.55-6.el7 将被 安装
---> 软件包 perl-Package-Stash.noarch.0.0.34-2.el7 将被 安装
--> 正在处理依赖关系 perl(Package::Stash::XS) >= 0.26,它被软件包 perl-Package-Stash-0.34-2.el7.noarch 需要
--> 正在处理依赖关系 perl(Package::DeprecationManager),它被软件包 perl-Package-Stash-0.34-2.el7.noarch 需要
---> 软件包 perl-TimeDate.noarch.1.2.30-2.el7 将被 安装
---> 软件包 perl-Try-Tiny.noarch.0.0.12-2.el7 将被 安装
---> 软件包 perl-devel.x86_64.4.5.16.3-299.el7_9 将被 安装
--> 正在处理依赖关系 systemtap-sdt-devel,它被软件包 4:perl-devel-5.16.3-299.el7_9.x86_64 需要
--> 正在处理依赖关系 perl(ExtUtils::ParseXS),它被软件包 4:perl-devel-5.16.3-299.el7_9.x86_64 需要
--> 正在处理依赖关系 libdb-devel,它被软件包 4:perl-devel-5.16.3-299.el7_9.x86_64 需要
--> 正在处理依赖关系 gdbm-devel,它被软件包 4:perl-devel-5.16.3-299.el7_9.x86_64 需要
--> 正在检查事务
---> 软件包 gdbm-devel.x86_64.0.1.10-8.el7 将被 安装
---> 软件包 libdb-devel.x86_64.0.5.3.21-25.el7 将被 安装
---> 软件包 perl-ExtUtils-ParseXS.noarch.1.3.18-3.el7 将被 安装
---> 软件包 perl-IO-Socket-IP.noarch.0.0.21-5.el7 将被 安装
---> 软件包 perl-Mozilla-CA.noarch.0.20130114-5.el7 将被 安装
---> 软件包 perl-Net-LibIDN.x86_64.0.0.12-15.el7 将被 安装
---> 软件包 perl-Package-DeprecationManager.noarch.0.0.13-7.el7 将被 安装
--> 正在处理依赖关系 perl(List::MoreUtils),它被软件包 perl-Package-DeprecationManager-0.13-7.el7.noarch 需要
---> 软件包 perl-Package-Stash-XS.x86_64.0.0.26-3.el7 将被 安装
---> 软件包 perl-Params-Util.x86_64.0.1.07-6.el7 将被 安装
---> 软件包 perl-Sub-Install.noarch.0.0.926-6.el7 将被 安装
---> 软件包 systemtap-sdt-devel.x86_64.0.4.0-13.el7 将被 安装
--> 正在处理依赖关系 pyparsing,它被软件包 systemtap-sdt-devel-4.0-13.el7.x86_64 需要
--> 正在检查事务
---> 软件包 perl-List-MoreUtils.x86_64.0.0.33-9.el7 将被 安装
---> 软件包 pyparsing.noarch.0.1.5.6-9.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

=========================================================================================================================================================================
 Package                                                 架构                           版本                                       源                               大小
=========================================================================================================================================================================
正在安装:
 perl-CPAN                                               noarch                         1.9800-299.el7_9                           updates                         293 k
 perl-Config-Tiny                                        noarch                         2.14-7.el7                                 base                             25 k
 perl-ExtUtils-MakeMaker                                 noarch                         6.68-3.el7                                 base                            275 k
 perl-Log-Dispatch                                       noarch                         2.41-1.el7.1                               epel                             82 k
 perl-Parallel-ForkManager                               noarch                         1.18-2.el7                                 epel                             28 k
为依赖而安装:
 gdbm-devel                                              x86_64                         1.10-8.el7                                 base                             47 k
 libdb-devel                                             x86_64                         5.3.21-25.el7                              base                             39 k
 perl-Class-Load                                         noarch                         0.20-3.el7                                 base                             27 k
 perl-Data-OptList                                       noarch                         0.107-9.el7                                base                             23 k
 perl-Digest                                             noarch                         1.17-245.el7                               base                             23 k
 perl-Digest-SHA                                         x86_64                         1:5.85-4.el7                               base                             58 k
 perl-Email-Date-Format                                  noarch                         1.002-15.el7                               epel                             17 k
 perl-ExtUtils-Install                                   noarch                         1.58-299.el7_9                             updates                          75 k
 perl-ExtUtils-Manifest                                  noarch                         1.61-244.el7                               base                             31 k
 perl-ExtUtils-ParseXS                                   noarch                         1:3.18-3.el7                               base                             77 k
 perl-IO-Socket-IP                                       noarch                         0.21-5.el7                                 base                             36 k
 perl-IO-Socket-SSL                                      noarch                         1.94-7.el7                                 base                            115 k
 perl-List-MoreUtils                                     x86_64                         0.33-9.el7                                 base                             58 k
 perl-MIME-Lite                                          noarch                         3.030-1.el7                                epel                             96 k
 perl-MIME-Types                                         noarch                         1.38-2.el7                                 epel                             38 k
 perl-Mail-Sender                                        noarch                         0.8.23-1.el7                               epel                             59 k
 perl-Mail-Sendmail                                      noarch                         0.79-21.el7                                epel                             29 k
 perl-MailTools                                          noarch                         2.12-2.el7                                 base                            108 k
 perl-Module-Implementation                              noarch                         0.06-6.el7                                 base                             17 k
 perl-Module-Runtime                                     noarch                         0.013-4.el7                                base                             19 k
 perl-Mozilla-CA                                         noarch                         20130114-5.el7                             base                             11 k
 perl-Net-LibIDN                                         x86_64                         0.12-15.el7                                base                             28 k
 perl-Net-SMTP-SSL                                       noarch                         1.01-13.el7                                base                            9.1 k
 perl-Net-SSLeay                                         x86_64                         1.55-6.el7                                 base                            285 k
 perl-Package-DeprecationManager                         noarch                         0.13-7.el7                                 base                             18 k
 perl-Package-Stash                                      noarch                         0.34-2.el7                                 base                             34 k
 perl-Package-Stash-XS                                   x86_64                         0.26-3.el7                                 base                             31 k
 perl-Params-Util                                        x86_64                         1.07-6.el7                                 base                             38 k
 perl-Params-Validate                                    x86_64                         1.08-4.el7                                 base                             69 k
 perl-Sub-Install                                        noarch                         0.926-6.el7                                base                             21 k
 perl-Sys-Syslog                                         x86_64                         0.33-3.el7                                 base                             42 k
 perl-TimeDate                                           noarch                         1:2.30-2.el7                               base                             52 k
 perl-Try-Tiny                                           noarch                         0.12-2.el7                                 base                             23 k
 perl-devel                                              x86_64                         4:5.16.3-299.el7_9                         updates                         454 k
 perl-local-lib                                          noarch                         1.008010-4.el7                             base                             64 k
 pyparsing                                               noarch                         1.5.6-9.el7                                base                             94 k
 systemtap-sdt-devel                                     x86_64                         4.0-13.el7                                 base                             76 k

事务概要
=========================================================================================================================================================================
安装  5 软件包 (+37 依赖软件包)

总下载量:3.0 M
安装大小:7.5 M
Downloading packages:
(1/42): gdbm-devel-1.10-8.el7.x86_64.rpm                                                                                                          |  47 kB  00:00:00     
(2/42): perl-CPAN-1.9800-299.el7_9.noarch.rpm                                                                                                     | 293 kB  00:00:00     
(3/42): perl-Data-OptList-0.107-9.el7.noarch.rpm                                                                                                  |  23 kB  00:00:00     
(4/42): perl-Digest-SHA-5.85-4.el7.x86_64.rpm                                                                                                     |  58 kB  00:00:00     
(5/42): libdb-devel-5.3.21-25.el7.x86_64.rpm                                                                                                      |  39 kB  00:00:00     
(6/42): perl-Class-Load-0.20-3.el7.noarch.rpm                                                                                                     |  27 kB  00:00:00     
warning: /var/cache/yum/x86_64/7/epel/packages/perl-Email-Date-Format-1.002-15.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
perl-Email-Date-Format-1.002-15.el7.noarch.rpm 的公钥尚未安装
(7/42): perl-Email-Date-Format-1.002-15.el7.noarch.rpm                                                                                            |  17 kB  00:00:00     
(8/42): perl-Config-Tiny-2.14-7.el7.noarch.rpm                                                                                                    |  25 kB  00:00:00     
(9/42): perl-ExtUtils-MakeMaker-6.68-3.el7.noarch.rpm                                                                                             | 275 kB  00:00:00     
(10/42): perl-ExtUtils-Manifest-1.61-244.el7.noarch.rpm                                                                                           |  31 kB  00:00:00     
(11/42): perl-IO-Socket-SSL-1.94-7.el7.noarch.rpm                                                                                                 | 115 kB  00:00:00     
(12/42): perl-IO-Socket-IP-0.21-5.el7.noarch.rpm                                                                                                  |  36 kB  00:00:00     
(13/42): perl-List-MoreUtils-0.33-9.el7.x86_64.rpm                                                                                                |  58 kB  00:00:00     
(14/42): perl-Digest-1.17-245.el7.noarch.rpm                                                                                                      |  23 kB  00:00:00     
(15/42): perl-ExtUtils-Install-1.58-299.el7_9.noarch.rpm                                                                                          |  75 kB  00:00:00     
(16/42): perl-ExtUtils-ParseXS-3.18-3.el7.noarch.rpm                                                                                              |  77 kB  00:00:00     
(17/42): perl-Log-Dispatch-2.41-1.el7.1.noarch.rpm                                                                                                |  82 kB  00:00:00     
(18/42): perl-MIME-Lite-3.030-1.el7.noarch.rpm                                                                                                    |  96 kB  00:00:00     
(19/42): perl-MIME-Types-1.38-2.el7.noarch.rpm                                                                                                    |  38 kB  00:00:00     
(20/42): perl-Mail-Sender-0.8.23-1.el7.noarch.rpm                                                                                                 |  59 kB  00:00:00     
(21/42): perl-Mail-Sendmail-0.79-21.el7.noarch.rpm                                                                                                |  29 kB  00:00:00     
(22/42): perl-Module-Implementation-0.06-6.el7.noarch.rpm                                                                                         |  17 kB  00:00:00     
(23/42): perl-Mozilla-CA-20130114-5.el7.noarch.rpm                                                                                                |  11 kB  00:00:00     
(24/42): perl-Net-SMTP-SSL-1.01-13.el7.noarch.rpm                                                                                                 | 9.1 kB  00:00:00     
(25/42): perl-Net-LibIDN-0.12-15.el7.x86_64.rpm                                                                                                   |  28 kB  00:00:00     
(26/42): perl-Net-SSLeay-1.55-6.el7.x86_64.rpm                                                                                                    | 285 kB  00:00:00     
(27/42): perl-Package-DeprecationManager-0.13-7.el7.noarch.rpm                                                                                    |  18 kB  00:00:00     
(28/42): perl-Parallel-ForkManager-1.18-2.el7.noarch.rpm                                                                                          |  28 kB  00:00:00     
(29/42): perl-Package-Stash-XS-0.26-3.el7.x86_64.rpm                                                                                              |  31 kB  00:00:00     
(30/42): perl-Package-Stash-0.34-2.el7.noarch.rpm                                                                                                 |  34 kB  00:00:00     
(31/42): perl-Params-Util-1.07-6.el7.x86_64.rpm                                                                                                   |  38 kB  00:00:00     
(32/42): perl-Params-Validate-1.08-4.el7.x86_64.rpm                                                                                               |  69 kB  00:00:00     
(33/42): perl-Sys-Syslog-0.33-3.el7.x86_64.rpm                                                                                                    |  42 kB  00:00:00     
(34/42): perl-TimeDate-2.30-2.el7.noarch.rpm                                                                                                      |  52 kB  00:00:00     
(35/42): perl-Try-Tiny-0.12-2.el7.noarch.rpm                                                                                                      |  23 kB  00:00:00     
(36/42): perl-devel-5.16.3-299.el7_9.x86_64.rpm                                                                                                   | 454 kB  00:00:00     
(37/42): perl-local-lib-1.008010-4.el7.noarch.rpm                                                                                                 |  64 kB  00:00:00     
(38/42): perl-Module-Runtime-0.013-4.el7.noarch.rpm                                                                                               |  19 kB  00:00:00     
(39/42): perl-MailTools-2.12-2.el7.noarch.rpm                                                                                                     | 108 kB  00:00:00     
(40/42): systemtap-sdt-devel-4.0-13.el7.x86_64.rpm                                                                                                |  76 kB  00:00:00     
(41/42): pyparsing-1.5.6-9.el7.noarch.rpm                                                                                                         |  94 kB  00:00:00     
(42/42): perl-Sub-Install-0.926-6.el7.noarch.rpm                                                                                                  |  21 kB  00:00:00     
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                     1.4 MB/s | 3.0 MB  00:00:02     
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 检索密钥
导入 GPG key 0x352C64E5:
 用户ID     : "Fedora EPEL (7) <epel@fedoraproject.org>"
 指纹       : 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 软件包     : epel-release-7-11.noarch (@extras)
 来自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : perl-Sub-Install-0.926-6.el7.noarch                                                                                                                 1/42 
  正在安装    : perl-Net-SSLeay-1.55-6.el7.x86_64                                                                                                                   2/42 
  正在安装    : perl-Params-Util-1.07-6.el7.x86_64                                                                                                                  3/42 
  正在安装    : perl-Try-Tiny-0.12-2.el7.noarch                                                                                                                     4/42 
  正在安装    : perl-Module-Runtime-0.013-4.el7.noarch                                                                                                              5/42 
  正在安装    : perl-Module-Implementation-0.06-6.el7.noarch                                                                                                        6/42 
  正在安装    : perl-Params-Validate-1.08-4.el7.x86_64                                                                                                              7/42 
  正在安装    : perl-Data-OptList-0.107-9.el7.noarch                                                                                                                8/42 
  正在安装    : perl-Email-Date-Format-1.002-15.el7.noarch                                                                                                          9/42 
  正在安装    : perl-Digest-1.17-245.el7.noarch                                                                                                                    10/42 
  正在安装    : 1:perl-Digest-SHA-5.85-4.el7.x86_64                                                                                                                11/42 
  正在安装    : perl-Net-LibIDN-0.12-15.el7.x86_64                                                                                                                 12/42 
  正在安装    : 1:perl-TimeDate-2.30-2.el7.noarch                                                                                                                  13/42 
  正在安装    : perl-ExtUtils-Manifest-1.61-244.el7.noarch                                                                                                         14/42 
  正在安装    : perl-Package-Stash-XS-0.26-3.el7.x86_64                                                                                                            15/42 
  正在安装    : perl-IO-Socket-IP-0.21-5.el7.noarch                                                                                                                16/42 
  正在安装    : perl-MIME-Types-1.38-2.el7.noarch                                                                                                                  17/42 
  正在安装    : perl-MIME-Lite-3.030-1.el7.noarch                                                                                                                  18/42 
  正在安装    : perl-Mozilla-CA-20130114-5.el7.noarch                                                                                                              19/42 
  正在安装    : perl-IO-Socket-SSL-1.94-7.el7.noarch                                                                                                               20/42 
  正在安装    : perl-Mail-Sender-0.8.23-1.el7.noarch                                                                                                               21/42 
  正在安装    : perl-Net-SMTP-SSL-1.01-13.el7.noarch                                                                                                               22/42 
  正在安装    : perl-MailTools-2.12-2.el7.noarch                                                                                                                   23/42 
  正在安装    : perl-List-MoreUtils-0.33-9.el7.x86_64                                                                                                              24/42 
  正在安装    : perl-Package-DeprecationManager-0.13-7.el7.noarch                                                                                                  25/42 
  正在安装    : perl-Package-Stash-0.34-2.el7.noarch                                                                                                               26/42 
  正在安装    : perl-Class-Load-0.20-3.el7.noarch                                                                                                                  27/42 
  正在安装    : perl-Sys-Syslog-0.33-3.el7.x86_64                                                                                                                  28/42 
  正在安装    : gdbm-devel-1.10-8.el7.x86_64                                                                                                                       29/42 
  正在安装    : pyparsing-1.5.6-9.el7.noarch                                                                                                                       30/42 
  正在安装    : systemtap-sdt-devel-4.0-13.el7.x86_64                                                                                                              31/42 
  正在安装    : perl-Mail-Sendmail-0.79-21.el7.noarch                                                                                                              32/42 
  正在安装    : libdb-devel-5.3.21-25.el7.x86_64                                                                                                                   33/42 
  正在安装    : perl-ExtUtils-MakeMaker-6.68-3.el7.noarch                                                                                                          34/42 
  正在安装    : perl-ExtUtils-Install-1.58-299.el7_9.noarch                                                                                                        35/42 
  正在安装    : 1:perl-ExtUtils-ParseXS-3.18-3.el7.noarch                                                                                                          36/42 
  正在安装    : 4:perl-devel-5.16.3-299.el7_9.x86_64                                                                                                               37/42 
  正在安装    : perl-local-lib-1.008010-4.el7.noarch                                                                                                               38/42 
  正在安装    : perl-CPAN-1.9800-299.el7_9.noarch                                                                                                                  39/42 
  正在安装    : perl-Log-Dispatch-2.41-1.el7.1.noarch                                                                                                              40/42 
  正在安装    : perl-Config-Tiny-2.14-7.el7.noarch                                                                                                                 41/42 
  正在安装    : perl-Parallel-ForkManager-1.18-2.el7.noarch                                                                                                        42/42 
  验证中      : perl-local-lib-1.008010-4.el7.noarch                                                                                                                1/42 
  验证中      : perl-Module-Runtime-0.013-4.el7.noarch                                                                                                              2/42 
  验证中      : libdb-devel-5.3.21-25.el7.x86_64                                                                                                                    3/42 
  验证中      : perl-Mail-Sendmail-0.79-21.el7.noarch                                                                                                               4/42 
  验证中      : perl-MailTools-2.12-2.el7.noarch                                                                                                                    5/42 
  验证中      : perl-ExtUtils-Install-1.58-299.el7_9.noarch                                                                                                         6/42 
  验证中      : perl-Try-Tiny-0.12-2.el7.noarch                                                                                                                     7/42 
  验证中      : perl-Parallel-ForkManager-1.18-2.el7.noarch                                                                                                         8/42 
  验证中      : 1:perl-ExtUtils-ParseXS-3.18-3.el7.noarch                                                                                                           9/42 
  验证中      : pyparsing-1.5.6-9.el7.noarch                                                                                                                       10/42 
  验证中      : gdbm-devel-1.10-8.el7.x86_64                                                                                                                       11/42 
  验证中      : perl-Mail-Sender-0.8.23-1.el7.noarch                                                                                                               12/42 
  验证中      : perl-ExtUtils-MakeMaker-6.68-3.el7.noarch                                                                                                          13/42 
  验证中      : perl-Config-Tiny-2.14-7.el7.noarch                                                                                                                 14/42 
  验证中      : systemtap-sdt-devel-4.0-13.el7.x86_64                                                                                                              15/42 
  验证中      : perl-Sys-Syslog-0.33-3.el7.x86_64                                                                                                                  16/42 
  验证中      : perl-List-MoreUtils-0.33-9.el7.x86_64                                                                                                              17/42 
  验证中      : perl-IO-Socket-SSL-1.94-7.el7.noarch                                                                                                               18/42 
  验证中      : perl-Mozilla-CA-20130114-5.el7.noarch                                                                                                              19/42 
  验证中      : 4:perl-devel-5.16.3-299.el7_9.x86_64                                                                                                               20/42 
  验证中      : perl-MIME-Types-1.38-2.el7.noarch                                                                                                                  21/42 
  验证中      : perl-Params-Util-1.07-6.el7.x86_64                                                                                                                 22/42 
  验证中      : perl-Package-Stash-0.34-2.el7.noarch                                                                                                               23/42 
  验证中      : perl-IO-Socket-IP-0.21-5.el7.noarch                                                                                                                24/42 
  验证中      : perl-Package-Stash-XS-0.26-3.el7.x86_64                                                                                                            25/42 
  验证中      : perl-MIME-Lite-3.030-1.el7.noarch                                                                                                                  26/42 
  验证中      : perl-Net-SSLeay-1.55-6.el7.x86_64                                                                                                                  27/42 
  验证中      : perl-Params-Validate-1.08-4.el7.x86_64                                                                                                             28/42 
  验证中      : perl-Class-Load-0.20-3.el7.noarch                                                                                                                  29/42 
  验证中      : perl-Log-Dispatch-2.41-1.el7.1.noarch                                                                                                              30/42 
  验证中      : perl-Package-DeprecationManager-0.13-7.el7.noarch                                                                                                  31/42 
  验证中      : perl-ExtUtils-Manifest-1.61-244.el7.noarch                                                                                                         32/42 
  验证中      : perl-Net-SMTP-SSL-1.01-13.el7.noarch                                                                                                               33/42 
  验证中      : perl-Sub-Install-0.926-6.el7.noarch                                                                                                                34/42 
  验证中      : perl-CPAN-1.9800-299.el7_9.noarch                                                                                                                  35/42 
  验证中      : perl-Module-Implementation-0.06-6.el7.noarch                                                                                                       36/42 
  验证中      : 1:perl-TimeDate-2.30-2.el7.noarch                                                                                                                  37/42 
  验证中      : 1:perl-Digest-SHA-5.85-4.el7.x86_64                                                                                                                38/42 
  验证中      : perl-Data-OptList-0.107-9.el7.noarch                                                                                                               39/42 
  验证中      : perl-Net-LibIDN-0.12-15.el7.x86_64                                                                                                                 40/42 
  验证中      : perl-Digest-1.17-245.el7.noarch                                                                                                                    41/42 
  验证中      : perl-Email-Date-Format-1.002-15.el7.noarch                                                                                                         42/42 

已安装:
  perl-CPAN.noarch 0:1.9800-299.el7_9           perl-Config-Tiny.noarch 0:2.14-7.el7 perl-ExtUtils-MakeMaker.noarch 0:6.68-3.el7 perl-Log-Dispatch.noarch 0:2.41-1.el7.1
  perl-Parallel-ForkManager.noarch 0:1.18-2.el7

作为依赖被安装:
  gdbm-devel.x86_64 0:1.10-8.el7                              libdb-devel.x86_64 0:5.3.21-25.el7                    perl-Class-Load.noarch 0:0.20-3.el7                 
  perl-Data-OptList.noarch 0:0.107-9.el7                      perl-Digest.noarch 0:1.17-245.el7                     perl-Digest-SHA.x86_64 1:5.85-4.el7                 
  perl-Email-Date-Format.noarch 0:1.002-15.el7                perl-ExtUtils-Install.noarch 0:1.58-299.el7_9         perl-ExtUtils-Manifest.noarch 0:1.61-244.el7        
  perl-ExtUtils-ParseXS.noarch 1:3.18-3.el7                   perl-IO-Socket-IP.noarch 0:0.21-5.el7                 perl-IO-Socket-SSL.noarch 0:1.94-7.el7              
  perl-List-MoreUtils.x86_64 0:0.33-9.el7                     perl-MIME-Lite.noarch 0:3.030-1.el7                   perl-MIME-Types.noarch 0:1.38-2.el7                 
  perl-Mail-Sender.noarch 0:0.8.23-1.el7                      perl-Mail-Sendmail.noarch 0:0.79-21.el7               perl-MailTools.noarch 0:2.12-2.el7                  
  perl-Module-Implementation.noarch 0:0.06-6.el7              perl-Module-Runtime.noarch 0:0.013-4.el7              perl-Mozilla-CA.noarch 0:20130114-5.el7             
  perl-Net-LibIDN.x86_64 0:0.12-15.el7                        perl-Net-SMTP-SSL.noarch 0:1.01-13.el7                perl-Net-SSLeay.x86_64 0:1.55-6.el7                 
  perl-Package-DeprecationManager.noarch 0:0.13-7.el7         perl-Package-Stash.noarch 0:0.34-2.el7                perl-Package-Stash-XS.x86_64 0:0.26-3.el7           
  perl-Params-Util.x86_64 0:1.07-6.el7                        perl-Params-Validate.x86_64 0:1.08-4.el7              perl-Sub-Install.noarch 0:0.926-6.el7               
  perl-Sys-Syslog.x86_64 0:0.33-3.el7                         perl-TimeDate.noarch 1:2.30-2.el7                     perl-Try-Tiny.noarch 0:0.12-2.el7                   
  perl-devel.x86_64 4:5.16.3-299.el7_9                        perl-local-lib.noarch 0:1.008010-4.el7                pyparsing.noarch 0:1.5.6-9.el7                      
  systemtap-sdt-devel.x86_64 0:4.0-13.el7                    

完毕!

2.3..2 node

所有节点安装node(四台机子都需要)
        tar xf mha4mysql-node-0.57.tar.gz


        cd mha4mysql-node-0.57
        perl Makefile.PL && make && make install

[root@mgt ~]# cd mha4mysql-node-0.57
[root@mgt mha4mysql-node-0.57]# perl Makefile.PL && make && make install
*** Module::AutoInstall version 1.06
*** Checking for Perl dependencies...
[Core Features]
- DBI        ...loaded. (1.627)
- DBD::mysql ...loaded. (4.023)
*** Module::AutoInstall configuration finished.
Checking if your kit is complete...
Looks good
Writing Makefile for mha4mysql::node
cp lib/MHA/BinlogManager.pm blib/lib/MHA/BinlogManager.pm
cp lib/MHA/BinlogPosFindManager.pm blib/lib/MHA/BinlogPosFindManager.pm
cp lib/MHA/BinlogPosFinderXid.pm blib/lib/MHA/BinlogPosFinderXid.pm
cp lib/MHA/BinlogHeaderParser.pm blib/lib/MHA/BinlogHeaderParser.pm
cp lib/MHA/BinlogPosFinder.pm blib/lib/MHA/BinlogPosFinder.pm
cp lib/MHA/NodeUtil.pm blib/lib/MHA/NodeUtil.pm
cp lib/MHA/BinlogPosFinderElp.pm blib/lib/MHA/BinlogPosFinderElp.pm
cp lib/MHA/SlaveUtil.pm blib/lib/MHA/SlaveUtil.pm
cp lib/MHA/NodeConst.pm blib/lib/MHA/NodeConst.pm
cp bin/filter_mysqlbinlog blib/script/filter_mysqlbinlog
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/filter_mysqlbinlog
cp bin/apply_diff_relay_logs blib/script/apply_diff_relay_logs
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/apply_diff_relay_logs
cp bin/purge_relay_logs blib/script/purge_relay_logs
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/purge_relay_logs
cp bin/save_binary_logs blib/script/save_binary_logs
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/save_binary_logs
Manifying blib/man1/filter_mysqlbinlog.1
Manifying blib/man1/apply_diff_relay_logs.1
Manifying blib/man1/purge_relay_logs.1
Manifying blib/man1/save_binary_logs.1
Installing /usr/local/share/perl5/MHA/BinlogManager.pm
Installing /usr/local/share/perl5/MHA/BinlogPosFindManager.pm
Installing /usr/local/share/perl5/MHA/BinlogPosFinderXid.pm
Installing /usr/local/share/perl5/MHA/BinlogHeaderParser.pm
Installing /usr/local/share/perl5/MHA/BinlogPosFinder.pm
Installing /usr/local/share/perl5/MHA/NodeUtil.pm
Installing /usr/local/share/perl5/MHA/BinlogPosFinderElp.pm
Installing /usr/local/share/perl5/MHA/SlaveUtil.pm
Installing /usr/local/share/perl5/MHA/NodeConst.pm
Installing /usr/local/share/man/man1/filter_mysqlbinlog.1
Installing /usr/local/share/man/man1/apply_diff_relay_logs.1
Installing /usr/local/share/man/man1/purge_relay_logs.1
Installing /usr/local/share/man/man1/save_binary_logs.1
Installing /usr/local/bin/filter_mysqlbinlog
Installing /usr/local/bin/apply_diff_relay_logs
Installing /usr/local/bin/purge_relay_logs
Installing /usr/local/bin/save_binary_logs
Appending installation info to /usr/lib64/perl5/perllocal.pod

    验证
        cd /usr/local/bin
        看到脚本就OK

2.3.3 manager (只在mgt上装)

tar xf mha4mysql-manager-0.57.tar.gz
cd /root/mha4mysql-manager-0.57
perl Makefile.PL && make && make install
cp sample/scripts/master_ip_failover /usr/local/bin/
cp sample/scripts/master_ip_online_change     /usr/local/bin/

[root@mgt ~]# cd mha4mysql-manager-0.57
[root@mgt mha4mysql-manager-0.57]# ls
AUTHORS  bin  COPYING  debian  inc  lib  Makefile.PL  MANIFEST  META.yml  README  rpm  samples  t  tests
[root@mgt mha4mysql-manager-0.57]# perl Makefile.PL && make && make install
*** Module::AutoInstall version 1.06
*** Checking for Perl dependencies...
[Core Features]
- DBI                   ...loaded. (1.627)
- DBD::mysql            ...loaded. (4.023)
- Time::HiRes           ...loaded. (1.9725)
- Config::Tiny          ...loaded. (2.14)
- Log::Dispatch         ...loaded. (2.41)
- Parallel::ForkManager ...loaded. (1.18)
- MHA::NodeConst        ...loaded. (0.57)
*** Module::AutoInstall configuration finished.
Checking if your kit is complete...
Looks good
Writing Makefile for mha4mysql::manager
cp lib/MHA/ManagerUtil.pm blib/lib/MHA/ManagerUtil.pm
cp lib/MHA/Config.pm blib/lib/MHA/Config.pm
cp lib/MHA/HealthCheck.pm blib/lib/MHA/HealthCheck.pm
cp lib/MHA/ServerManager.pm blib/lib/MHA/ServerManager.pm
cp lib/MHA/ManagerConst.pm blib/lib/MHA/ManagerConst.pm
cp lib/MHA/ManagerAdmin.pm blib/lib/MHA/ManagerAdmin.pm
cp lib/MHA/FileStatus.pm blib/lib/MHA/FileStatus.pm
cp lib/MHA/MasterFailover.pm blib/lib/MHA/MasterFailover.pm
cp lib/MHA/ManagerAdminWrapper.pm blib/lib/MHA/ManagerAdminWrapper.pm
cp lib/MHA/MasterMonitor.pm blib/lib/MHA/MasterMonitor.pm
cp lib/MHA/MasterRotate.pm blib/lib/MHA/MasterRotate.pm
cp lib/MHA/SSHCheck.pm blib/lib/MHA/SSHCheck.pm
cp lib/MHA/Server.pm blib/lib/MHA/Server.pm
cp lib/MHA/DBHelper.pm blib/lib/MHA/DBHelper.pm
cp bin/masterha_stop blib/script/masterha_stop
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/masterha_stop
cp bin/masterha_conf_host blib/script/masterha_conf_host
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/masterha_conf_host
cp bin/masterha_check_repl blib/script/masterha_check_repl
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/masterha_check_repl
cp bin/masterha_check_status blib/script/masterha_check_status
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/masterha_check_status
cp bin/masterha_master_monitor blib/script/masterha_master_monitor
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/masterha_master_monitor
cp bin/masterha_check_ssh blib/script/masterha_check_ssh
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/masterha_check_ssh
cp bin/masterha_master_switch blib/script/masterha_master_switch
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/masterha_master_switch
cp bin/masterha_secondary_check blib/script/masterha_secondary_check
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/masterha_secondary_check
cp bin/masterha_manager blib/script/masterha_manager
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/masterha_manager
Manifying blib/man1/masterha_stop.1
Manifying blib/man1/masterha_conf_host.1
Manifying blib/man1/masterha_check_repl.1
Manifying blib/man1/masterha_check_status.1
Manifying blib/man1/masterha_master_monitor.1
Manifying blib/man1/masterha_check_ssh.1
Manifying blib/man1/masterha_master_switch.1
Manifying blib/man1/masterha_secondary_check.1
Manifying blib/man1/masterha_manager.1
Installing /usr/local/share/perl5/MHA/ManagerUtil.pm
Installing /usr/local/share/perl5/MHA/Config.pm
Installing /usr/local/share/perl5/MHA/HealthCheck.pm
Installing /usr/local/share/perl5/MHA/ServerManager.pm
Installing /usr/local/share/perl5/MHA/ManagerConst.pm
Installing /usr/local/share/perl5/MHA/ManagerAdmin.pm
Installing /usr/local/share/perl5/MHA/FileStatus.pm
Installing /usr/local/share/perl5/MHA/MasterFailover.pm
Installing /usr/local/share/perl5/MHA/ManagerAdminWrapper.pm
Installing /usr/local/share/perl5/MHA/MasterMonitor.pm
Installing /usr/local/share/perl5/MHA/MasterRotate.pm
Installing /usr/local/share/perl5/MHA/SSHCheck.pm
Installing /usr/local/share/perl5/MHA/Server.pm
Installing /usr/local/share/perl5/MHA/DBHelper.pm
Installing /usr/local/share/man/man1/masterha_stop.1
Installing /usr/local/share/man/man1/masterha_conf_host.1
Installing /usr/local/share/man/man1/masterha_check_repl.1
Installing /usr/local/share/man/man1/masterha_check_status.1
Installing /usr/local/share/man/man1/masterha_master_monitor.1
Installing /usr/local/share/man/man1/masterha_check_ssh.1
Installing /usr/local/share/man/man1/masterha_master_switch.1
Installing /usr/local/share/man/man1/masterha_secondary_check.1
Installing /usr/local/share/man/man1/masterha_manager.1
Installing /usr/local/bin/masterha_stop
Installing /usr/local/bin/masterha_conf_host
Installing /usr/local/bin/masterha_check_repl
Installing /usr/local/bin/masterha_check_status
Installing /usr/local/bin/masterha_master_monitor
Installing /usr/local/bin/masterha_check_ssh
Installing /usr/local/bin/masterha_master_switch
Installing /usr/local/bin/masterha_secondary_check
Installing /usr/local/bin/masterha_manager
Appending installation info to /usr/lib64/perl5/perllocal.pod
[root@mgt mha4mysql-manager-0.57]# ls
AUTHORS  bin  blib  COPYING  debian  inc  lib  Makefile  Makefile.PL  MANIFEST  META.yml  pm_to_blib  README  rpm  samples  t  tests

 脚本说明
    master_ip_failover    自动切换时 VIP 管理的脚本

#!/usr/bin/env perl
use strict;
use warnings FATAL => 'all';

use Getopt::Long;

my (
$command, $ssh_user, $orig_master_host, $orig_master_ip,
$orig_master_port, $new_master_host, $new_master_ip, $new_master_port
);
#############################添加内容部分#########################################
my $vip = '192.168.184.200';								#指定vip的地址
my $brdc = '192.168.184.255';								#指定vip的广播地址
my $ifdev = 'ens33';										#指定vip绑定的网卡
my $key = '1';												#指定vip绑定的虚拟网卡序列号
my $ssh_start_vip = "/sbin/ifconfig ens33:$key $vip";		#代表此变量值为ifconfig ens33:1 192.168.184.200
my $ssh_stop_vip = "/sbin/ifconfig ens33:$key down";		#代表此变量值为ifconfig ens33:1 192.168.184.200 down
my $exit_code = 0;											#指定退出状态码为0
#my $ssh_start_vip = "/usr/sbin/ip addr add $vip/24 brd $brdc dev $ifdev label $ifdev:$key;/usr/sbin/arping -q -A -c 1 -I $ifdev $vip;iptables -F;";
#my $ssh_stop_vip = "/usr/sbin/ip addr del $vip/24 dev $ifdev label $ifdev:$key";
##################################################################################
GetOptions(
'command=s' => \$command,
'ssh_user=s' => \$ssh_user,
'orig_master_host=s' => \$orig_master_host,
'orig_master_ip=s' => \$orig_master_ip,
'orig_master_port=i' => \$orig_master_port,
'new_master_host=s' => \$new_master_host,
'new_master_ip=s' => \$new_master_ip,
'new_master_port=i' => \$new_master_port,
);

exit &main();

sub main {

print "\n\nIN SCRIPT TEST====$ssh_stop_vip==$ssh_start_vip===\n\n";

if ( $command eq "stop" || $command eq "stopssh" ) {

my $exit_code = 1;
eval {
print "Disabling the VIP on old master: $orig_master_host \n";
&stop_vip();
$exit_code = 0;
};
if ($@) {
warn "Got Error: $@\n";
exit $exit_code;
}
exit $exit_code;
}
elsif ( $command eq "start" ) {

my $exit_code = 10;
eval {
print "Enabling the VIP - $vip on the new master - $new_master_host \n";
&start_vip();
$exit_code = 0;
};
if ($@) {
warn $@;
exit $exit_code;
}
exit $exit_code;
}
elsif ( $command eq "status" ) {
print "Checking the Status of the script.. OK \n";
exit 0;
}
else {
&usage();
exit 1;
}
}
sub start_vip() {
`ssh $ssh_user\@$new_master_host \" $ssh_start_vip \"`;
}
## A simple system call that disable the VIP on the old_master
sub stop_vip() {
`ssh $ssh_user\@$orig_master_host \" $ssh_stop_vip \"`;
}

sub usage {
print
"Usage: master_ip_failover --command=start|stop|stopssh|status --orig_master_host=host --orig_master_ip=ip --orig_master_port=port --new_master_host=host --new_master_ip=ip --new_master_port=port\n";
}

    master_ip_online_change    在线切换时 vip 的管理
    power_manager    故障发生后关闭主机的脚本
    send_report    因故障切换后发送报警的脚本

配置文件建立
    mkdir /etc/masterha
    vim /etc/masterha/app1.cnf

[server default]
manager_log=/var/log/masterha/app1/manager.log
manager_workdir=/var/log/masterha/app1
master_binlog_dir=/var/lib/mysql
master_ip_failover_script=/usr/local/bin/master_ip_failover
master_ip_online_change_script=/usr/local/bin/master_ip_online_change
password=123.com
ping_interval=1
remote_workdir=/tmp
repl_password=123.com
repl_user=myslave
secondary_check_script=/usr/local/bin/masterha_secondary_check -s 192.168.156.5 -s 192.168.156.6
shutdown_script=""
ssh_user=root
user=mha

[server1]
hostname=192.168.156.4
port=3306

[server2]
candidate_master=1
check_repl_delay=0
hostname=192.168.156.5
port=3306

[server3]
hostname=192.168.156.6
port=3306

mkdir /var/log/masterha/app1

 测试MHA
    masterha_check_ssh --conf=/etc/masterha/app1.cnf
    masterha_check_repl --conf=/etc/masterha/app1.cnf

[root@mgt ~]# masterha_check_repl --conf=/etc/masterha/app1.cnf
Wed Aug 16 09:33:43 2023 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Wed Aug 16 09:33:43 2023 - [info] Reading application default configuration from /etc/masterha/app1.cnf..
Wed Aug 16 09:33:43 2023 - [info] Reading server configuration from /etc/masterha/app1.cnf..
Wed Aug 16 09:33:43 2023 - [info] MHA::MasterMonitor version 0.57.
Wed Aug 16 09:33:45 2023 - [info] GTID failover mode = 0
Wed Aug 16 09:33:45 2023 - [info] Dead Servers:
Wed Aug 16 09:33:45 2023 - [info] Alive Servers:
Wed Aug 16 09:33:45 2023 - [info]   192.168.156.4(192.168.156.4:3306)
Wed Aug 16 09:33:45 2023 - [info]   192.168.156.5(192.168.156.5:3306)
Wed Aug 16 09:33:45 2023 - [info]   192.168.156.6(192.168.156.6:3306)
Wed Aug 16 09:33:45 2023 - [info] Alive Slaves:
Wed Aug 16 09:33:45 2023 - [info]   192.168.156.5(192.168.156.5:3306)  Version=5.5.68-MariaDB (oldest major version between slaves) log-bin:enabled
Wed Aug 16 09:33:45 2023 - [info]     Replicating from 192.168.156.4(192.168.156.4:3306)
Wed Aug 16 09:33:45 2023 - [info]     Primary candidate for the new Master (candidate_master is set)
Wed Aug 16 09:33:45 2023 - [info]   192.168.156.6(192.168.156.6:3306)  Version=5.5.68-MariaDB (oldest major version between slaves) log-bin:enabled
Wed Aug 16 09:33:45 2023 - [info]     Replicating from 192.168.156.4(192.168.156.4:3306)
Wed Aug 16 09:33:45 2023 - [info] Current Alive Master: 192.168.156.4(192.168.156.4:3306)
Wed Aug 16 09:33:45 2023 - [info] Checking slave configurations..
Wed Aug 16 09:33:45 2023 - [info]  read_only=1 is not set on slave 192.168.156.5(192.168.156.5:3306).
Wed Aug 16 09:33:45 2023 - [warning]  relay_log_purge=0 is not set on slave 192.168.156.5(192.168.156.5:3306).
Wed Aug 16 09:33:45 2023 - [info]  read_only=1 is not set on slave 192.168.156.6(192.168.156.6:3306).
Wed Aug 16 09:33:45 2023 - [warning]  relay_log_purge=0 is not set on slave 192.168.156.6(192.168.156.6:3306).
Wed Aug 16 09:33:45 2023 - [info] Checking replication filtering settings..
Wed Aug 16 09:33:45 2023 - [info]  binlog_do_db= , binlog_ignore_db= 
Wed Aug 16 09:33:45 2023 - [info]  Replication filtering check ok.
Wed Aug 16 09:33:45 2023 - [info] GTID (with auto-pos) is not supported
Wed Aug 16 09:33:45 2023 - [info] Starting SSH connection tests..
Wed Aug 16 09:33:49 2023 - [info] All SSH connection tests passed successfully.
Wed Aug 16 09:33:49 2023 - [info] Checking MHA Node version..
Wed Aug 16 09:33:51 2023 - [info]  Version check ok.
Wed Aug 16 09:33:51 2023 - [info] Checking SSH publickey authentication settings on the current master..
Wed Aug 16 09:33:51 2023 - [info] HealthCheck: SSH to 192.168.156.4 is reachable.
Wed Aug 16 09:33:52 2023 - [info] Master MHA Node version is 0.57.
Wed Aug 16 09:33:52 2023 - [info] Checking recovery script configurations on 192.168.156.4(192.168.156.4:3306)..
Wed Aug 16 09:33:52 2023 - [info]   Executing command: save_binary_logs --command=test --start_pos=4 --binlog_dir=/var/lib/mysql --output_file=/tmp/save_binary_logs_test --manager_version=0.57 --start_file=master-bin.000003 
Wed Aug 16 09:33:52 2023 - [info]   Connecting to root@192.168.156.4(192.168.156.4:22).. 
  Creating /tmp if not exists..    ok.
  Checking output directory is accessible or not..
   ok.
  Binlog found at /var/lib/mysql, up to master-bin.000003
Wed Aug 16 09:33:53 2023 - [info] Binlog setting check done.
Wed Aug 16 09:33:53 2023 - [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers..
Wed Aug 16 09:33:53 2023 - [info]   Executing command : apply_diff_relay_logs --command=test --slave_user='mha' --slave_host=192.168.156.5 --slave_ip=192.168.156.5 --slave_port=3306 --workdir=/tmp --target_version=5.5.68-MariaDB --manager_version=0.57 --relay_log_info=/var/lib/mysql/relay-log.info  --relay_dir=/var/lib/mysql/  --slave_pass=xxx
Wed Aug 16 09:33:53 2023 - [info]   Connecting to root@192.168.156.5(192.168.156.5:22).. 
  Checking slave recovery environment settings..
    Opening /var/lib/mysql/relay-log.info ... ok.
    Relay log found at /var/lib/mysql, up to relay-bin.000002
    Temporary relay log file is /var/lib/mysql/relay-bin.000002
    Testing mysql connection and privileges.. done.
    Testing mysqlbinlog output.. done.
    Cleaning up test file(s).. done.
Wed Aug 16 09:33:54 2023 - [info]   Executing command : apply_diff_relay_logs --command=test --slave_user='mha' --slave_host=192.168.156.6 --slave_ip=192.168.156.6 --slave_port=3306 --workdir=/tmp --target_version=5.5.68-MariaDB --manager_version=0.57 --relay_log_info=/var/lib/mysql/relay-log.info  --relay_dir=/var/lib/mysql/  --slave_pass=xxx
Wed Aug 16 09:33:54 2023 - [info]   Connecting to root@192.168.156.6(192.168.156.6:22).. 
  Checking slave recovery environment settings..
    Opening /var/lib/mysql/relay-log.info ... ok.
    Relay log found at /var/lib/mysql, up to relay-bin.000002
    Temporary relay log file is /var/lib/mysql/relay-bin.000002
    Testing mysql connection and privileges.. done.
    Testing mysqlbinlog output.. done.
    Cleaning up test file(s).. done.
Wed Aug 16 09:33:55 2023 - [info] Slaves settings check done.
Wed Aug 16 09:33:55 2023 - [info] 
192.168.156.4(192.168.156.4:3306) (current master)
 +--192.168.156.5(192.168.156.5:3306)
 +--192.168.156.6(192.168.156.6:3306)

Wed Aug 16 09:33:55 2023 - [info] Checking replication health on 192.168.156.5..
Wed Aug 16 09:33:55 2023 - [info]  ok.
Wed Aug 16 09:33:55 2023 - [info] Checking replication health on 192.168.156.6..
Wed Aug 16 09:33:55 2023 - [info]  ok.
Wed Aug 16 09:33:55 2023 - [info] Checking master_ip_failover_script status:
Wed Aug 16 09:33:55 2023 - [info]   /usr/local/bin/master_ip_failover --command=status --ssh_user=root --orig_master_host=192.168.156.4 --orig_master_ip=192.168.156.4 --orig_master_port=3306 


IN SCRIPT TEST====/sbin/ifconfig ens33:1 down==/sbin/ifconfig ens33:1 192.168.156.100===

Usage: master_ip_failover --command=start|stop|stopssh|status --orig_master_host=host --orig_master_ip=ip --orig_master_port=port --new_master_host=host --new_master_ip=ip --new_master_port=port
Wed Aug 16 09:33:55 2023 - [warning] shutdown_script is not defined.
Wed Aug 16 09:33:55 2023 - [info] Got exit code 0 (Not master dead).

MySQL Replication Health is OK.

启动命令
    nohup masterha_manager --conf=/etc/masterha/app1.cnf --remove_dead_master_conf --ignore_last_failover < /dev/null > /var/log/masterha/app1/manager.log 2>&1 &

 启动时masterIP异常
    需要工程手动配置VIP

2.3.4 测试

  停用master的mariadb服务

 master

 slave1

2.3.5  故障恢复

   修改app1.cnf启动配置
        添加master主机配置信息
    分别在slave上重新指定master主机及binlog日志同步信息


总结

总结来说,MHA是一种简单而有效的高可用解决方案,可以确保MySQL和MariaDB数据库在主节点故障时能够自动切换到可用的从节点上,从而保证数据库的连续性和可用性。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/887009.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

clickhouse-监控配置

一、概述 监控是运维的一大利器&#xff0c;要想运维好clickhouse,首先就要对其进行监控&#xff0c;clickhouse有几种监控数据的方式&#xff0c;一种是系统本身监控&#xff0c;一种是通过exporter来监控&#xff0c;下面分别描述一下 二、系统自带监控 我下面会对监控做一…

github拉取自己的私有仓库(Token方式、本地秘钥方式)

github拉取自己的私有仓库(Token方式、本地秘钥方式) 问题背景 日常开发和学习过程中&#xff0c;经常碰到需要从GitHub或者其他类似网站&#xff0c;拉取私有仓代码的需求。本文将总结常用的两种方式&#xff0c;Token方式和本地秘钥方式&#xff0c;方便后续查阅和优化。 …

C++ 11 新特性 学习笔记

1、字符串原始字面量 R“()”用于取消转义&#xff0c;可用于路径表示 运行成功 这两个RawValue起到描述作用&#xff08;可以不写&#xff09;&#xff0c;并不参与输出 注意&#xff0c;这里输出中文乱码 2、nullptr NULL在C中表示0&#xff0c;在非C中表示万能指针 nullpt…

Ordinals 之后,以太坊铭文协议 Ethscriptions 如何再塑 NFT 资产形态

随着加密市场的发展&#xff0c;NFT 赛道逐渐形成了其独有的市场。但在加密熊市的持续影响下&#xff0c;今年 NFT 赛道的发展充满坎坷与挑战。据 NFTGO 数据显示&#xff0c;截至 8 月 7 日&#xff0c;与去年相比&#xff0c;NFT 市值总计约 56.4 亿美元&#xff0c;过去 1 年…

nginx部署时http接口正常,ws接口404

可以这么配置 map $http_upgrade $connection_upgrade {default upgrade; close; }upstream wsbackend{server ip1:port1;server ip2:port2;keepalive 1000; }server {listen 20038;location /{ proxy_http_version 1.1;proxy_pass http://wsbackend;proxy_redirect off;proxy…

人工智能学习框架—飞桨Paddle人工智能

1.人工智能框架 机器学习的三要素&#xff1a;模型、学习策略、优化算法。 当我们用机器学习来解决一些模式识别任务时&#xff0c;一般的流程包含以下几个步骤&#xff1a; 1.1.浅层学习和深度学习 浅层学习(Shallow Learning)&#xff1a;不涉及特征学习&#xff0c;其特征…

python编程小游戏简单的,利用python编写小游戏

这篇文章主要介绍了python编程小游戏简单的&#xff0c;具有一定借鉴价值&#xff0c;需要的朋友可以参考下。希望大家阅读完这篇文章后大有收获&#xff0c;下面让小编带着大家一起了解一下。 虽然大家老调侃程序员没头发&#xff0c;看起来比实际年龄大。但其实咱们却是非常有…

RabbitMq:Topic exchange(主题交换机)的理解和使用

RabbitMq:Topic exchange(主题交换机)的理解和使用 在RabbitMq中&#xff0c;生产者的消息都是通过交换机来接收&#xff0c;然后再从交换机分发到不同的队列中去&#xff0c;在分发的过程中交换机类型会影响分发的逻辑&#xff0c;下面主要讲解一下主题交换机。 ​ 主题交换…

【制作npm包5】npm包制作完整教程,我的第一个npm包

制作npm包目录 本文是系列文章&#xff0c; 作者一个橙子pro&#xff0c;本系列文章大纲如下。转载或者商业修改必须注明文章出处 一、申请npm账号、个人包和组织包区别 二、了解 package.json 相关配置 三、 了解 tsconfig.json 相关配置 四、 api-extractor 学习 五、npm包…

更多openEuler镜像加入AWS Marketplace!

自2023年7月openEuler 22.03 LTS SP1正式登陆AWS Marketplace后&#xff0c;openEuler社区一直持续于在AWS上提供更多版本。 目前&#xff0c;openEuler22.03 LTS SP1 ,SP2两个版本及 x86 arm64两种架构的四个镜像均可通过AWS对外提供&#xff0c;且在亚太及欧洲15个Region开放…

Flink之Partitioner(分区规则)

Flink之Partitioner(分区规则) 方法注释global()全部发往1个taskbroadcast()广播(前面的文章讲解过,这里不做阐述)forward()上下游并行度一致时一对一发送,和同一个算子连中算子的OneToOne是一回事shuffle()随机分配(只是随机,同Spark的shuffle不同)rebalance()轮询分配,默认机…

排序算法-冒泡排序(C语言实现)

简介&#x1f600; 冒泡排序是一种简单但效率较低的排序算法。它重复地扫描待排序元素列表&#xff0c;比较相邻的两个元素&#xff0c;并将顺序错误的元素交换位置&#xff0c;直到整个列表排序完成。 实现&#x1f9d0; 以下内容为本人原创&#xff0c;经过自己整理得出&am…

Python遍历多个子文件夹并基于文件名特征将文件复制到不同的目标文件夹

本文介绍基于Python语言&#xff0c;遍历一个大文件夹中大量的子文件夹&#xff0c;并将每一个子文件夹中大量的文件&#xff0c;按照每一个文件的文件名称的特点与差异&#xff0c;自动创建多个目标文件夹&#xff0c;并将指定文件复制到不同的目标文件夹中的方法。 首先&…

【云原生】【k8s】Kubernetes+EFK构建日志分析安装部署

目录 EFK安装部署 一、环境准备&#xff08;所有主机&#xff09; 1、主机初始化配置 2、配置主机名并绑定hosts&#xff0c;不同主机名称不同 3、主机配置初始化 4、部署docker环境 二、部署kubernetes集群 1、组件介绍 2、配置阿里云yum源 3、安装kubelet kubeadm …

《零基础7天入门Arduino物联网-05》电路基础知识下

配套视频课程&#xff1a;《零基础学Arduino物联网&#xff0c;入门到进阶》 配套课件资料获取&#xff1a;微联实验室 配套学习套件购买&#xff1a;淘宝搜索店铺【微联实验室】 电阻、电容、电感和二极管 电阻 电阻用于电路中&#xff0c;其主要功能在于控制电流的流动和阻…

开源低代码平台Openblocks

网友 HankMeng 想看低代码工具&#xff0c;正好手上有一个&#xff1b; 什么是 Openblocks &#xff1f; Openblocks 是一个开发人员友好的开源低代码平台&#xff0c;可在几分钟内构建内部应用程序。 传统上&#xff0c;构建内部应用程序需要复杂的前端和后端交互&#xff0c;…

元宇宙展厅:打造新型“人货场”发展趋势

在过去几年&#xff0c;元宇宙的话题被多次提起&#xff0c;随着VR技术的不断发展&#xff0c;元宇宙营销逐步出圈&#xff0c;通过沉浸式、互动式的虚拟环境&#xff0c;为消费者打造更加身临其境的体验。 元宇宙展厅构建新型“人货场”关系&#xff0c;将商品搬进元宇宙空间是…

安卓纯代码布局开发游戏二:Android Studio开发环境搭建

1.Android Studio下载&#xff1a; Download Android Studio & App Tools - Android Developers 2.安装 安装过程非常简单&#xff0c;找到下载包&#xff0c;一直点Next即可。 3.下载Android SDK 第一次进入Android Studio默认会先下载Android SDK,笔者下载的Android SDK存…

SpringBoot集成KoTime

koTime是一个开源免费的springboot项目性能分析工具&#xff0c;通过追踪方法调用链路以及对应的运行时长快速定位性能瓶颈&#xff0c;除此之外&#xff0c;代码热更新、异常检测都可以有&#xff01; 一.添加KoTime依赖&#xff1a; <dependency><groupId>cn.l…

【深度学习--RNN 循环神经网络--附LSTM情感文本分类】

deep learning 系列 --RNN 循环神经网络 什么是序列模型 包括了RNN LSTM GRU等网络模型&#xff0c;主要用途是自然语言处理、语音识别等方面&#xff0c;比如生成乐曲&#xff0c;音频转换为文字&#xff0c;文本情感分类&#xff0c;机器翻译等等 标准模型的缺陷 以往的标…