MySQL架构之MHA架构实战( 三 )

8、启动监控[root@linux-node1 ~]# nohup masterha_manager --conf=/etc/mha/app1.cnf --remove_dead_master < /dev/null > /var/log/mha/app1/manager.log 2>&1 &[1] 20640[root@linux-node1 ~]# masterha_check_status --conf=/etc/mha/app1.cnf app1 monitoring program is now on initialization phase(10:INITIALIZING_MONITOR). Wait for a while and try checking again.9、测试(1)停止主库[root@linux-node1 ~]# /etc/init.d/mysqld stopShutting down MySQL............ SUCCESS! (2)登录从库查看,node2变成了主库,node3的主库ip变成了192.168.56.12[root@linux-node2 ~]# mysql -uroot -p123456Welcome to the MariaDB monitor.Commands end with ; or g.Your MySQL connection id is 24Server version: 5.7.18-log MySQL Community Server (GPL)Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.MySQL [(none)]> show master status;+------------------+----------+--------------+------------------+-------------------+| File| Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |+------------------+----------+--------------+------------------+-------------------+| mysql-bin.000005 |154 ||||+------------------+----------+--------------+------------------+-------------------+1 row in set (0.00 sec)[root@linux-node3 ~]# mysql -uroot -p123456mysql> show slave statusG*************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: 192.168.56.12Master_User: repMaster_Port: 3306Connect_Retry: 60Master_Log_File: mysql-bin.000005Read_Master_Log_Pos: 154Relay_Log_File: linux-node3-relay-bin.000002Relay_Log_Pos: 320Relay_Master_Log_File: mysql-bin.000005Slave_IO_Running: YesSlave_SQL_Running: Yes



推荐阅读