MariaDB MaxScale Installation Guide
Follow step-by-step instructions to install MariaDB MaxScale on major Linux distributions. This guide covers repository configuration and package installation.
Quickstart Guide: MariaDB MaxScale
1
2
sudo apt update
sudo apt install -y curl
curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash
sudo apt install -y maxscalecurl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash
sudo dnf install -y maxscale3
[server1]
type=server
# IP address or hostname of your first MariaDB server
address=192.168.1.101
[server2]
type=server
# IP address or hostname of your second MariaDB server
address=192.168.1.102
# Set the port if MariaDB is listening on a non-default port
port=3307[MariaDB-Cluster]
type=monitor
# The MariaDB asynchronous replication monitoring module
module=mariadbmon
# List of servers to monitor
servers=server1,server2
# The user used for monitoring
user=maxscale_monitor
password=monitor_password
# Check every 5 seconds
monitor_interval=5sCREATE USER 'maxscale_monitor'@'%' IDENTIFIED BY 'monitor_password';
GRANT BINLOG ADMIN, BINLOG MONITOR, CONNECTION ADMIN, READ_ONLY ADMIN, REPLICATION SLAVE ADMIN, SLAVE MONITOR, RELOAD, PROCESS, SUPER, EVENT, SET USER, SHOW DATABASES ON *.* TO `maxscale_monitor`@`%`;
GRANT SELECT ON mysql.global_priv TO 'maxscale_monitor'@'%';[Read-Write-Service]
type=service
# The readwritesplit router module load balances reads and routes writes to the primary node
router=readwritesplit
# Servers available for this service
cluster=MariaDB-Cluster
# The user account used to fetch the user information from MariaDB
user=maxscale_user
password=maxscale_passwordCREATE USER 'maxscale_user'@'%' IDENTIFIED BY 'maxscale_password';
GRANT SELECT ON mysql.user TO 'maxscale_user'@'%';
GRANT SELECT ON mysql.db TO 'maxscale_user'@'%';
GRANT SELECT ON mysql.tables_priv TO 'maxscale_user'@'%';
GRANT SELECT ON mysql.columns_priv TO 'maxscale_user'@'%';
GRANT SELECT ON mysql.procs_priv TO 'maxscale_user'@'%';
GRANT SELECT ON mysql.proxies_priv TO 'maxscale_user'@'%';
GRANT SELECT ON mysql.roles_mapping TO 'maxscale_user'@'%';
GRANT SHOW DATABASES ON *.* TO 'maxscale_user'@'%';[Read-Write-Listener]
type=listener
# The service that this listener connects to
service=Read-Write-Service
# The port that MaxScale will listen on for client applications
port=3306[maxscale]
# Select the number of worker threads automatically based on the CPU thread count
threads=auto4
[maxscale]
threads=auto
[server1]
type=server
address=192.168.1.101
[server2]
type=server
address=192.168.1.102
port=3307
[MariaDB-Cluster]
type=monitor
module=mariadbmon
servers=server1,server2
user=maxscale_monitor
password=monitor_password
monitor_interval=5s
[Read-Write-Service]
type=service
router=readwritesplit
cluster=MariaDB-Cluster
user=maxscale_user
password=maxscale_password
[Read-Write-Listener]
type=listener
service=Read-Write-Service
port=33065
sudo systemctl start maxscale
sudo systemctl enable maxscale
sudo systemctl status maxscale # Check status6
mariadb -h 127.0.0.1 -P 3306 -u my-user -pFurther Resources:
Last updated
Was this helpful?

