简体   繁体   中英

how can I configure maxscale with one master mariadb server, 3 slave mariadb server?

I need database proxy. Because I need to setup write/read queries and especially row sharding. I found and installed maxscale. How can I configure maxscale with one master mariadb server, 3 slave mariadb server? The original documentation is not good about my problem.

The MaxScale read-write splitting tutorial covers setting up a replicated cluster with one master and two slaves. You can add the third slave by simply adding another server definition and adding it to the list of names in the servers parameter of the service.

Here's an example configuration with four servers (one master and three slaves) configured with read-write splitting.

[maxscale]
threads=auto

[server1]
type=server
address=192.168.0.101
port=3306
protocol=MariaDBBackend

[server2]
type=server
address=192.168.0.102
port=3306
protocol=MariaDBBackend

[server3]
type=server
address=192.168.0.103
port=3306
protocol=MariaDBBackend

[server4]
type=server
address=192.168.0.104
port=3306
protocol=MariaDBBackend

[MariaDB-Monitor]
type=monitor
module=mariadbmon
servers=server1,server2,server3,server4
user=maxuser
password=maxpwd
monitor_interval=5000

[RW-Split-Router]
type=service
router=readwritesplit
servers=server1,server2,server3,server4
user=maxuser
password=maxpwd

[RW-Split-Listener]
type=listener
service=RW-Split-Router
protocol=MariaDBClient
port=3306

The mariadbmon automatically detects which server is the master so you don't need to tell MaxScale which server is the master.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM