Step 7: Test MariaDB MaxScale
Overview
This page details step 7 of the 7-step procedure "Deploy Primary/Replica Topology".
This step tests MariaDB MaxScale.
Interactive commands are detailed. Alternatively, the described operations can be performed using automation.
Check Global Configuration
Use maxctrl show maxscale command to view the global MaxScale configuration.
This action is performed on the MaxScale node:
$ maxctrl show maxscale
ββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Version β 25.01.2 β
ββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Commit β 3761fa7a52046bc58faad8b5a139116f9e33364c β
ββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Started At β Thu, 05 Aug 2021 20:21:20 GMT β
ββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Activated At β Thu, 05 Aug 2021 20:21:20 GMT β
ββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Uptime β 868 β
ββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Config Sync β null β
ββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Parameters β { β
β β "admin_auth": true, β
β β "admin_enabled": true, β
β β "admin_gui": true, β
β β "admin_host": "0.0.0.0", β
β β "admin_log_auth_failures": true, β
β β "admin_pam_readonly_service": null, β
β β "admin_pam_readwrite_service": null, β
β β "admin_port": 8989, β
β β "admin_secure_gui": false, β
β β "admin_ssl_ca_cert": null, β
β β "admin_ssl_cert": null, β
β β "admin_ssl_key": null, β
β β "admin_ssl_version": "MAX", β
β β "auth_connect_timeout": "10000ms", β
β β "auth_read_timeout": "10000ms", β
β β "auth_write_timeout": "10000ms", β
β β "cachedir": "/var/cache/maxscale", β
β β "config_sync_cluster": null, β
β β "config_sync_interval": "5000ms", β
β β "config_sync_password": "*****", β
β β "config_sync_timeout": "10000ms", β
β β "config_sync_user": null, β
β β "connector_plugindir": "/usr/lib64/mysql/plugin", β
β β "datadir": "/var/lib/maxscale", β
β β "debug": null, β
β β "dump_last_statements": "never", β
β β "execdir": "/usr/bin", β
β β "language": "/var/lib/maxscale", β
β β "libdir": "/usr/lib64/maxscale", β
β β "load_persisted_configs": true, β
β β "local_address": null, β
β β "log_debug": false, β
β β "log_info": false, β
β β "log_notice": true, β
β β "log_throttling": { β
β β "count": 10, β
β β "suppress": 10000, β
β β "window": 1000 β
β β }, β
β β "log_warn_super_user": false, β
β β "log_warning": true, β
β β "logdir": "/var/log/maxscale", β
β β "max_auth_errors_until_block": 10, β
β β "maxlog": true, β
β β "module_configdir": "/etc/maxscale.modules.d", β
β β "ms_timestamp": false, β
β β "passive": false, β
β β "persistdir": "/var/lib/maxscale/maxscale.cnf.d", β
β β "piddir": "/var/run/maxscale", β
β β "query_classifier": "qc_sqlite", β
β β "query_classifier_args": null, β
β β "query_classifier_cache_size": 289073971, β
β β "query_retries": 1, β
β β "query_retry_timeout": "5000ms", β
β β "rebalance_period": "0ms", β
β β "rebalance_threshold": 20, β
β β "rebalance_window": 10, β
β β "retain_last_statements": 0, β
β β "session_trace": 0, β
β β "skip_permission_checks": false, β
β β "sql_mode": "default", β
β β "syslog": true, β
β β "threads": 1, β
β β "users_refresh_interval": "0ms", β
β β "users_refresh_time": "30000ms", β
β β "writeq_high_water": 16777216, β
β β "writeq_low_water": 8192 β
β β } β
ββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Output should align to the global MaxScale configuration in the new configuration file you created.
Check Server Configuration
Use the maxctrl list servers and maxctrl show server commands to view the configured server objects.
This action is performed on the MaxScale node:
Obtain the full list of servers objects:
$ maxctrl list servers
ββββββββββ¬ββββββββββββββ¬βββββββ¬ββββββββββββββ¬ββββββββββββββββββββββββββ¬βββββββ
β Server β Address β Port β Connections β State β GTID β
ββββββββββΌββββββββββββββΌβββββββΌββββββββββββββΌββββββββββββββββββββββββββΌβββββββ€
β node1 β 192.0.2.101 β 3306 β 0 β Slave, Synced, Running β β
ββββββββββΌββββββββββββββΌβββββββΌββββββββββββββΌββββββββββββββββββββββββββΌβββββββ€
β node2 β 192.0.2.102 β 3306 β 0 β Slave, Synced, Running β β
ββββββββββΌββββββββββββββΌβββββββΌββββββββββββββΌββββββββββββββββββββββββββΌβββββββ€
β node3 β 192.0.2.103 β 3306 β 0 β Master, Synced, Running β β
ββββββββββ΄ββββββββββββββ΄βββββββ΄ββββββββββββββ΄ββββββββββββββββββββββββββ΄βββββββ
For each server object, view the configuration:
$ maxctrl show server node3
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββ
β Server β node3 β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββ€
β Address β 192.0.2.103 β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββ€
β Port β 3306 β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββ€
β State β Master, Synced, Running β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββ€
β Version β 11.4.5-3-MariaDB-enterprise-log β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββ€
β Last Event β master_up β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββ€
β Triggered At β Thu, 05 Aug 2021 20:22:26 GMT β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββ€
β Services β connection_router_service β
β β query_router_service β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββ€
β Monitors β cluster_monitor β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββ€
β Master ID β -1 β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββ€
β Node ID β 1 β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββ€
β Slave Server IDs β β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββ€
β Current Connections β 1 β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββ€
β Total Connections β 1 β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββ€
β Max Connections β 1 β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββ€
β Statistics β { β
β β "active_operations": 0, β
β β "adaptive_avg_select_time": "0ns", β
β β "connection_pool_empty": 0, β
β β "connections": 1, β
β β "max_connections": 1, β
β β "max_pool_size": 0, β
β β "persistent_connections": 0, β
β β "reused_connections": 0, β
β β "routed_packets": 0, β
β β "total_connections": 1 β
β β } β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββ€
β Parameters β { β
β β "address": "192.0.2.103", β
β β "disk_space_threshold": null, β
β β "extra_port": 0, β
β β "monitorpw": null, β
β β "monitoruser": null, β
β β "persistmaxtime": "0ms", β
β β "persistpoolmax": 0, β
β β "port": 3306, β
β β "priority": 0, β
β β "proxy_protocol": false, β
β β "rank": "primary", β
β β "socket": null, β
β β "ssl": false, β
β β "ssl_ca_cert": null, β
β β "ssl_cert": null, β
β β "ssl_cert_verify_depth": 9, β
β β "ssl_cipher": null, β
β β "ssl_key": null, β
β β "ssl_verify_peer_certificate": false, β
β β "ssl_verify_peer_host": false, β
β β "ssl_version": "MAX" β
β β } β
βββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββ
Output should align to the Server Object configuration you performed.
Check Monitor Configuration
Use the maxctrl list monitors and maxctrl show monitor commands to view the configured monitors.
This action is performed on the MaxScale node:
Obtain the full list of monitors:
$ maxctrl list monitors
βββββββββββββββββββ¬ββββββββββ¬ββββββββββββββββββββββ
β Monitor β State β Servers β
βββββββββββββββββββΌββββββββββΌββββββββββββββββββββββ€
β cluster_monitor β Running β node1, node2, node3 β
βββββββββββββββββββ΄ββββββββββ΄ββββββββββββββββββββββ
For each monitor, view the monitor configuration:
$ maxctrl show monitor cluster_monitor
βββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Monitor β cluster_monitor β
βββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Module β galeramon β
βββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β State β Running β
βββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Servers β node1 β
β β node2 β
β β node3 β
βββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Parameters β { β
β β .. β
β β } β
βββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Monitor Diagnostics β { β
β β .. β
β β } β
βββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Output should align to the Galera Monitor (galeramon) configuration you performed.
Check Service Configuration
Use the maxctrl list services and maxctrl show service commands to view the configured routing services.
This action is performed on the MaxScale node:
Obtain the full list of routing services:
$ maxctrl list services
βββββββββββββββββββββββββββββ¬βββββββββββββββββ¬ββββββββββββββ¬ββββββββββββββββββββ¬ββββββββββββββββββββββ
β Service β Router β Connections β Total Connections β Servers β
βββββββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββββ€
β connection_router_service β readconnroute β 0 β 0 β node1, node2, node3 β
βββββββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββββ€
β query_router_service β readwritesplit β 1 β 1 β node1, node2, node3 β
βββββββββββββββββββββββββββββ΄βββββββββββββββββ΄ββββββββββββββ΄ββββββββββββββββββββ΄ββββββββββββββββββββββ
For each service, view the service configuration:
$ maxctrl show service query_router_service
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Service β query_router_service β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Router β readwritesplit β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β State β Started β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Started At β Thu Aug 5 20:23:38 2021 β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Current Connections β 1 β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Total Connections β 1 β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Max Connections β 1 β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Cluster β β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Servers β node1 β
β β node2 β
β β node3 β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Services β β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Filters β β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Parameters β { β
β β "auth_all_servers": false, β
β β "causal_reads": "false", β
β β "causal_reads_timeout": "10000ms", β
β β "connection_keepalive": "300000ms", β
β β "connection_timeout": "0ms", β
β β "delayed_retry": false, β
β β "delayed_retry_timeout": "10000ms", β
β β "disable_sescmd_history": false, β
β β "enable_root_user": false, β
β β "idle_session_pool_time": "-1000ms", β
β β "lazy_connect": false, β
β β "localhost_match_wildcard_host": true, β
β β "log_auth_warnings": true, β
β β "master_accept_reads": false, β
β β "master_failure_mode": "fail_instantly", β
β β "master_reconnection": false, β
β β "max_connections": 0, β
β β "max_sescmd_history": 50, β
β β "max_slave_connections": 255, β
β β "max_slave_replication_lag": "0ms", β
β β "net_write_timeout": "0ms", β
β β "optimistic_trx": false, β
β β "password": "*****", β
β β "prune_sescmd_history": true, β
β β "rank": "primary", β
β β "retain_last_statements": -1, β
β β "retry_failed_reads": true, β
β β "reuse_prepared_statements": false, β
β β "router": "readwritesplit", β
β β "session_trace": false, β
β β "session_track_trx_state": false, β
β β "slave_connections": 255, β
β β "slave_selection_criteria": "LEAST_CURRENT_OPERATIONS", β
β β "strict_multi_stmt": false, β
β β "strict_sp_calls": false, β
β β "strip_db_esc": true, β
β β "transaction_replay": false, β
β β "transaction_replay_attempts": 5, β
β β "transaction_replay_max_size": 1073741824, β
β β "transaction_replay_retry_on_deadlock": false, β
β β "type": "service", β
β β "use_sql_variables_in": "all", β
β β "user": "mxs", β
β β "version_string": null β
β β } β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Router Diagnostics β { β
β β "avg_sescmd_history_length": 0, β
β β "max_sescmd_history_length": 0, β
β β "queries": 1, β
β β "replayed_transactions": 0, β
β β "ro_transactions": 0, β
β β "route_all": 0, β
β β "route_master": 0, β
β β "route_slave": 1, β
β β "rw_transactions": 0, β
β β "server_query_statistics": [ β
β β { β
β β "avg_selects_per_session": 0, β
β β "avg_sess_duration": "0ns", β
β β "id": "node2", β
β β "read": 1, β
β β "total": 1, β
β β "write": 0 β
β β } β
β β ] β
β β } β
βββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Output should align to the Read Connection Router (readconnroute) or Read/Write Split Router (readwritesplit) configuration you performed.
Test Application User
Applications should use a dedicated user account. The user account must be created on the primary server.
When users connect to MaxScale, MaxScale authenticates the user connection before routing it to an Enterprise Server node. Enterprise Server authenticates the connection as originating from the IP address of the MaxScale node.
The application users must have one user account with the host IP address of the application server and a second user account with the host IP address of the MaxScale node.
The requirement of a duplicate user account can be avoided by enabling the proxy_protocol
parameter for MaxScale and the proxy_protocol_networks for Enterprise Server.
Create a User to Connect from MaxScale
This action is performed on any Enterprise Cluster node:
Connect to the node:
$ sudo mariadb
Create the database user account for your MaxScale node:
CREATE USER 'app_user'@'192.0.2.104' IDENTIFIED BY 'app_user_passwd';
Replace 192.0.2.104 with the relevant IP address specification for your MaxScale node.
Passwords should meet your organization's password policies.
Grant the privileges required by your application to the database user account for your MaxScale node:
GRANT ALL ON test.* TO 'app_user'@'192.0.2.104';
The privileges shown are designed to allow the tests in the subsequent sections to work. The user account for your production application may require different privileges.
Create a User to Connect from the Application Server
This action is performed on any Enterprise Cluster node:
Create the database user account for your application server:
CREATE USER 'app_user'@'192.0.2.11' IDENTIFIED BY 'app_user_passwd';
Replace 192.0.2.11 with the relevant IP address specification for your application server.
Passwords should meet your organization's password policies.
Grant the privileges required by your application to the database user account for your application server:
GRANT ALL ON test.* TO 'app_user'@'192.0.2.11';
The privileges shown are designed to allow the tests in the subsequent sections to work. The user account for your production application may require different privileges.
Test Connection with Application User
To test the connection, use the MariaDB Client from your application server to connect to an Enterprise Cluster node through MaxScale.
This action is performed on the application server:
$ mariadb --host 192.0.2.104 --port 3307
--user app_user --password
Test Connection with Read Connection Router
If you configured the Read Connection Router, confirm that MaxScale routes connections to the replica servers.
On the MaxScale node, use the maxctrl list listeners command to view the available listeners and ports:
$ maxctrl list listeners
ββββββββββββββββββββββββββββββ¬βββββββ¬βββββββ¬ββββββββββ¬ββββββββββββββββββββββββββββ
β Name β Port β Host β State β Service β
ββββββββββββββββββββββββββββββΌβββββββΌβββββββΌββββββββββΌββββββββββββββββββββββββββββ€
β connection_router_listener β 3308 β :: β Running β connection_router_service β
ββββββββββββββββββββββββββββββΌβββββββΌβββββββΌββββββββββΌββββββββββββββββββββββββββββ€
β query_router_listener β 3307 β :: β Running β query_router_service β
ββββββββββββββββββββββββββββββ΄βββββββ΄βββββββ΄ββββββββββ΄ββββββββββββββββββββββββββββ
Open multiple terminals connected to your application server, in each use MariaDB Client to connect to the listener port for the Read Connection Router (in the example 3308):
$ mariadb --host 192.0.2.104 --port 3308 \
--user app_user --password
Use the application user credentials you created for the --user
and --password
options.
In each terminal, query the hostname system variable to identify to which you're connected:
SELECT @@global.hostname;
+-------------------+
| @@global.hostname |
+-------------------+
| node2 |
+-------------------+
Different terminals should return different values since MaxScale routes the connections to different nodes.
Since the router was configured the slave router option, the Read Connection Router only routes connections to replica servers.
Test Write Queries with the Read/Write Split Router
If you configured the Read/Write Split Router, confirm that readwritesplit correctly routes write queries.
This action is performed with multiple client connections to the MaxScale node.
On the MaxScale node, use the maxctrl list servers command to identify the Enterprise Cluster node currently operating as the primary server:
$ maxctrl list servers
ββββββββββ¬ββββββββββββββ¬βββββββ¬ββββββββββββββ¬ββββββββββββββββββββββββββ¬βββββββ
β Server β Address β Port β Connections β State β GTID β
ββββββββββΌββββββββββββββΌβββββββΌββββββββββββββΌββββββββββββββββββββββββββΌβββββββ€
β node1 β 192.0.2.101 β 3306 β 0 β Slave, Synced, Running β β
ββββββββββΌββββββββββββββΌβββββββΌββββββββββββββΌββββββββββββββββββββββββββΌβββββββ€
β node2 β 192.0.2.102 β 3306 β 0 β Slave, Synced, Running β β
ββββββββββΌββββββββββββββΌβββββββΌββββββββββββββΌββββββββββββββββββββββββββΌβββββββ€
β node3 β 192.0.2.103 β 3306 β 0 β Master, Synced, Running β β
ββββββββββ΄ββββββββββββββ΄βββββββ΄ββββββββββββββ΄ββββββββββββββββββββββββββ΄βββββββ
The server listed as Master is currently operating as the primary server.
On the MaxScale node, use the maxctrl list listeners command to identify the correct listener port:
$ maxctrl list listeners galerarouter
ββββββββββββββββββββββββββββββ¬βββββββ¬ββββββββ¬ββββββββββ¬ββββββββββββββββββββββββββββ
β Name β Port β Host β State β Service β
ββββββββββββββββββββββββββββββΌβββββββΌββββββββΌββββββββββΌββββββββββββββββββββββββββββ€
β connection_router_listener β 3308 β β Running β connection_router_service β
β query_router_listener β 3307 β β Running β query_router_service β
ββββββββββββββββββββββββββββββ΄βββββββ΄ββββββββ΄ββββββββββ΄ββββββββββββββββββββββββββββ
In the example, the listener port for the Read/Write Split router is 3307.
Use the MariaDB Client to establish multiple connections to the listener configured for the Read/Write Split routing service,
query_router_listener
, on the MaxScale node:
$ mariadb --host=192.0.2.104 --port=3307 \
--user=app_user --password=app_user_passwd
The database user account for your application server should be specified by the --user
option.
Using any client connection, create a test table:
CREATE TABLE test.load_balancing_test (
id INT PRIMARY KEY AUTO_INCREMENT,
hostname VARCHAR(256)
);
Using each client connection, insert the values of the hostname system variable into the table using the INSERT statement to identify the node that executes the statement:
INSERT INTO test.load_balancing_test (hostname)
VALUES (@@global.hostname);
Using any client connection, query the table using the SELECT statement:
SELECT * FROM test.load_balancing_test;
+----+----------+
| id | hostname |
+----+----------+
| 1 | node3 |
| 4 | node3 |
| 7 | node3 |
+----+----------+
The output shows the hostname from the Enterprise Cluster node operating as the primary server. (Enterprise Cluster offsets auto-increment values by node to avoid write conflicts.)
Confirm that MaxScale is routing write queries to the Enterprise Cluster node operating as the primary server by checking that the test table only contains the hostname of the correct Enterprise Cluster node.
Test Read Queries with the Read/Write Split Router
If you configured the Read/Write Split Router, confirm that readwritesplit properly routes read queries to multiple replica servers.
This action is performed with multiple clients connected to the MaxScale node.
On the MaxScale node, use maxctrl list servers to identify the Enterprise Cluster nodes that are currently operating as replica servers:
$ maxctrl list servers
ββββββββββ¬ββββββββββββββ¬βββββββ¬ββββββββββββββ¬ββββββββββββββββββββββββββ¬βββββββ
β Server β Address β Port β Connections β State β GTID β
ββββββββββΌββββββββββββββΌβββββββΌββββββββββββββΌββββββββββββββββββββββββββΌβββββββ€
β node1 β 192.0.2.101 β 3306 β 0 β Slave, Synced, Running β β
ββββββββββΌββββββββββββββΌβββββββΌββββββββββββββΌββββββββββββββββββββββββββΌβββββββ€
β node2 β 192.0.2.102 β 3306 β 0 β Slave, Synced, Running β β
ββββββββββΌββββββββββββββΌβββββββΌββββββββββββββΌββββββββββββββββββββββββββΌβββββββ€
β node3 β 192.0.2.103 β 3306 β 0 β Master, Synced, Running β β
ββββββββββ΄ββββββββββββββ΄βββββββ΄ββββββββββββββ΄ββββββββββββββββββββββββββ΄βββββββ
The servers listed as Slave are currently operating as replica servers.
On the MaxScale node, use the maxctrl list listeners command to identify the correct listener port:
$ maxctrl list listeners
ββββββββββββββββββββββββββββββ¬βββββββ¬ββββββββ¬ββββββββββ¬ββββββββββββββββββββββββββββ
β Name β Port β Host β State β Service β
ββββββββββββββββββββββββββββββΌβββββββΌββββββββΌββββββββββΌββββββββββββββββββββββββββββ€
β connection_router_listener β 3308 β β Running β connection_router_service β
β query_router_listener β 3307 β β Running β query_router_service β
ββββββββββββββββββββββββββββββ΄βββββββ΄ββββββββ΄ββββββββββ΄ββββββββββββββββββββββββββββ
In the example, the listener port for the Read/Write Split router is 3307.
Use the MariaDB Client to establish multiple connections to
query_router_listener
which is the listener configured for the Read/Write Split routing service on the MaxScale node:
$ mariadb --host=192.0.2.104 --port=3307 \
--user=app_user --password=app_user_passwd
The database user account for your application server should be specified by the --user option.
Using each client connection, query the hostname system variable to identify the node that executes the statement:
SELECT @@global.hostname;
+-------------------+
| @@global.hostname |
+-------------------+
| node2 |
+-------------------+
Confirm that MaxScale routes the SELECT statements to different replica servers.
For more information on different routing criteria, see slave_selection_criteria
Next Step
Navigation in the procedure "Deploy Primary/Replica Topology":
This page was step 7 of 7.
This procedure is complete.
This page is: Copyright Β© 2025 MariaDB. All rights reserved.
Last updated
Was this helpful?