时候如果master节点可以ssh联通的话会自动到该目录抓取日志文件来防止slave节点日志不完整。 workdir是manager节点和node节点的工作目录,在MHA管理启动时候,如果目录不存在,会通过ssh来进行创建。请保证ssh用户的权限。
4.3 主机信任
MHA环境需要保证manager和node之间的信任。
ssh-keygen -t rsa
ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.8.6
ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.8.7
ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.8.8
验证机器信任
[root@mysql-mha03 ~]# masterha_check_ssh --conf=/etc/MHA/MHAmanager.conf
Thu Jul 23 14:33:26 2015 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Thu Jul 23 14:33:26 2015 - [info] Reading application default configuration from /etc/MHA/MHAmanager.conf..
Thu Jul 23 14:33:26 2015 - [info] Reading server configuration from /etc/MHA/MHAmanager.conf..
Thu Jul 23 14:33:26 2015 - [info] Starting SSH connection tests..
Thu Jul 23 14:33:26 2015 - [debug]
Thu Jul 23 14:33:26 2015 - [debug] Connecting via SSH from root@mysql-mha01(192.168.8.6:22) to root@mysql-mha02(192.168.8.7:22)..
Thu Jul 23 14:33:26 2015 - [debug] ok.
Thu Jul 23 14:33:26 2015 - [debug] Connecting via SSH from root@mysql-mha01(192.168.8.6:22) to root@mysql-mha03(192.168.8.8:22)..
Thu Jul 23 14:33:26 2015 - [debug] ok.
Thu Jul 23 14:33:27 2015 - [debug]
Thu Jul 23 14:33:26 2015 - [debug] Connecting via SSH from root@mysql-mha02(192.168.8.7:22) to root@mysql-mha01(192.168.8.6:22)..
Thu Jul 23 14:33:26 2015 - [debug] ok.
Thu Jul 23 14:33:26 2015 - [debug] Connecting via SSH from root@mysql-mha02(192.168.8.7:22) to root@mysql-mha03(192.168.8.8:22)..
Thu Jul 23 14:33:27 2015 - [debug] ok.
Thu Jul 23 14:33:27 2015 - [debug]
Thu Jul 23 14:33:27 2015 - [debug] Connecting via SSH from root@mysql-mha03(192.168.8.8:22) to root@mysql-mha01(192.168.8.6:22)..
Thu Jul 23 14:33:27 2015 - [debug] ok.
Thu Jul 23 14:33:27 2015 - [debug] Connecting via SSH from root@mysql-mha03(192.168.8.8:22) to root@mysql-mha02(192.168.8.7:22)..
Thu Jul 23 14:33:27 2015 - [debug] ok.
Thu Jul 23 14:33:27 2015 - [info] All SSH connection tests passed successfully.
4.4 开启MHA
验证复制环境
[root@mysql-mha03 ~]# masterha_check_repl --conf=/etc/MHA/MHAmanager.conf
Thu Jul 23 14:40:27 2015 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Thu Jul 23 14:40:27 2015 - [info] Reading application default configuration from /etc/MHA/MHAmanager.conf..
Thu Jul 23 14:40:27 2015 - [info] Reading server configuration from /etc/MHA/MHAmanager.conf..
Thu Jul 23 14:40:27 2015 - [info] MHA::MasterMonitor version 0.56.
Thu Jul 23 14:40:28 2015 - [info] GTID failover mode = 0
Thu Jul 23 14:40:28 2015 - [info] Dead Servers:
Thu Jul 23 14:40:28 2015 - [info] Alive Servers:
Thu Jul 23 14:40:28 2015 - [info] mysql-mha01(192.168.8.6:3306)
Thu Jul 23 14:40:28 2015 - [info] mysql-mha02(192.168.8.7:3306)
Thu Jul 23 14:40:28 2015 - [info] mysql-mha03(192.168.8.8:3306)
Thu Jul 23 14:40:28 2015 - [info] Alive Slaves:
Thu Jul 23 14:40:28 2015 - [info] mysql-mha01(192.168.8.6:3306) Version=5.5.43-log (oldest major version between slaves) log-bin:enabled
Thu Jul 23 14:40:28 2015 - [info] Replicating from 192.168.8.7(192.168.8.7:3306)
Thu Jul 23 14:40:28 2015 - [info] mysql-mha03(192.168.8.8:3306) Version=5.5.43-log (oldest major version between slaves) log-bin:enabled
Thu Jul 23 14:40:28 2015 - [info] Replicating from 192.168.8.7(192.168.8.7:3306)
Thu Jul 23 14:40:28 20