我2個服務器(srv50/51),它們中的一個 是主站和第二個是從配置,Maxscale正在寫與router_options =主站(主/從複製)從和聽衆停止
這裏我的配置文件/etc/maxscale.cnf的配置:
[Read-Only Service]
type=service
router=readconnroute
servers=server50, server51
user=YYYYYYYYYYYYY
passwd=XXXXXXXXXXXXXX
router_options=slave
[Write-Only Service]
type=service
router=readconnroute
servers=server50, server51
user=YYYYYYYYYYYYY
passwd=XXXXXXXXXXXXXX
router_options=master
[Read-Only Listener]
type=listener
service=Read-Only Service
protocol=MySQLClient
port=4008
[Write-Only Listener]
type=listener
service=Write-Only Service
protocol=MySQLClient
port=4009
正如我understool的router_options看看誰是主人和發送文字查詢到主
Maxscale(通過maxadmin)似乎發現2服和下站在女巫一個是站長:
MaxScale> list servers
Servers.
-------------------+-----------------+-------+-------------+--------------------
Server | Address | Port | Connections | Status
-------------------+-----------------+-------+-------------+--------------------
server51 | 192.168.0.51 | 3306 | 0 | Slave, Running
server50 | 192.168.0.50 | 3306 | 0 | Master, Running
-------------------+-----------------+-------+-------------+--------------------
但是即使我在MySQL的本地連接我Maxscale只寫監聽端口(4009),偵聽器都處於停止模式下,是正常的嗎?
MaxScale> list listeners
Listeners.
---------------------+--------------------+-----------------+-------+--------
Service Name | Protocol Module | Address | Port | State
---------------------+--------------------+-----------------+-------+--------
Read-Only Service | MySQLClient | * | 4008 | Stopped
Write-Only Service | MySQLClient | * | 4009 | Stopped
MaxAdmin Service | maxscaled | * | 6603 | Running
---------------------+--------------------+-----------------+-------+--------
我已經嘗試創建srv51(從)一個數據庫,它只是在srv51創建,而不是在srv50。
我的配置有問題嗎?這很奇怪,因爲它不是我的第一個集羣,而在其他集羣上,所有寫入的都是主集羣(但偵聽器正在運行)。我不明白「router_options = master」的含義嗎?如何開始聽衆?我prefere保持51寫列表檢測拓撲變化
===== UPDATE =====
看後日志文件/var/log/maxscale/maxscale1.log 我發現我的顯示器用戶沒有正確的密碼:
[MySQL Monitor]
type=monitor
module=mysqlmon
servers=server50, server51
user=MONITOR
passwd=MONITOR_PASS
monitor_interval=10000
我校正了用戶密碼並重新啓動maxscale,現在一切正在運行:
MaxScale> list listeners
Listeners.
---------------------+--------------------+-----------------+-------+--------
Service Name | Protocol Module | Address | Port | State
---------------------+--------------------+-----------------+-------+--------
Read-Only Service | MySQLClient | * | 4008 | Running
Write-Only Service | MySQLClient | * | 4009 | Running
MaxAdmin Service | maxscaled | * | 6603 | Running
---------------------+--------------------+-----------------+-------+--------
但寫查詢奴隸仍在進行,而不是在主