Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Discover common deployment scenarios for MariaDB MaxScale. Learn how to leverage its features for high availability, read-write splitting, and load balancing to optimize your database.
mkdir maxscale
cd maxscale
tar -xf path/to/maxscale-25.10.3-trial-release.ubuntu.noble.x86_64.tarsudo apt install ./*.debsudo dnf install ./*.rpm[maxscale]
...
license_key=...CREATE USER 'service_user'@'%' IDENTIFIED BY 'service_pw';
GRANT SELECT ON mysql.user TO 'service_user'@'%';
GRANT SELECT ON mysql.db TO 'service_user'@'%';
GRANT SELECT ON mysql.tables_priv TO 'service_user'@'%';
GRANT SELECT ON mysql.columns_priv TO 'service_user'@'%';
GRANT SELECT ON mysql.procs_priv TO 'service_user'@'%';
GRANT SELECT ON mysql.proxies_priv TO 'service_user'@'%';
GRANT SELECT ON mysql.roles_mapping TO 'service_user'@'%';
GRANT SELECT ON mysql.global_priv TO 'service_user'@'%';
GRANT SHOW DATABASES ON *.* TO 'service_user'@'%';CREATE USER 'monitor_user'@'%' IDENTIFIED BY 'monitor_pw';
GRANT ALL ON *.* TO 'monitor_user'@'%';admin_secure_gui=falsesudo systemctl start maxscale.servicesudo cat /var/log/maxscale/maxscale.logmaxctrl list serversmaxctrl list servicesadmin_host=0.0.0.0Explore the core capabilities of MariaDB MaxScale. This overview covers intelligent routing automated failover security filters and Kafka integration for scalable database architectures.
Master the Read/Write Split Router. This collection of guides details how to configure query load balancing, automatic failover, transaction replay, and causal consistency settings.

Improve read reliability. Learn to configure retry_failed_reads to automatically attempt failed SELECT queries on alternative replica servers.
Optimize applications for read-write splitting. This guide outlines best practices for transaction management and connection handling to ensure compatibility with MaxScale.
$ sudo systemctl restart maxscaleAutomate recovery after primary failure. This guide explains how to use the master_reconnection parameter to seamlessly move client connections to a new primary server.
Handle transient failures gracefully. Learn to configure the delayed_retry parameter to pause and retry queries when backend servers are temporarily unavailable.
[split-router]
type = service
router = readwritesplit
...
master_reconnection = true
master_failure_mode = fail_on_write$ sudo systemctl restart maxscale[split-router]
type = service
router = readwritesplit
...
delayed_retry = true
delayed_retry_timeout = 30s$ sudo systemctl restart maxscaleCustomize load balancing algorithms. Explore options for the slave_selection_criteria parameter, including adaptive routing and least-global-connections strategies.
Mask failovers from applications. Configure transaction_replay to automatically re-execute interrupted transactions on a new primary server without returning errors.
Preserve session context across connections. Learn how MaxScale's session command history replays SET statements on new replica connections to maintain state consistency.
[split-router]
type = service
router = readwritesplit
...
slave_selection_criteria = LEAST_GLOBAL_CONNECTIONS$ sudo systemctl restart maxscale[split-router]
type = service
router = readwritesplit
...
transaction_replay = true
transaction_replay_max_size = 10Mi
transaction_replay_attempts = 10
transaction_replay_timeout = 30s
transaction_replay_retry_on_deadlock = true$ sudo systemctl restart maxscale[split-router]
type = service
router = readwritesplit
...
max_sescmd_history = 1500
prune_sescmd_history = true$ sudo systemctl restart maxscale[split-router]
type = service
router = readwritesplit
...
disable_sescmd_history = true$ sudo systemctl restart maxscaleINSERT INTO hq_sales.invoices
(customer_id, invoice_date, invoice_total, payment_method)
VALUES
(1, '2020-05-10 12:35:10', 1087.23, 'CREDIT_CARD');SELECT * FROM hq_sales.invoices
WHERE customer_id = 1
AND invoice_date = '2020-05-10 12:35:10';[mariadb]
...
session_track_system_variables=last_gtid$ sudo systemctl restart mariadb[split-router]
type = service
router = readwritesplit
...
causal_reads = local
causal_reads_timeout = 15
The unit for the causal_reads_timeout parameter is seconds, and the default value is 10.$ sudo systemctl restart maxscale[split-router]
type = service
router = readwritesplit
...
causal_reads = ON
causal_reads_timeout = 15
The unit for the causal_reads_timeout parameter is seconds, and the default value is 10.$ sudo systemctl restart maxscaleUnderstand the routing logic of the readwritesplit router. This guide explains how MaxScale identifies write statements for the primary and distributes reads to replicas.
SET SESSION autocommit=OFF;
SELECT * FROM hq_sales.invoices WHERE branch_id=1;
INSERT INTO hq_sales.invoices
(customer_id, invoice_date, invoice_total, payment_method)
VALUES
(1, '2020-05-10 12:35:10', 1087.23, 'CREDIT_CARD');
COMMIT;BEGIN;
SELECT * FROM hq_sales.invoices WHERE branch_id=1;
INSERT INTO hq_sales.invoices
(customer_id, invoice_date, invoice_total, payment_method)
VALUES
(1, '2020-05-10 12:35:10', 1087.23, 'CREDIT_CARD');
COMMIT;SELECT @@global.alter_algorithm;
SELECT @@my_user_var;
SHOW statements