Maradb Maxscale hints
We all love maxscale for running our mariadb galara clusters!
But how to make the best of it.
- Reducing single point of failiure
The temptation most people have is to have one, or maybe two maxscale servers connecting into the database cluster, but I’ve found a way that works really well. On each server that connects to the database cluster, they each have their own copy of maxscale and basically connect through localhost. This means we don’t need any extra servers and if that server breaks our maxscale installtion is still running on everything else.
Just configure the maxscale and then point the database connections to 127.0.0.1, note that this means really fast access because the only “external” access outside the server is to the cluster itself.
Most people do failover by changing the connection code, which is not always possible. Using this method you don’t need to change any connection code as the local maxscale server will do all the failover for you.
2. Priorities the fastest/least used node as the master
You can configure maxscale to prioritise one node over another.
3. Turn off DNS lookups
Why, maxscale why?
Running any kind of application we want the fastest speed we can possibly have, especially if it’s a gaming application. 99% of lag we had at Wolf Territories Grid (https://www.wolf-grid.com) came from bottlenecks in the database. It’s no surprise when every time a character moves it’s a database write.

So by having each container/vm in the cluster running its own maxscale we increased speed by a long way.
Here’s my config for a 5 node galara cluster.
[maxscale]
threads=auto
skip_name_resolve=true # this really increases speed
############################################################################
# Server definitions #
# #
# Set the address of the server to the network address of a MariaDB server.#
############################################################################
[server1]
type=server
address=***IPONE***
port=3306
protocol=MariaDBBackend
persistpoolmax=500
persistmaxtime=30s
priority=2
rank=secondary
[server2]
type=server
address=***IPONE***
port=3306
protocol=MariaDBBackend
persistpoolmax=500
persistmaxtime=30s
priority=2
rank=secondary
[server3]
type=server
address=***IPONE***
port=3306
protocol=MariaDBBackend
persistpoolmax=500
persistmaxtime=30s
priority=1
rank=secondary
[server4]
type=server
address=***IPONE***
port=3306
protocol=MariaDBBackend
persistpoolmax=500
persistmaxtime=30s
priority=2
rank=secondary
[server5]
type=server
address=***IPONE***
port=3306
protocol=MariaDBBackend
persistpoolmax=500
persistmaxtime=30s
priority=2
rank=secondary
[split]
type=service
router=readwritesplit
servers=server1,server2,server3,server4,server5
user=root
password=uV6LTchS
[Galera-Monitor]
type=monitor
module=galeramon
servers=server1,server2,server3,server4,server5
user=**SECRET**
password=***SECRET***
monitor_interval=2000ms
root_node_as_master=true
use_priority=true
[connection-router]
type = service
router = readconnroute
servers = server1,server2,server3,server4,server5
user = **SECRETUSER**
password = **SECRETPASSWORD**
router_options = synced
enable_root_user=0
[connection-router-listener]
type = listener
service = connection-router
protocol = MariaDBClient
port = 3306
Related
Filed under: Proxmox - @ 26 February 2025 07:08