orchestrator+maxscale+mysql5.7GTID主从切换测试过程
发表于:2026-11-01 作者:千家信息网编辑
千家信息网最后更新 2026年11月01日,1、orchestrator环境请看上一篇:https://blog.51cto.com/860143/24295582、maxscale安装curl -sS https://downloads.ma
千家信息网最后更新 2026年11月01日orchestrator+maxscale+mysql5.7GTID主从切换测试过程
1、orchestrator环境请看上一篇:https://blog.51cto.com/860143/2429558
2、maxscale安装
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-maxscale-version="2.3"yum search maxscalesudo yum install maxscalemaxkeys /var/lib/maxscale/ maxpasswd /var/lib/maxscale/ 123456chown maxscale.maxscale /var/lib/maxscale/.secretsvim /etc/maxscale.cnfsystemctl start maxscalesystemctl status maxscale.servicecd /var/log/maxscale/vim maxscale.log systemctl start maxscale
3、maxscale配置文件
[root@mgr1 maxscale]# cat /etc/maxscale.cnf# MaxScale documentation:# https://mariadb.com/kb/en/mariadb-enterprise/mariadb-maxscale-23/# Global parameters## Complete list of configuration options:# https://mariadb.com/kb/en/mariadb-maxscale-23-mariadb-maxscale-configuration-usage-scenarios/[maxscale]threads=auto# Server definitions## Set the address of the server to the network# address of a MariaDB server.#[server1]type=serveraddress=192.168.56.14port=3306protocol=MariaDBBackend[server2]type=serveraddress=192.168.56.15port=3306protocol=MariaDBBackend[server3]type=serveraddress=192.168.56.16port=3306protocol=MariaDBBackend# Monitor for the servers## This will keep MaxScale aware of the state of the servers.# MariaDB Monitor documentation:# https://mariadb.com/kb/en/mariadb-maxscale-23-mariadb-monitor/[MariaDB-Monitor]type=monitormodule=mariadbmonservers=server1,server2,server3user=orchestratorpassword=0FFC28BC3A8F402F10B0B798E347FD9Bmonitor_interval=2000# 当复制slave全部断掉时,maxscale仍然可用,将所有的访问指向master节点detect_stale_master=true# Service definitions## Service Definition for a read-only service and# a read/write splitting service.## ReadConnRoute documentation:# https://mariadb.com/kb/en/mariadb-maxscale-23-readconnroute/[Read-Only-Service]type=servicerouter=readconnrouteservers=server1,server2,server3user=orchestratorpassword=0FFC28BC3A8F402F10B0B798E347FD9Brouter_options=slave# ReadWriteSplit documentation:# https://mariadb.com/kb/en/mariadb-maxscale-23-readwritesplit/[Read-Write-Service]type=servicerouter=readwritesplitservers=server1,server2,server3user=orchestratorpassword=0FFC28BC3A8F402F10B0B798E347FD9B# This service enables the use of the MaxAdmin interface# MaxScale administration guide:# https://mariadb.com/kb/en/mariadb-maxscale-23-maxadmin-admin-interface/[MaxAdmin-Service]type=servicerouter=cli# Listener definitions for the services## These listeners represent the ports the# services will listen on.#[Read-Only-Listener]type=listenerservice=Read-Only-Serviceprotocol=MariaDBClientport=4008[Read-Write-Listener]type=listenerservice=Read-Write-Serviceprotocol=MariaDBClientport=4006[MaxAdmin-Listener]type=listenerservice=MaxAdmin-Serviceprotocol=maxscaledsocket=default[root@mgr1 maxscale]#
4、测试过程,把原来的主关闭,并以从库的方式重启,下面是maxscale自动发现的过程状态展示
[root@mgr1 maxscale]# maxadmin MaxScale> list serversServers.-------------------+-----------------+-------+-------------+--------------------Server | Address | Port | Connections | Status -------------------+-----------------+-------+-------------+--------------------server1 | 192.168.56.14 | 3306 | 0 | Slave of External Server, Runningserver2 | 192.168.56.15 | 3306 | 0 | Slave of External Server, Runningserver3 | 192.168.56.16 | 3306 | 0 | Master, Running-------------------+-----------------+-------+-------------+--------------------MaxScale> list serversServers.-------------------+-----------------+-------+-------------+--------------------Server | Address | Port | Connections | Status -------------------+-----------------+-------+-------------+--------------------server1 | 192.168.56.14 | 3306 | 0 | Master, Runningserver2 | 192.168.56.15 | 3306 | 0 | Slave of External Server, Runningserver3 | 192.168.56.16 | 3306 | 0 | Down-------------------+-----------------+-------+-------------+--------------------MaxScale> list serversServers.-------------------+-----------------+-------+-------------+--------------------Server | Address | Port | Connections | Status -------------------+-----------------+-------+-------------+--------------------server1 | 192.168.56.14 | 3306 | 0 | Master, Runningserver2 | 192.168.56.15 | 3306 | 0 | Slave of External Server, Runningserver3 | 192.168.56.16 | 3306 | 0 | Down-------------------+-----------------+-------+-------------+--------------------MaxScale> list serversServers.-------------------+-----------------+-------+-------------+--------------------Server | Address | Port | Connections | Status -------------------+-----------------+-------+-------------+--------------------server1 | 192.168.56.14 | 3306 | 0 | Master, Runningserver2 | 192.168.56.15 | 3306 | 0 | Slave of External Server, Runningserver3 | 192.168.56.16 | 3306 | 0 | Down-------------------+-----------------+-------+-------------+--------------------MaxScale> list serversServers.-------------------+-----------------+-------+-------------+--------------------Server | Address | Port | Connections | Status -------------------+-----------------+-------+-------------+--------------------server1 | 192.168.56.14 | 3306 | 0 | Master, Runningserver2 | 192.168.56.15 | 3306 | 0 | Slave of External Server, Runningserver3 | 192.168.56.16 | 3306 | 0 | Slave of External Server, Running-------------------+-----------------+-------+-------------+--------------------MaxScale> list serversServers.-------------------+-----------------+-------+-------------+--------------------Server | Address | Port | Connections | Status -------------------+-----------------+-------+-------------+--------------------server1 | 192.168.56.14 | 3306 | 0 | Master, Runningserver2 | 192.168.56.15 | 3306 | 0 | Slave of External Server, Runningserver3 | 192.168.56.16 | 3306 | 0 | Slave of External Server, Running-------------------+-----------------+-------+-------------+--------------------MaxScale> list serversServers.-------------------+-----------------+-------+-------------+--------------------Server | Address | Port | Connections | Status -------------------+-----------------+-------+-------------+--------------------server1 | 192.168.56.14 | 3306 | 0 | Master, Runningserver2 | 192.168.56.15 | 3306 | 0 | Slave of External Server, Runningserver3 | 192.168.56.16 | 3306 | 0 | Slave of External Server, Running-------------------+-----------------+-------+-------------+--------------------MaxScale> list serversServers.-------------------+-----------------+-------+-------------+--------------------Server | Address | Port | Connections | Status -------------------+-----------------+-------+-------------+--------------------server1 | 192.168.56.14 | 3306 | 0 | Master, Runningserver2 | 192.168.56.15 | 3306 | 0 | Slave of External Server, Runningserver3 | 192.168.56.16 | 3306 | 0 | Slave of External Server, Running-------------------+-----------------+-------+-------------+--------------------MaxScale> list servers
过程
测试
指向
文件
方式
状态
环境
节点
请看
上一
配置
主从
切换
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
咖啡豆
广州大一互联网络科技有限公司
山东特亿宝互联网科技有限公司
中国互联网科技工作委员会毛军
互联网科技卖菜
互联网科技资迅
科技互联网技术
互联网科技的英文
腾讯科技 互联网女皇
亿人帮互联网科技
成都仁贤领冠互联网科技有限公司
互联网汽车科技小镇
移动互联网科技股
速维有品互联网信息科技(苏州)有限公司
互联网科技人工智能实验室
科技大学互联网
工业互联网科技成果转化
数字互联网科技有限公司
互联网科技品牌
盐城市攀科互联网科技有限公司
手磨咖啡
互联网科技工作委员会主任
奇士达互联网科技
互联网科技小额贷款
哈尔滨秒房互联网科技有限公司
创业天下互联网科技有限公司
互联网科技创新服务
西安有哪些互联网高科技企业
高科技和互联网的现代国家
互联网 科技节活动 微视频大赛