Skip to main content

安装MHA组件

所有节点都要安装MHA node所需的perl模块

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

rpm -ivh https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm

yum install perl-DBD-MySQL -y

在所有的节点安装MHA node

yum install -y perl-devel perl-CPAN

wget https://downloads.mariadb.com/MHA/mha4mysql-node-0.56.tar.gz

tar xf mha4mysql-node-0.56.tar.gz

cd mha4mysql-node-0.56

perl Makefile.PL

make && make install

安装完成后会在/usr/local/bin目录下生成以下脚本文件

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

安装MHA Manager,在MHA Manager的主机也是需要安装MHA Node,MHA Manger也依赖于perl模块

yum install perl-Mail-Sender perl-Log-Dispatch

yum install perl-DBD-MySQL perl-Config-Tiny perl-Log-Dispatch perl-Parallel-ForkManager perl-Time-HiRes -y

wget https://downloads.mariadb.com/MHA/mha4mysql-manager-0.56.tar.gz

tar xf mha4mysql-manager-0.56.tar.gz

cd mha4mysql-manager-0.56

perl Makefile.PL

make && make install