Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Orchestrator+maxscale+mysql5.7GTID Master-Slave switching Test process

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. For orchestrator environment, please see the previous article: https://blog.51cto.com/860143/2429558.

2. Maxscale installation

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 configuration file

[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# when the replication slave is all cut off Maxscale is still available Point all visits to the master node 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. During the testing process, shut down the original master and restart it as a slave library. The following is a display of the process status automatically discovered by 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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report