我刚刚设置了 MariaDB Eslace 和主服务器。我想使用故障转移功能,但是当我停止mariadb master服务时,MaxScale识别到它的停止并告诉我它将把slave切换到master......但是slave仍然处于slave状态。
maxscale.cnf:
猫 maxscale.cnf
[maxscale]
threads=auto
log_augmentation = 1
ms_timestamp = 1
log_info= 1
log_debug= 1
log_augmentation=1
[db1_master]
type=server
address=10.126.26.205
port=3306
protocol=MariaDBBackend
[db2_slave]
type=server
address=10.126.26.242
port=3306
protocol=MariaDBBackend
[MariaDB-Monitor]
type=monitor
module=mariadbmon
servers=db1_master,db2_slave
user=maxscaleuser
passwd=XXXXXXX
monitor_interval=1000
auto_rejoin=true
auto_failover=1
failover_timeout=5
failcount=2
[Read-Only-Service]
type=service
router=readconnroute
servers=db1_master, db2_slave
user=maxscaleuser
passwd=XXXXXXX
router_options=master
[Read-Write-Service]
type=service
router=readconnroute
servers=db1_master, db2_slave
user=maxscaleuser
passwd=XXXXXX
router_options=master
[MaxAdmin-Service]
type=service
router=cli
[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
maxadmin 列出服务
--------------------------+-------------------+--------+----------------+-------------------
Service Name | Router Module | #Users | Total Sessions | Backend databases
--------------------------+-------------------+--------+----------------+-------------------
Read-Only-Service | readconnroute | 1 | 1 | db1_master, db2_slave
Read-Write-Service | readconnroute | 1 | 4 | db1_master, db2_slave
MaxAdmin-Service | cli | 2 | 4 |
--------------------------+-------------------+--------+----------------+-------------------
MariaDB 大师:
MariaDB [(none)]> 显示主状态;
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000012 | 342 | masterdb | |
+------------------+----------+--------------+------------------+
1 row in set (0.000 sec)