mysql (MHA)集群安装

Posted Json2011315

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql (MHA)集群安装相关的知识,希望对你有一定的参考价值。

1. MHA工作原理

  1. 保存宕机的master日志(通过mha-node工具保存)
  2. 在slave节点中识别复制量偏移量最大的slave
  3. 将识别到复制量最大的slave日志复制到其余的slave节点
  4. 将宕机master的binlog复制到将要升级为master的slave节点
  5. 提升slave升级为master,ip切换 (虚拟原宕机的虚拟ip,漂移到新的master)
  6. 将其它slave的master指向新的master


说明:
1.mha-manager 心跳检测官和总指挥官
2.mha-node 节点工具
3.ip-script perl脚本,主要执行 虚拟ip的添加与删除(虚拟ip漂移)

demo节点:

ip安装工具
192.168.169.120(master)mha-node,mysql,mha-manager(生产环境独立部署)
192.168.169.200(slave)mha-node,mysql
192.168.169.203(slave)mha-node,mysql

工具下载地址:
链接:https://pan.baidu.com/s/1KtiHtDumqnIupnBAq0a7Ag
提取码:p0ii

2.秘钥互信

作用:ssh远程登录

2.1 每一个节点(服务器)都得执行:

[root@localhost ~]# cd ~
[root@localhost ~]# ssh-keygen -t rsa #看到提示不用管,一路回车就是 
[root@localhost ~]# cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[root@localhost ~]# chmod 600 ~/.ssh/authorized_keys

只要在一个节点执行即可。这里在 192.168.169.120上执行【复制到其余的节点,如果是首次复制可能需要输入复制的节点密码,选择yes,输入密码就ok】

[root@localhost ~]# ssh 192.168.169.203 cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
[root@localhost ~]# ssh 192.168.169.204 cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys

分发整合后的文件到发送其它节点

[root@localhost ~]# scp ~/.ssh/authorized_keys 192.168.169.203:~/.ssh/ 
[root@localhost ~]# scp ~/.ssh/authorized_keys 192.168.232.204:~/.ssh/ 

2.2 在节点上操作是否能免密登录其它节点:

Demo:ssh root@ip
使用ip addr|grep 169 查询ip地址,证明已经登录到其余的节点服务器上

3.安装基础包

在所有服务器上执行:

[root@localhost ~]# yum install -y perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker perl-CPAN perl-DBD-MySQL perl-Config-Tiny perl-Log-Dispatch perl-Parallel- ForkManager perl-Time-HiRes

安装过程提示有问题(安装不了):
No package perl-Log-Dispatch available.
No package perl-Parallel-ForkManager available.
![在这里插入图片描述](https://img-blog.csdnimg.cn/20200925135033768.png#pic_center
解决方法:
地址:https://blog.csdn.net/aeolus_pu/article/details/8991652
地址:https://fedoraproject.org/wiki/EPEL

执行:
[root@localhost mha]# yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
安装好之后,重新执行依赖包安装
[root@localhost mha]# yum install -y perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker perl-CPAN perl-DBD-MySQL perl-Config-Tiny perl-Log-Dispatch perl-Parallel-ForkManager perl-Time-HiRes

4.安装 MHA Node组件(所有节点都需要安装)

4.1 安装插件

插件
mha4mysql-node-0.58.tar.gz安装在所有的节点上
mha4mysql-manager-0.58.tar.gz正式环境最好独立一台服务器安装部署,manager 是mha的心跳检测官和总指挥官

4.2 创建目录下载mha4mysql-node【所有节点操作以下命令】

[root@localhost ~]# mkdir -p /usr/local/src/mha
[root@localhost ~]# cd /usr/local/src/mha
[root@localhost mha]# pwd
/usr/local/src/mha

[root@localhost mha]# ls
mha4mysql-node-v0.58.tar.gz 
mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz 
mha4mysql-manager-0.58.tar.gz

Mysql-node组件在一台服务器下载,可以使用scp复制到其它服务器
[root@localhost mha_mysql]# scp mha4mysql-node-0.58.tar.gz root@192.168.169.203:/usr/local/src/mha/ 
[root@localhost mha_mysql]# scp mha4mysql-node-0.58.tar.gz root@192.168.169.204:/usr/local/src/mha/


解压安装(在所有机器上执行):

[root@localhost mha]# tar -zxvf mha4mysql-node-v0.58.tar.gz 
[root@localhost mha]# ls
mha4mysql-node-0.58  mha4mysql-node-v0.58.tar.gz
[root@localhost mha]# cd mha4mysql-node-0.58/
【编译】
[root@localhost mha4mysql-node-0.58]# perl Makefile.PL 
【安装】
[root@localhost mha]# make && make install

复制到其余的服务器执行(重复以上的解压安装)

[root@localhost mha]# scp mha4mysql-node-0.58.tar.gz root@192.168.169.203:/usr/local/src/mha/
mha4mysql-node-0.58.tar.gz                                                                                       100%   55KB  29.8MB/s   00:00    
[root@localhost mha]# scp mha4mysql-node-0.58.tar.gz root@192.168.169.204:/usr/local/src/mha/
mha4mysql-node-0.58.tar.gz  


4.3 node工具包作用

工具包说明
save_binary_logs保存和复制master的二进制日志
apply_diff_relay_logs识别差异的中继日志事件并将其差异的事件应用于其他的slave
filter_mysqlbinlog去除不必要的ROLLBACK事件(MHA已不再使用这个工具)
purge_relay_logs清除中继日志(不会阻塞SQL线程)

5.安装manager组件

【manager 是mha的心跳检测官和总指挥官】
(目前该指挥官只下载在192.168.169.120服务器上,正式环境需要独立服务器安装)

5.1 安装插件

[root@localhost mha]# ls
mha4mysql-manager-v0.58.tar.gz 
[root@localhost mha]# tar -zxvf mha4mysql-manager-0.58.tar.gz 
[root@localhost mha]# ls
mha4mysql-manager-0.58  mha4mysql-manager-0.58.tar.gz  mha4mysql-node-0.58  mha4mysql-node-0.58.tar.gz
[root@localhost mha]# cd mha4mysql-manager-0.58
【编译】
[root@localhost mha4mysql-manager-0.58]# perl Makefile.PL 
【安装】
[root@localhost mha4mysql-manager-0.58]# make && make install

5.2 MHA各工具包作用

工具包说明
masterha_check_repl检查MySQL复制状况
masterha_check_ssh检查MHA的SSH配置状况
masterha_check_status检测当前MHA运行状态
masterha_conf_host添加或删除配置的server信息
masterha_manager开启MHA Manager监控
masterha_master_monitor检查master是否宕机
masterha_master_switch控制故障转移(自动或手动)
masterha_secondary_check二次检查
masterha_stop关闭MHA Manager监控

6.安装MySQL 【搭建主从】

6.1.安装搭建(所有节点执行安装mysql)

[root@localhost mha]# tar -zxvf mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
[root@localhost mha]# useradd -s /sbin/nologin -M mysql
[root@localhost mha]# mv mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz mysql-5.7
[root@localhost mha]# ln -s /usr/local/src/mha/mysql-5.7 /usr/local/mysql-5.7 
[root@localhost mha]# ln -s /usr/local/src/mha/mysql-5.7 /usr/local/mysql 
[root@localhost mha]# echo 'export PATH=$PATH:/usr/local/mysql-5.7/bin' >> /etc/profile 
[root@localhost mha]# source /etc/profile
[root@localhost mha]# mysql -V
mysql  Ver 14.14 Distrib 5.7.21, for linux-glibc2.12 (x86_64) using  EditLine wrapper

[root@localhost mha]# cd /usr/local/mysql-5.7 
[root@localhost mysql-5.7]# cp support-files/mysql.server /etc/init.d/mysqld 
[root@localhost mysql-5.7]#  sed -i 's@/etc/my.cnf@/usr/local/mysql-5.7/my.cnf@g' /etc/init.d/mysqld 
[root@localhost mysql-5.7]#  sed -i 's@/usr/local/mysql/data@/opt/mysql_data@g' /etc/init.d/mysqld 
[root@localhost mysql-5.7]#  chkconfig mysqld on  #加入开机启动
[root@localhost mysql-5.7]#  mkdir -p /opt/mysql_data 
[root@localhost mysql-5.7]#  chown -R mysql.mysql /usr/local/src/mha/mysql-5.7 
[root@localhost mysql-5.7]#  chown -R mysql.mysql /opt/mysql_data 
[root@localhost mysql-5.7]#  ln -s /usr/local/src/mha/mysql-5.7/bin/mysqlbinlog /usr/local/bin/mysqlbinlog 
[root@localhost mysql-5.7]#  ln -s /usr/local/src/mha/mysql-5.7/bin/mysql /usr/local/bin/mysql

6.2 建立一主二从

192.168.169.120: 主库
192.168.169.203: 从库1
192.168.169.204: 从库2

6.3 主库my.cnf文件配置

[root@localhost mysql-5.7]# vim /etc/my.cnf

[mysql]
default-character-set=utf8
socket = /tmp/mysql.sock

[mysqld]
character-set-server=utf8
basedir=/usr/local/mysql-5.7
datadir=/opt/mysql_data
socket=/tmp/mysql.sock
port=3306
pid-file=/opt/mysql_data/mysqld.pid
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

#server-id的值不能重复,否则主从会建立失败
server-id=101
log-bin=master-bin
relay-log-index=slave-relay-bin.index
relay-log=slave-relay-bin
binlog_format = MIXED
sync_binlog = 1
expire_logs_days =7
#二进制日志自动删除/过期的天数。默认值为0,表示不自动删除。

log_slave_updates = 1
#配置主从的数据库test
binlog-do-db = test
binlog-ignore-db = mysql,performance_schema,sys,information_schema
replicate-do-db=test
replicate-ignore-db=mysql,performance_schema,sys,information_schema
#错误日志路径
#log-error=/usr/local/mysql-5.7/log/mysqld.log

[mysqld_safe]
#log-error=/var/log/mariadb/mariadb.log
#pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

6.4 从库my.cnf文件配置

[root@localhost mysql-5.7]# vim /etc/my.cnf

[mysql]
default-character-set=utf8
socket = /tmp/mysql.sock

[mysqld]
datadir=/tmp/mysql
character-set-server=utf8
basedir=/usr/local/mysql-5.7
datadir=/opt/mysql_data
pid-file=/opt/mysql_data/mysqld.pid

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

#server-id的值不能重复,否则主从会建立失败
server-id=203
log-bin=master-bin
relay-log-index=slave-relay-bin.index
relay-log=slave-relay-bin
binlog_format = MIXED
sync_binlog = 1
expire_logs_days =7 #二进制日志自动删除/过期的天数。默认值为0,表示不自动删除。

log_slave_updates = 1
#主从数据库test
binlog-do-db = test
binlog-ignore-db = mysql,performance_schema,sys,information_schema
replicate-do-db=test
replicate-ignore-db=mysql,performance_schema,sys,information_schema

#错误日志路径
#log-error=/usr/local/mysql-5.7/log/mysqld.log

[mysqld_safe]
#log-error=/var/log/mariadb/mariadb.log
#pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

6.5 MySQL安装操作(所有服务器执行)

[root@localhost mysql-5.7]# mysqld --initialize --user=mysql --basedir=/usr/local/mysql-5.7 --datadir=/opt/mysql_data 

如果开启了日志,日志中查看生成的密码:
[root@localhost ~]#  less /usr/local/mysql-5.7/log/mysqld.log

6.6 启动mysql

启动mysql:
[root@localhost mysql-5.7]# ./support-files/mysql.server start   
关闭: ./support-files/mysql.serve stop
重启 ./support-files/mysql.serve restart


或者:
[root@localhost mysql-5.7]# systemctl start mysqld
关闭: systemctl stop mysqld
重启systemctl restart mysqld

6.7 登录mysql.执行修改root的登录密码

修密码:
mysql> set password=password('123456');
Query OK, 0 rows affected, 1 warning (0.00 sec)

刷新权限
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

修改root用户登录限制,让所有ip都能登录
mysql> grant all privileges on *.* to root@'%' identified by '123456';
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

外网连接不了MySQL:https://blog.csdn.net/yinjinshui/article/details/101376544

6.8 所有 MySQL服务器执行,创建主从复制用户的操作

mysql> grant replication client,replication slave on *.* to 'slave_user'@'%' identified by '123456';
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> reset master;
Query OK, 0 rows affected (0.01 sec)

mysql> show master logs;
+-------------------+-----------+
| Log_name          | File_size |
+-------------------+-----------+
| master-bin.000001 |       154 |
+-------------------+-----------+
1 row in set (0.00 sec)

6.9 所有从库执行分配复制用户操作

mysql> change master to master_host='192.168.169.120',master_user='slave_user',master_password='123456',master_log_file='master-bin.000001',master_log_pos=154;

Query OK, 0 rows affected, 2 warnings (0.01 sec)


6.10 开启主从复制

主从复制命令

命令说明
start slave开启
stop slave关闭
restart slave重启
reset slave all清除主从复制
show slave status 或 show slave status\\G查看主从复制状态


6.11 连接master测试(192.169.169.120)
(master:120)

(slave:203|204)

7 MHA构建(manager操作配置)【以下操作在manager节点操作192.168.169.120】

这里演示的vip 是: 192.168.169.10(虚拟ip) 大家根据自己的情况,做出对应的修改。
MHA Manager 配置,在192.168.169.120上执行(正式环境在对应的manager服务器执行):

7.1创建对应的目录与文件

[root@localhost mha4mysql-manager-0.58]# pwd
/usr/local/src/mha/mha4mysql-manager-0.58

#创建MHA配置文件目录
[root@localhost mha4mysql-manager-0.58]# mkdir /etc/mha/scripts
#创建MHA日志目录
[root@localhost mha4mysql-manager-0.58]# mkdir /var/log/mha/ 
#创建日志目录 
[root@localhost mha4mysql-manager-0.58]# mkdir /var/log/mha/app1 -p 
#创建日志文件 
[root@localhost mha4mysql-manager-0.58]# touch /var/log/mha/app1/manager.log

7.2 MHA 配置文件

配置文件 app1.cnf :

[root@localhost mha4mysql-manager-0.58]# vim /etc/mha/app1.cnf 

[server default]
manager_log=/var/log/masterha/app1/manager.log
manager_workdir=/var/log/masterha/app1

[server1]
hostname=192.168.169.120
port=3306

[server2]
hostname=192.168.169.203
port=3306
candidate_master=1

[server3]
hostname=192.168.169.204
port=3306

【上面这个配置主要是一个mysql主从的名单。
candidate_master=1的意思是是否能提升为master。【此配置可以不填写,让manager自行判断】】

配置文件 masterha_default.cnf :

[root@localhost mha4mysql-manager-0.58]# vim /etc/masterha_default.cnf

[server default]
user=root 
password=123456

repl_user=slave_user
repl_password=123456

ssh_user=root
ping_interval=1

master_binlog_dir=/opt/mysql_data
manager_workdir=/var/log/mha/app1
manager_log=/var/log/mha/manager.log
master_ip_failover_script="/etc/mha/scripts/master_ip_failover"
master_ip_online_change_script="/etc/mha/scripts/master_ip_online_change"
report_script="/etc/mha/scripts/send_report"
remote_workdir=/tmp
secondary_check_script= /usr/local/bin/masterha_secondary_check -s 192.168.169.120 -s 192.168.169.203 -s 192.168.169.204
shutdown_script=""

【#注释请去掉,避免报错】

MHA主要配置文件说明

参数说明
manager_workdir=/var/log/masterha/app1设置manager的工作目录
manager_log=/var/log/masterha/app1/manager.log设置manager的日志文件
master_binlog_dir=/opt/mysql_data设置master 保存binlog的位置,以便MHA可以找到master的日志
master_ip_failover_script="/etc/mha/scripts/master_ip_failover"设置自动failover时候的切换脚本
master_ip_online_change_script="/etc/mha/scripts/master_ip_online_change"设置手动切换时候的切换脚本
user=root设置监控mysql的用户
password=dayi123设置监控mysql的用户,需要授权能够在manager节点远程登录
ping_interval=1设置监控主库,发送ping包的时间间隔,默认是3秒,尝试三次没有回应的时候自动进行railover
remote_workdir=/tmp设置远端mysql在发生切换时binlog的保存位置
repl_user=repl设置mysql中用于复制的用户
repl_password=replication设置mysql中用于复制的用户密码
report_script=/usr/local/send_report设置发生切换后发送的报警的脚本
shutdown_script=""设置故障发生后关闭故障主机脚本(该脚本的主要作用是关闭主机放在发生脑裂,这里没有使用)
ssh_user=root/设置ssh的登录用户名
candidate_master=1在节点下设置,设置当前节点为候选的master
slave check_repl_delay=0在节点配置下设置,默认情况下如果一个slave落后master 100M的relay logs的话,MHA将不会选择该slave作为一个新 的master;这个选项对于对于设置了candidate_master=1的主机非常有用

7.3 ip_script 虚拟ip添加,删除 脚本配置(ip 漂移的perl脚本)

[root@localhost mha4mysql-manager-0.58]# vim /etc/mha/scripts/master_ip_failover

#!/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.169.10';
my $key = '0';
my $ssh_start_vip = "ifconfig ens33:0 192.168.169.10 netmask 255.255.255.0 up";
my $ssh_stop_vip = "/sbin/ifconfig ens33:$key down";

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 \\"`;

sub stop_vip() 
     return 0  unless  ($ssh_user);
    `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";

7.4 最后给以上的三个脚本添加执行权限

[root@localhost mha4mysql-manager-0.58]# chmod +x /etc/mha/scripts/master_ip_failover
[root@localhost mha4mysql-manager-0.58]# chmod +x /etc/mha/app1.cnf 
[root@localhost mha4mysql-manager-0.58]# chmod +x /etc/masterha_default.cnf

7.5 验证MHA相关操作

7.5.1通过 masterha_check_ssh 命令验证ssh 信任登录是否成功

[root@localhost mha4mysql-manager-0.58]# masterha_check_ssh --conf=/etc/mha/app1.cnf

All SSH connection tests passed successfully.
表示验证成功

7.5.2 通过 masterha_check_repl 命令验证 mysql 主从复制是否成功

[root@localhost mha4mysql-manager-0.58]# masterha_check_repl --conf=/etc/mha/app1.cnf 

# 最后出现以下提示,则表示通过 MySQL Replication Health is OK.

7.6 在master主机节点添加虚拟ip(vip) 【192.168.169.120】

[root@localhost mha4mysql-manager-0.58]# ifconfig ens33:0 192.168.169.10netmask 255.255.255.0 up

查看虚拟ip:

[root@localhost  mha4mysql-manager-0.58]# ip addr|grep 169
    inet 192.168.169.128/24 brd 192.168.169.255 scope global noprefixroute dynamic ens33
    inet 192.168.169.120/24 brd 192.168.169.255 scope global secondary noprefixroute ens33
    inet 192.168.169.10/24 brd 192.168.169.255 scope global secondary ens33:0

7.7 启动manager, 这一步在manager上操作

[root@localhost mha4mysql-manager-0.58]# nohup masterha_manager --conf=/etc/mha/app1.cnf --remove_dead_master_conf --ignore_last_failover < /dev/null > /var/log/mha/app1/manager.log 2>&1 &


检查 MHA 状态

[root@localhost mha4mysql-manager-0.58]#  masterha_check_status --conf=/etc/mha/app1.cnf

MHA 的日志保存在/var/log/masterha/app1/manager.log 下

[root@localhost mha4mysql-manager-0.58]# tail -f /var/log/mha/app1/manager.log 


关闭MHA命令(不需要执行)

masterha_stop --conf=/etc/mha/app1.cnf

8. 模拟master宕机

8.1手动关闭master的mysql(192.168.169.120)

[root@localhost mysql-5.7]# systemctl stop mysqld

8.2 在192.168.169.204或203查看虚拟ip

#(192.168.169.204节点查看)
[root@localhost mha]# ip addr|grep 169
    inet 192.168.169.134/24 brd 192.168.169.255 scope global noprefixroute dynamic ens33
    inet 192.168.169.204/24 brd 192.168.169.255 scope global secondary noprefixroute ens33


#(192.168.169.203节点查看,查看到虚拟ip192.168.169.10,此时该节点边城master)
[root@localhost mysql-5.7]# ip addr|grep 169
	  inet 192.168.169.135/24 brd 192.168.169.255 scope global noprefixroute dynamic ens33
	  inet 192.168.169.203/24 brd 192.168.169.255 scope global secondary noprefixroute ens33
	   net 192.168.169.10/24 brd 192.168.169.255 scope global secondary ens33:0

8.3 在192.168.169.204查看主从复制状态

查看到master变成了102.168.196.203


因为120宕机了,所以203被提升为新的master

8.35 以下是补充信息

1.如何提升slave为新的master ,复制偏移量最大的可提升为新的maser.
2.通过复制日志偏移量判断哪个slave的日志需要复制到其它的slave;
3.主master宕机之后,通过mha-node,把主的bin-log日志复制到slave(此slave为将要晋升为master的节点)
4.主master宕机之后,mha-manager会停止执行,需要手动介入重新启动
5.主master宕机之后, /etc/mha/app1.cnf 对应原的master server会从配置文件中被清除
6.宕机的120节点,如果需要加入集群,需要手动操作

以上是关于mysql (MHA)集群安装的主要内容,如果未能解决你的问题,请参考以下文章

mysql MHA集群安装

Mysql 高可用集群 ------ MHA

MHA高可用集群

mysql (MHA)集群安装

mysql MHA集群的搭建

MySQL之 MHA 高可用集群部署