orchestrator + maxscale + mysql5.7GTID switch over the primary test

1, the orchestrator see an environment: 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 maxscale
sudo yum install maxscale
maxkeys /var/lib/maxscale/ 
maxpasswd /var/lib/maxscale/ 123456
chown maxscale.maxscale /var/lib/maxscale/.secrets
vim /etc/maxscale.cnf
systemctl start maxscale
systemctl status maxscale.service
cd /var/log/maxscale/
vim maxscale.log 
systemctl start maxscale

3, maxscale profile

[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=server
address=192.168.56.14
port=3306
protocol=MariaDBBackend

[server2]
type=server
address=192.168.56.15
port=3306
= MariaDBBackend Protocol 

[server3] 
of the type = Server 
address = 192.168.56.16 
Port = 3306 
Protocol = MariaDBBackend 
# at The Monitor Servers for 
# 
# This MaxScale by Will Aware of the Keep at The State of Servers at The. 
# MariaDB Monitor Documentation: 
# HTTPS: // MariaDB .com / kB / EN / MariaDB-maxScale-23 is-MariaDB-Monitor / 

[MariaDB-Monitor] 
type = Monitor 
Module1 = mariadbmon 
Servers = server1, Server2, Server3 
User = Orchestrator 
password = 0FFC28BC3A8F402F10B0B798E347FD9B 
MONITOR_INTERVAL 2000 = 
# broken when copying all slave when off, maxscale still available, all of the access points to master node 
detect_stale_master = to 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=service
router=readconnroute
servers=server1,server2,server3
user=orchestrator
password=0FFC28BC3A8F402F10B0B798E347FD9B
router_options=slave


# ReadWriteSplit documentation:
# https://mariadb.com/kb/en/mariadb-maxscale-23-readwritesplit/

[Read-Write-Service]
type=service
router=readwritesplit
servers=server1,server2,server3
user=orchestrator
password=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=service
router=cli

# Listener definitions for the services
#
# These listeners represent the ports the
# services will listen on.
#

[Read-Only-Listener]
type=listener
service=Read-Only-Service
protocol=MariaDBClient
port=4008

[Read-Write-Listener]
type=listener
service=Read-Write-Service
protocol=MariaDBClient
port=4006

[MaxAdmin-Listener]
type=listener
service=MaxAdmin-Service
protocol=maxscaled
socket=default
[root@mgr1 maxscale]#

4, the testing process, the original master closed manner and to restart from the library, the following procedure is automatic discovery state display maxscale

[root@mgr1 maxscale]# maxadmin 
MaxScale> list servers
Servers.
-------------------+-----------------+-------+-------------+--------------------
Server             | Address         | Port  | Connections | Status              
-------------------+-----------------+-------+-------------+--------------------
server1            | 192.168.56.14   |  3306 |           0 | Slave of External Server, Running
server2            | 192.168.56.15   |  3306 |           0 | Slave of External Server, Running
server3            | 192.168.56.16   |  3306 |           0 | Master, Running
-------------------+-----------------+-------+-------------+--------------------
MaxScale> list servers
Servers.
-------------------+-----------------+-------+-------------+--------------------
Server             | Address         | Port  | Connections | Status              
-------------------+-----------------+-------+-------------+--------------------
server1            | 192.168.56.14   |  3306 |           0 | Master, Running
server2            | 192.168.56.15   |  3306 |           0 | Slave of External Server, Running
server3            | 192.168.56.16   |  3306 |           0 | Down
-------------------+-----------------+-------+-------------+--------------------
MaxScale> list servers
Servers.
-------------------+-----------------+-------+-------------+--------------------
Server             | Address         | Port  | Connections | Status              
-------------------+-----------------+-------+-------------+--------------------
server1            | 192.168.56.14   |  3306 |           0 | Master, Running
server2            | 192.168.56.15   |  3306 |           0 | Slave of External Server, Running
server3            | 192.168.56.16   |  3306 |           0 | Down
-------------------+-----------------+-------+-------------+--------------------
MaxScale> list servers
Servers.
-------------------+-----------------+-------+-------------+--------------------
Server             | Address         | Port  | Connections | Status              
-------------------+-----------------+-------+-------------+--------------------
server1            | 192.168.56.14   |  3306 |           0 | Master, Running
server2            | 192.168.56.15   |  3306 |           0 | Slave of External Server, Running
server3            | 192.168.56.16   |  3306 |           0 | Down
-------------------+-----------------+-------+-------------+--------------------
MaxScale> list servers
Servers.
-------------------+-----------------+-------+-------------+--------------------
Server             | Address         | Port  | Connections | Status              
-------------------+-----------------+-------+-------------+--------------------
server1            | 192.168.56.14   |  3306 |           0 | Master, Running
server2            | 192.168.56.15   |  3306 |           0 | Slave of External Server, Running
server3            | 192.168.56.16   |  3306 |           0 | Slave of External Server, Running
-------------------+-----------------+-------+-------------+--------------------
MaxScale> list servers
Servers.
-------------------+-----------------+-------+-------------+--------------------
Server             | Address         | Port  | Connections | Status              
-------------------+-----------------+-------+-------------+--------------------
server1            | 192.168.56.14   |  3306 |           0 | Master, Running
server2            | 192.168.56.15   |  3306 |           0 | Slave of External Server, Running
server3            | 192.168.56.16   |  3306 |           0 | Slave of External Server, Running
-------------------+-----------------+-------+-------------+--------------------
MaxScale> list servers
Servers.
-------------------+-----------------+-------+-------------+--------------------
Server             | Address         | Port  | Connections | Status              
-------------------+-----------------+-------+-------------+--------------------
server1            | 192.168.56.14   |  3306 |           0 | Master, Running
server2            | 192.168.56.15   |  3306 |           0 | Slave of External Server, Running
server3            | 192.168.56.16   |  3306 |           0 | Slave of External Server, Running
-------------------+-----------------+-------+-------------+--------------------
MaxScale> list servers
Servers.
-------------------+-----------------+-------+-------------+--------------------
Server             | Address         | Port  | Connections | Status              
-------------------+-----------------+-------+-------------+--------------------
server1            | 192.168.56.14   |  3306 |           0 | Master, Running
server2            | 192.168.56.15   |  3306 |           0 | Slave of External Server, Running
server3            | 192.168.56.16   |  3306 |           0 | Slave of External Server, Running
-------------------+-----------------+-------+-------------+--------------------
MaxScale> list servers


Guess you like

Origin blog.51cto.com/860143/2429673