role ip monitor 10.99.121.206 master 10.99.121.209 slave 10.99.121.210 slave 10.99.121.213 主从:
在主上(10.99.121.206)创建复制用户与监控用户
GRANT REPLICATION SLAVE ON *.* TO 'repluser'@'%' IDENTIFIED BY '123qwe'; grant all privileges on *.* to 'monitor'@'%' identified by '123qwe'; 在从上(10.99.121.210、10.99.121.213)配置
change master to master_host='10.99.121.209', master_port=3306, master_user='repluser', master_password='123qwe', master_log_file='binlog.000002', master_log_pos=1009;
set global read_only=on; 2,在所有的node上安装perl依赖、mha-node
master slave install MHA node tar xf mha4mysql-node-0.56.tar.gz cd mha4mysql-node-0.56 perl Makefile.PL make && make install 安装完成后会在/usr/local/bin目录下生成以下脚本文件:
mysql -uroot -pLenovo123#@! -e "set global relay_log_purge=0" mysql -uroot -pLenovo123#@! -e "set global relay_log_purge=0" 6,检查SSH配置(10.99.121.206 Monitor 监控节点上操作),如下
[root@lenovo16 masterha]# masterha_check_ssh --conf=/etc/masterha/app1.cnf Thu May 25 16:55:19 2017 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping. Thu May 25 16:55:19 2017 - [info] Reading application default configuration from /etc/masterha/app1.cnf.. Thu May 25 16:55:19 2017 - [info] Reading server configuration from /etc/masterha/app1.cnf.. Thu May 25 16:55:19 2017 - [info] Starting SSH connection tests.. Thu May 25 16:55:20 2017 - [debug] Thu May 25 16:55:19 2017 - [debug] Connecting via SSH from root@10.99.121.210(10.99.121.210:22) to root@10.99.121.209(10.99.121.209:22).. Thu May 25 16:55:20 2017 - [debug] ok. Thu May 25 16:55:20 2017 - [debug] Connecting via SSH from root@10.99.121.210(10.99.121.210:22) to root@10.99.121.213(10.99.121.213:22).. Thu May 25 16:55:20 2017 - [debug] ok. Thu May 25 16:55:20 2017 - [debug] Thu May 25 16:55:19 2017 - [debug] Connecting via SSH from root@10.99.121.209(10.99.121.209:22) to root@10.99.121.210(10.99.121.210:22).. Thu May 25 16:55:19 2017 - [debug] ok. Thu May 25 16:55:19 2017 - [debug] Connecting via SSH from root@10.99.121.209(10.99.121.209:22) to root@10.99.121.213(10.99.121.213:22).. Thu May 25 16:55:20 2017 - [debug] ok. Thu May 25 16:55:21 2017 - [debug] Thu May 25 16:55:20 2017 - [debug] Connecting via SSH from root@10.99.121.213(10.99.121.213:22) to root@10.99.121.209(10.99.121.209:22).. Thu May 25 16:55:20 2017 - [debug] ok. Thu May 25 16:55:20 2017 - [debug] Connecting via SSH from root@10.99.121.213(10.99.121.213:22) to root@10.99.121.210(10.99.121.210:22).. Thu May 25 16:55:21 2017 - [debug] ok. Thu May 25 16:55:21 2017 - [info] All SSH connection tests passed successfully. 7,检查整个复制环境状况(10.99.121.206 Monitor 监控节点上操作),如下
Thu May 25 16:58:30 2017 - [info] Connecting to root@10.99.121.210(10.99.121.210:22).. Can't exec "mysqlbinlog": No such file or directory at /usr/local/share/perl5/MHA/BinlogManager.pm line 106. mysqlbinlog version command failed with rc 1:0, please verify PATH, LD_LIBRARY_PATH, and client options at /usr/local/bin/apply_diff_relay_logs line 493 那在所有mysql数据库上执行: