日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

Mysql高可用集群-解决MMM单点故障

發布時間:2023/12/2 数据库 58 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Mysql高可用集群-解决MMM单点故障 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

目錄

  • 一.理論概述
    • 組件介紹
  • 三.部署
  • 四.測試
  • 五.總結

preface:

MMM架構相比于MHA來說各方面都遜色不少,寫這篇案例也算是整理下思路吧.

一.理論概述

MMM(Master-Master replication Manager for MySQL)
是一套支持雙主日常管理的腳本程序,使用Perl語言開發,主要用來監控和管理MySQL雙主庫復制,同一時刻只允許一個主庫進行寫入

方便的是,mmm不但可以為寫庫配置VIP,而且實現讀庫VIP,也可以節省一些構建讀負載均衡及高可用的資源

實現的功能簡單來說就是實現了主庫的故障切換功能,同時也可以實現多個slave讀操作的負載均衡

不適用的場景:對數據一致性要求很高不適用

組件介紹

  • mmm-mond程序:監控進程,負責所有的監控工作,在管理服務器上運行
  • mmm_agentd:運行在每個集群mysql節點上的,完成監控的探針工作和執行簡單的遠端服務設置
  • mmm_control:一個簡單的管理腳本,用來查看和管理集群運行狀態,同時管理mmm_mond進程。

    二.環境

    • 架構拓撲,本案例只針對于數據庫集群示范
    主機名稱IP地址角色
    master192.168.111.3主庫,負責寫
    masterba192.168.111.4備用主庫,主主同步
    slave1192.168.111.5從庫,讀操作
    slave2192.168.111.6從庫,讀操作;mmm-monitor
    monitorba192.168.111.7monitor高可用
    writeVIP192.168.111.100
    readVIP192.168.111.200
    monitorVIP192.168.111.222

    實現思路:先部署主主高可用,安裝mmm相關組件

    三.部署

    • 所有主機安裝epel源
    下載地址 https://mirrors.tuna.tsinghua.edu.cn/epel//然后選擇相應的版本下載并安裝 yum clean all && yum makecache
    • 基本環境
    [root@localhost ~]# vim /etc/hosts 192.168.111.3 master 192.168.111.4 masterba 192.168.111.5 slave1 192.168.111.6 slave2[root@localhost ~]# hostname master [root@localhost ~]# bash [root@master ~]# bash [root@master ~]# uname -n master #全部修改為對應的
    • 部署二進制包mysql5.7.24
    yum -y install libaio wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz useradd -M -s /sbin/nologin mysql tar zxf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz mv mysql-5.7.24-linux-glibc2.12-x86_64 /usr/local/mysql chown -R mysql:mysql /usr/local/mysql ln -s /usr/local/mysql/bin/* /usr/local/bin/cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqldmysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize #記住生成的隨機密碼待會啟動服務之后修改vim /etc/my.cnf --------------------111.3-------------------------- [mysqld] datadir=/usr/local/mysql/data socket=/tmp/mysql.sock symbolic-links=0 server-id=1 log-bin=mysql-bin log_slave_updates=1 #將另一臺備主同步數據給自身時,寫入到binarylog auto-increment-increment=2 auto-increment-offset=1 #auto_increment_increment:自增值 #auto_increment_offset:漂移值,也就是步長 [mysqld_safe] log-error=/usr/local/mysql/data/mysql.log pid-file=/usr/local/mysql/data/mysql.pid !includedir /etc/my.cnf.d--------------------111.4-------------------------- [mysqld] datadir=/usr/local/mysql/data socket=/tmp/mysql.sock symbolic-links=0 server-id=2 log-bin=mysql-bin log_slave_updates=1 #將另一臺備主同步數據給自身時,寫入到binarylog auto-increment-increment=2 auto-increment-offset=2 #auto_increment_increment:自增值 #auto_increment_offset:漂移值,也就是步長 [mysqld_safe] log-error=/usr/local/mysql/data/mysql.log pid-file=/usr/local/mysql/data/mysql.pid !includedir /etc/my.cnf.d--------------------111.5-------------------------- [mysqld] datadir=/usr/local/mysql/data socket=/tmp/mysql.socksymbolic-links=0 server-id=3 log-bin=mysql-bin log_slave_updates=1 [mysqld_safe] log-error=/usr/local/mysql/data/mysql.log pid-file=/usr/local/mysql/data/mysql.pid !includedir /etc/my.cnf.d--------------------111.6-------------------------- [mysqld] datadir=/usr/local/mysql/data socket=/tmp/mysql.socksymbolic-links=0 server-id=4 log_slave_updates=1 log-bin=mysql-bin [mysqld_safe] log-error=/usr/local/mysql/data/mysql.log pid-file=/usr/local/mysql/data/mysql.pid !includedir /etc/my.cnf.d[root@masterba ~]# /etc/init.d/mysqld start[root@master ~]# mysqladmin -u root -p'BZn9B++V06qg' password '123456' mysqladmin: [Warning] Using a password on the command line interface can be insecure. Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety. #修改默認密碼
    • 部署主主同步
    --master: [root@master ~]# mysql -u root -p123456mysql> grant replication slave on *.* to 'myslave'@'192.168.111.%' identified by'123456'; Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> show master status; +------------------+----------+--------------+------------------+-------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +------------------+----------+--------------+------------------+-------------------+ | mysql-bin.000002 | 879 | | | | +------------------+----------+--------------+------------------+-------------------+ 1 row in set (0.00 sec)--masterba: [root@masterba ~]# mysql -uroot -p123456mysql> grant replication slave on *.* to 'myslave'@'192.168.111.%' identified by'123456'; Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> flush privileges; Query OK, 0 rows affected (0.01 sec) mysql> show master status; +------------------+----------+--------------+------------------+-------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +------------------+----------+--------------+------------------+-------------------+ | mysql-bin.000002 | 879 | | | | +------------------+----------+--------------+------------------+-------------------+ 1 row in set (0.00 sec)--master: mysql> change master to master_host='192.168.111.4',master_user='myslave',master_password='123456',master_log_file='mysql-bin.000002',master_log_pos=879; Query OK, 0 rows affected, 2 warnings (0.11 sec)mysql> start slave; Query OK, 0 rows affected (0.00 sec)mysql> show slave status\G; *************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: 192.168.111.4Master_User: myslaveMaster_Port: 3306Connect_Retry: 60Master_Log_File: mysql-bin.000002Read_Master_Log_Pos: 879Relay_Log_File: master-relay-bin.000002Relay_Log_Pos: 320Relay_Master_Log_File: mysql-bin.000002Slave_IO_Running: YesSlave_SQL_Running: YesReplicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0Last_Error: Skip_Counter: 0Exec_Master_Log_Pos: 879Relay_Log_Space: 528Until_Condition: NoneUntil_Log_File: Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 0 Master_SSL_Verify_Server_Cert: NoLast_IO_Errno: 0Last_IO_Error: Last_SQL_Errno: 0Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 2Master_UUID: 01008194-68b1-11e9-bf0b-000c294b0234Master_Info_File: /usr/local/mysql/data/master.infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Slave has read all relay log; waiting for more updatesMaster_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: 1 row in set (0.00 sec)--masterba: mysql> change master to master_host='192.168.111.3',master_user='myslave',master_password='123456',master_log_file='mysql-bin.000002',master_log_pos=879; Query OK, 0 rows affected, 2 warnings (0.01 sec)mysql> start slave; Query OK, 0 rows affected (0.00 sec)mysql> show slave status\G; *************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: 192.168.111.3Master_User: myslaveMaster_Port: 3306Connect_Retry: 60Master_Log_File: mysql-bin.000002Read_Master_Log_Pos: 1036Relay_Log_File: masterba-relay-bin.000002Relay_Log_Pos: 477Relay_Master_Log_File: mysql-bin.000002Slave_IO_Running: YesSlave_SQL_Running: YesReplicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0Last_Error: Skip_Counter: 0Exec_Master_Log_Pos: 1036Relay_Log_Space: 687Until_Condition: NoneUntil_Log_File: Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 0 Master_SSL_Verify_Server_Cert: NoLast_IO_Errno: 0Last_IO_Error: Last_SQL_Errno: 0Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 1Master_UUID: e13f8b12-7bda-11e9-b71b-000c2935c4a6Master_Info_File: /usr/local/mysql/data/master.infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Slave has read all relay log; waiting for more updatesMaster_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: 1 row in set (0.00 sec)slave1: mysql> change master to master_host='192.168.111.4',master_user='myslave',master_password='123456',master_log_file='mysql-bin.000002',master_log_pos=879; Query OK, 0 rows affected, 2 warnings (0.02 sec)mysql> start slave; Query OK, 0 rows affected (0.00 sec) #slave2一樣操作,一同指向masterba
    • 部署mmm
    我們在主庫上做授權,由于現在是同步狀態,所以授權信息其它數據庫也會存在mysql> grant replication client on *.* to 'mmm_monitor'@'192.168.111.%' identified by '123456'; Query OK, 0 rows affected, 1 warning (0.11 sec) #監控用戶mysql> grant super,replication client,process on *.* to 'mmm_agent'@'192.168.111.%' identified by '123456'; Query OK, 0 rows affected, 1 warning (0.01 sec) #agent用戶mysql> grant replication slave on *.* to 'myslave'@'192.168.111.%' identified by '123456'; Query OK, 0 rows affected, 1 warning (0.00 sec) #復制用戶mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)[root@master ~]# yum -y install mysql-mmm-agent #四個mysql節點都要安裝[root@slave2 ~]# yum -y install mysql-mmm mysql-mmm-agent mysql-mmm-tools mysql-mmm-monitor keepalived #manager節點我這里充當slave2,承擔了一部分讀操作[root@monitorba ~]# yum -y install mysql-mmm mysql-mmm-tools mysql-mmm-monitor[root@slave2 ~]# vim /etc/mysql-mmm/mmm_common.conf #該文件所有節點配置都相同 active_master_role writer<host default>cluster_interface ens32pid_path /run/mysql-mmm-agent.pidbin_path /usr/libexec/mysql-mmm/replication_user myslavereplication_password 123456agent_user mmm_agentagent_password 123456#剛才所授權用戶的賬號及密碼 </host><host db1>ip 192.168.111.3mode masterpeer db2 </host><host db2>ip 192.168.111.4mode masterpeer db1 </host> <host db3>ip 192.168.111.5mode slave </host><host db4>ip 192.168.111.6mode slave </host> #每個host是一個節點,按照文件格式配置 <role writer>hosts db1, db2ips 192.168.111.100#寫操作服務器的VIPmode exclusive#模式:同意時間只有一個節點可以使用資源 </role><role reader>hosts db3, db4ips 192.168.111.200#讀操作服務器的VIP,可以有多個,逗號分隔mode balanced#負載均衡模式 </role>[root@slave2 ~]# scp /etc/mysql-mmm/mmm_common.conf root@master:/etc/mysql-mmm/[root@slave2 ~]# scp /etc/mysql-mmm/mmm_common.conf root@masterba:/etc/mysql-mmm/[root@slave2 ~]# scp /etc/mysql-mmm/mmm_common.conf root@slave1:/etc/mysql-mmm/[root@slave1 ~]# scp /etc/mysql-mmm/mmm_common.conf root@192.168.111.7:/etc/mysql-mmm/在db1-4上修改mmm_agent.conf,只需要修改db1這里,是哪臺就改成哪臺,這里只給出db1的 [root@master ~]# vim /etc/mysql-mmm/mmm_agent.conf include mmm_common.conf# The 'this' variable refers to this server. Proper operation requires # that 'this' server (db1 by default), as well as all other servers, have the # proper IP addresses set in mmm_common.conf. this db1配置監控工作的服務器 [root@slave2 ~]# vim /etc/mysql-mmm/mmm_mon.conf 8 ping_ips 192.168.111.2#測試網絡可用性的IP地址,一般指定網關9 auto_set_online 60#是否設置自動上線,如果該值大于0,抖動的主機在抖動的時間范圍過后,則設置自動上線20 monitor_user mmm_monitor21 monitor_password 123456#監控的用戶和密碼全部節點啟動agent [root@master ~]# systemctl start mysql-mmm-agent.service [root@master ~]# systemctl status mysql-mmm-agent.service 監控機器啟動monitor [root@slave2 ~]# systemctl start mysql-mmm-monitor.service [root@slave2 ~]# systemctl status mysql-mmm-monitor.service #檢查集群狀態,要全部是ONLINE才正確 [root@slave2 ~]# mmm_control showdb1(192.168.111.3) master/ONLINE. Roles: writer(192.168.111.100)db2(192.168.111.4) master/ONLINE. Roles: db3(192.168.111.5) slave/ONLINE. Roles: reader(192.168.111.200)db4(192.168.111.6) slave/ONLINE. Roles:
    • 部署monitor高可用
    [root@slave2 ~]# vim /opt/monitor.sh #!/bin/bash while truesleep 2 dosum=`netstat -lnpt | grep 9988 | wc -l`if [ $sum -eq 0 ]; then systemctl stop keepalived.servicefi done #腳本另一臺機器一樣 [root@slave2 ~]# cat /etc/keepalived/keepalived.conf ! Configuration File for keepalivedglobal_defs {notification_email {acassen@firewall.locfailover@firewall.locsysadmin@firewall.loc}script_user root#需要制定腳本運行用戶notification_email_from Alexandre.Cassen@firewall.locsmtp_server 192.168.200.1smtp_connect_timeout 30router_id LVS_DEVELvrrp_skip_check_adv_addrvrrp_garp_interval 0vrrp_gna_interval 0 } vrrp_script check_m {script "/opt/monitor.sh"interval 2weight 20}vrrp_instance VI_1 {state MASTERinterface ens32virtual_router_id 51priority 100advert_int 1authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {192.168.111.222/32 dev ens32 label ens32:2}track_script {check_m} #這個配置要包括到"vrrp_instance"中去 }monitorba: [root@monitorba ~]# cat /etc/keepalived/keepalived.conf ! Configuration File for keepalivedglobal_defs {notification_email {acassen@firewall.locfailover@firewall.locsysadmin@firewall.loc}script_user rootnotification_email_from Alexandre.Cassen@firewall.locsmtp_server 192.168.200.1smtp_connect_timeout 30router_id LVS_DEVEL1vrrp_skip_check_adv_addrvrrp_garp_interval 0vrrp_gna_interval 0 } vrrp_script check_monitor {script "/opt/monitor.sh"interval 2weight 20 }vrrp_instance VI_1 {state BACKUPinterface ens32virtual_router_id 51priority 90advert_int 1authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {192.168.111.222/32 dev ens32 label ens32:2} track_script {check_monitor } }[root@slave2 ~]# systemctl start keepalived#keepalived需要修改優先級和標識和主被狀態 [root@slave2 ~]# ip a| grep ens32 2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000inet 192.168.111.6/24 brd 192.168.111.255 scope global noprefixroute ens32inet 192.168.111.200/32 scope global ens32inet 192.168.111.222/32 scope global ens32 [root@monitorba ~]# mmm_control showdb1(192.168.111.3) master/ONLINE. Roles: writer(192.168.111.100)db2(192.168.111.4) master/HARD_OFFLINE. Roles: db3(192.168.111.5) slave/HARD_OFFLINE. Roles: db4(192.168.111.6) slave/ONLINE. Roles: reader(192.168.111.200)

    四.測試

    • 查看VIP是否正確分配
    寫: [root@master ~]# ip a| grep ens32 2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000inet 192.168.111.3/24 brd 192.168.111.255 scope global noprefixroute ens32inet 192.168.111.100/32 scope global ens32讀: [root@slave1 ~]# ip a| grep ens32 2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000inet 192.168.111.5/24 brd 192.168.111.255 scope global noprefixroute ens32inet 192.168.111.200/32 scope global ens32
    • 測試VIP轉移
    [root@master ~]# /etc/init.d/mysqld stop Shutting down MySQL............ SUCCESS! [root@master ~]# ip a| grep ens32 -----寫----- 2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000inet 192.168.111.3/24 brd 192.168.111.255 scope global noprefixroute ens32[root@masterba ~]# ip a| grep ens32 2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000inet 192.168.111.4/24 brd 192.168.111.255 scope global noprefixroute ens32inet 192.168.111.100/32 scope global ens32-----讀----- [root@slave1 ~]# /etc/init.d/mysqld stop Shutting down MySQL.... SUCCESS! [root@slave1 ~]# ip a| grep ens32 2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000inet 192.168.111.5/24 brd 192.168.111.255 scope global noprefixroute ens32inet 192.168.111.200/32 scope global ens32 [root@slave1 ~]# ip a| grep ens32 2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000inet 192.168.111.5/24 brd 192.168.111.255 scope global noprefixroute ens32inet 192.168.111.200/32 scope global ens32 [root@slave1 ~]# ip a| grep ens32 2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000inet 192.168.111.5/24 brd 192.168.111.255 scope global noprefixroute ens32inet 192.168.111.200/32 scope global ens32 [root@slave1 ~]# ip a| grep ens32 2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000inet 192.168.111.5/24 brd 192.168.111.255 scope global noprefixroute ens32[root@slave2 ~]# ip a| grep ens32 2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000inet 192.168.111.6/24 brd 192.168.111.255 scope global noprefixroute ens32inet 192.168.111.200/32 scope global ens32 #切換的慢[root@slave2 ~]# mmm_control showdb1(192.168.111.3) master/HARD_OFFLINE. Roles: db2(192.168.111.4) master/ONLINE. Roles: writer(192.168.111.100)db3(192.168.111.5) slave/HARD_OFFLINE. Roles: db4(192.168.111.6) slave/ONLINE. Roles: reader(192.168.111.200) #離線的已經指明了
    • 修復好的數據庫服務器重新加入集群的方法
    [root@master ~]# /etc/init.d/mysqld start#比較慢,在monitor上查看狀態 [root@slave2 ~]# mmm_control showdb1(192.168.111.3) master/ONLINE. Roles: db2(192.168.111.4) master/ONLINE. Roles: writer(192.168.111.100)db3(192.168.111.5) slave/HARD_OFFLINE. Roles: db4(192.168.111.6) slave/ONLINE. Roles: reader(192.168.111.200)
    • 連接數據庫VIP測試
    mysql> grant all privileges on *.* to root@'192.168.111.%' identified by '123456'; Query OK, 0 rows affected, 1 warning (0.01 sec)mysql> flush privileges; Query OK, 0 rows affected (0.10 sec) #主庫上做下授權,從庫也會同步授權信息[root@slave2 ~]# mysql -uroot -p123456 -h'192.168.111.100' mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 415 Server version: 5.7.24-log MySQL Community Server (GPL)Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> [root@slave2 ~]# mysql -uroot -p123456 -h'192.168.111.200' mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1043 Server version: 5.7.24-log MySQL Community Server (GPL)Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> #輸入的必須都是VIP進行連接
    • 測試monitorVIP
    [root@slave2 ~]# systemctl stop mysql-mmm-monitor.service [root@slave2 ~]# ip a | grep ens32 2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000inet 192.168.111.6/24 brd 192.168.111.255 scope global noprefixroute ens32inet 192.168.111.200/32 scope global ens32[root@monitorba ~]# ip a| grep ens32 2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000inet 192.168.111.7/24 brd 192.168.111.255 scope global noprefixroute ens32inet 192.168.111.222/32 scope global ens32:2 [root@monitorba ~]# mmm_control showdb1(192.168.111.3) master/ONLINE. Roles: writer(192.168.111.100)db2(192.168.111.4) master/HARD_OFFLINE. Roles: db3(192.168.111.5) slave/HARD_OFFLINE. Roles: db4(192.168.111.6) slave/ONLINE. Roles: reader(192.168.111.200)

    五.總結

  • 明顯的切換速度太慢,案例環境還是沒有多少數據的,以及系統環境也不是很復雜,生產環境慎用吧
  • 可以做寫的高可用,也可以用來負載均衡讀的服務器
  • keepalivedVIP時,糾結了幾個小時,原因已經注釋好了
  • 持之以恒
  • 轉載于:https://www.cnblogs.com/joinbestgo/p/10907810.html

    總結

    以上是生活随笔為你收集整理的Mysql高可用集群-解决MMM单点故障的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。