MySQL5.7 MHA+MaxScale2.0构建高可用环境(7)

Part3:master故障
[root@HE3 ~]# maxadmin -pmariadb list servers
Servers.
-------------------+-----------------+-------+-------------+--------------------
Server            | Address        | Port  | Connections | Status             
-------------------+-----------------+-------+-------------+--------------------
server1            | 192.168.1.248  |  3306 |          0 | Slave, Running
server2            | 192.168.1.249  |  3306 |          0 | Slave, Running
server3            | 192.168.1.100  |  3306 |          0 | Master, Running
-------------------+-----------------+-------+-------------+--------------------
[root@HE3 ~]# ps -ef|grep mysql
root    27709    1  0 Nov03 ?        00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/HE3.pid
mysql    28415 27709  0 Nov03 ?        00:00:19 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/error.log --open-files-limit=8192 --pid-file=/data/mysql/HE3.pid --socket=/tmp/mysql.sock --port=3306
root    30794 28966  0 02:34 pts/1    00:00:00 grep mysql
[root@HE3 ~]# kill -9 28415 27709
[root@HE3 ~]# maxadmin -pmariadb list servers
Servers.
-------------------+-----------------+-------+-------------+--------------------
Server            | Address        | Port  | Connections | Status             
-------------------+-----------------+-------+-------------+--------------------
server1            | 192.168.1.248  |  3306 |          0 | Slave, Running
server2            | 192.168.1.249  |  3306 |          0 | Slave, Running
server3            | 192.168.1.100  |  3306 |          0 | Master, Running
-------------------+-----------------+-------+-------------+--------------------
[root@HE3 ~]# maxadmin -pmariadb list servers
Servers.
-------------------+-----------------+-------+-------------+--------------------
Server            | Address        | Port  | Connections | Status             
-------------------+-----------------+-------+-------------+--------------------
server1            | 192.168.1.248  |  3306 |          0 | Master, Running
server2            | 192.168.1.249  |  3306 |          0 | Slave, Running
server3            | 192.168.1.100  |  3306 |          0 | Running
-------------------+-----------------+-------+-------------+--------------------

MySQL5.7 MHA+MaxScale2.0构建高可用环境

可以看出,kill master的mysql进程后,MHA将slave1拉成新的master,Maxsale也识别了这一状态。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/b359578e79f9490f04c16ee61984b2a0.html