MHA的安装搭建步骤

MHA的安装搭建步骤,第1张

安装基本环境:

master:192.168.0.1

node:192.168.0.2192.168.0.3

vip:192.168.0.101

master: https://github.com/yoshinorim/mha4mysql-manager/releases

node: https://github.com/yoshinorim/mha4mysql-node/releases

安装epel源

yum install -y epel-release

安装perl

yum install perl-DBD-MySQL

yum install perl-Config-Tiny

yum install perl-Log-Dispatch

yum install perl-Parallel-ForkManager

master 192.168.0.1 >>slave:192.168.0.2 192.168.0.3

创建mha账号

在manager节点和node节点中锋顷毕银芹都需要安装mha node

rpm包安装方式:

yum localinstall -y mha4mysql-node-0.58-0.el7.centos.noarch.rpm

只在manager节点上安装

rpm包安装方式:

yum localinstall -y mha4mysql-manager-0.58-0.el7.centos.noarch.rpm

mkdir /etc/masterha

vim /etc/masterha/app1.conf

全局配置文件

vim /etc/masterha/masterha_defaults.conf

绑定和删除vip节点

master_ip_failover: https://github.com/yoshinorim/mha4mysql-manager/blob/master/samples/scripts/master_ip_failover

master_ip_online_change: https://github.com/yoshinorim/mha4mysql-manager/blob/master/samples/scripts/master_ip_online_change

根据作者的脚本来进行改写配置。

报错

[/usr/local/share/perl5/MHA/MasterMonitor.pm,ln205] Slaves settings check failed!

[/usr/local/share/perl5/MHA/MasterMonitor.pm,ln413] Slave configuration failed.

[/usr/local/share/perl5/MHA/MasterMonitor.pm,ln424] Error happened on checking configurations. at /usr/local/bin/masterha_check_repl line 48

[/usr/local/share/perl5/MHA/MasterMonitor.pm,ln523] Error happened on monitoring servers.

[info] Got exit code 1 (Not master dead).

MySQL Replication Health is NOT OK!

在所乎携有节点执行:

ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql

执行后再次报错:

[info] Connecting to root@192.168.0.1(192.168.0.1:22)..

Can't exec "mysqlbinlog": No suchfile or directory at /usr/local/share/perl5/MHA/BinlogManager.pm line 106.

mysqlbinlog version command failed with rc1:0, please verify PATH, LD_LIBRARY_PATH, and client options

at/usr/local/bin/apply_diff_relay_logs line 493

[/usr/local/share/perl5/MHA/MasterMonitor.pm,ln205] Slaves settings check failed!

[/usr/local/share/perl5/MHA/MasterMonitor.pm,ln413] Slave configuration failed.

[/usr/local/share/perl5/MHA/MasterMonitor.pm,ln424] Error happened on checking configurations. at /usr/local/bin/masterha_check_repl line 48

[/usr/local/share/perl5/MHA/MasterMonitor.pm,ln523] Error happened on monitoring servers.

Got exit code 1 (Not master dead).

MySQL Replication Health is NOT OK!

在所有节点执行

[root@master masterha]#type mysqlbinlog

[root@master masterha]#mysqlbinlog is/usr/local/mysql/bin/mysqlbinlog

[root@master masterha]#ln -s/usr/local/mysql/bin/mysqlbinlog /usr/bin/mysqlbinlog

原因:都是没有在指定位置找到相应的文件,所以做一个软链

启动:

第一次,手动绑定vip

sh /etc/masterha/init_vip.sh

检查MHA是否启动和状态

cat /var/log/masterha/app1.log

停止:

关于基础介绍及原理略过,直接上 *** 作步骤衡枝蔽吧。

mysql:5.7

*** 作系统:centos7.4

地址规划搭颤:

MHA manage:10.21.20.89

mysql主:10.21.20.71

mysql从1:10.21.20.131

mysql从2:10.21.20.132

vip:10.21.20.77

(3)将mharepo.tar.gz上传四台需要安装的服务器解压。然后新建一个yum文件,指向解压的目录。

(4) 安装MHA,在3台mysql上安装node,在管理节点安装manager。

在主库和从库咐州上观察ip发现,vip已经自动漂移到从库上。至此高可用完成。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/12494167.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-25
下一篇 2023-05-25

发表评论

登录后才能评论

评论列表(0条)

保存