Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
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.
Automate recovery after primary failure. This guide explains how to use the master_reconnection parameter to seamlessly move client connections to a new primary server.
Preserve session context across connections. Learn how MaxScale's session command history replays SET statements on new replica connections to maintain state consistency.
Handle transient failures gracefully. Learn to configure the delayed_retry parameter to pause and retry queries when backend servers are temporarily unavailable.
Optimize applications for read-write splitting. This guide outlines best practices for transaction management and connection handling to ensure compatibility with MaxScale.
[split-router]
type = service
router = readwritesplit
...
retry_failed_reads = true$ sudo systemctl restart maxscale[split-router]
type = service
router = readwritesplit
...
master_reconnection = true
master_failure_mode = fail_on_write$ sudo systemctl restart maxscaleCustomize load balancing algorithms. Explore options for the slave_selection_criteria parameter, including adaptive routing and least-global-connections strategies.
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');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 maxscale[split-router]
type = service
router = readwritesplit
...
transaction_replay = true
transaction_replay_max_size = 10Mi
transaction_replay_attempts = 10
transaction_replay_retry_on_deadlock = true$ sudo systemctl restart maxscale$ 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 maxscale[split-router]
type = service
router = readwritesplit
...
delayed_retry = true
delayed_retry_timeout = 30s[split-router]
type = service
router = readwritesplit
...
slave_selection_criteria = LEAST_GLOBAL_CONNECTIONS$ 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.
QUIT, PING, STMT RESET, and CHANGE USER.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