注意:mha-manager暂时不支持centos8版本,避免踩坑
注意:mha-manager暂时不支持centos8版本,避免踩坑
注意:mha-manager暂时不支持centos8版本,避免踩坑
1、准备4台服务器,3台安装mysql,并且1主2从
2、四台服务器设置免密登录
- 在四台服务器都执行以下命令
ssh-keygen -t rsa
- 在3台安装了mysql服务的机器上都执行以下命令,将公钥拷贝到mha-manager服务器
ssh-copy-id 192.168.220.131
- 在mha-manager服务器执行以下命令查看公钥
cat /root/.ssh/authorized_keys
- 将mha-manager机器的公钥也拷贝到之前的文件
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
5) 从mha-manager的机器执行以下命令将公钥拷贝到其他三台机器
scp /root/.ssh/authorized_keys root@192.168.220.128:/root/.ssh/authorized_keys
scp /root/.ssh/authorized_keys root@192.168.220.129:/root/.ssh/authorized_keys
scp /root/.ssh/authorized_keys root@192.168.220.130:/root/.ssh/authorized_keys
6) 在mha-manager机器执行以下命令查看是否与其他三台服务器互通
ssh 192.168.220.128
exit
ssh 192.168.220.129
exit
ssh 192.168.220.130
exit
3、安装mha
mha-manager(mha-manager的机器):
https://github.com/yoshinorim/mha4mysql-manager/releases/tag/v0.58mha-node(3台mysql的机器):
https://github.com/yoshinorim/mha4mysql-node/releases/tag/v0.58
- 在四台服务器安装mha-node
yum install perl-DBD-MySQL -y
wget https://github.com/yoshinorim/mha4mysql-node/releases/download/v0.58/mha4mysql-node-0.58-0.el7.centos.noarch.rpm
rpm -ivh mha4mysql-node-0.58-0.el7.centos.noarch.rpm
- 在mha-manager机器安装mha-manager
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -ivh epel-release-latest-7.noarch.rpm
yum install perl-DBD-MySQL perl-Config-Tiny perl-Log-Dispatch perl-Parallel-ForkManager -y
wget https://github.com/yoshinorim/mha4mysql-manager/releases/download/v0.58/mha4mysql-manager-0.58-0.el7.centos.noarch.rpm
rpm -ivh mha4mysql-manager-0.58-0.el7.centos.noarch.rpm