Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
This page details step 2 of the 7-step procedure "Deploy Primary/Replica Topology".
This step starts and configures a MariaDB Enterprise Server to operate as a primary server in MariaDB Replication.
Interactive commands are detailed. Alternatively, the described operations can be performed using automation.
The installation process might have started the Enterprise Server service. The service should be stopped prior to making configuration changes.
Stop the MariaDB Enterprise Server service:
Enterprise Server nodes require that you set the following system variables and options:
MariaDB Enterprise Server also supports .
Group commit can help performance by reducing I/O.
If you would like to configure parallel replication on replica servers, then you must also configure group commit on the primary server.
On each Enterprise Server node, edit a configuration file and set these system variables and options:
Set the server_id option to a value that is unique for each Enterprise Server node.
Start MariaDB Enterprise Server. If the Enterprise Server process is already running, restart it to apply the changes from the configuration file.
For additional information, see "".
The Primary/Replica topology requires several user accounts. Each user account should be created on the primary server, so that it is replicated to the replica servers.
Primary/Replica uses MariaDB Replication to replicate writes between the primary and replica servers. As MaxScale can promote a replica server to become a new primary in the event of node failure, all nodes must have a replication user.
The action is performed on the primary server.
Create the replication user and grant it the required privileges:
Use the CREATE USER statement to create replication user.
Replace the referenced IP address with the relevant address for your environment.
Ensure that the user account can connect to the primary server from each replica.
Grant the user account the required privileges with the GRANT statement.
The following privileges are required:
Use this username and password for the MASTER_USER and MASTER_PASSWORD in the CHANGE MASTER TO statement when configuring replica servers in Step 3.
Primary/Replica uses MariaDB MaxScale 25.01 to load balance between the nodes. MaxScale requires a database user to connect to the primary server when routing queries and to promote replicas in the event that the primary server fails.
This action is performed on the primary server.
Use the statement to create the MaxScale user:
Replace the referenced IP address with the relevant address for your environment.
Ensure that the user account can connect from the IP address of the MaxScale instance.
Use the statement to grant the privileges required by the router:
Use the statement to grant privileges required by the MariaDB Monitor.
The following privileges are required:
Navigation in the procedure "Deploy Primary/Replica Topology":
This page was step 2 of 7.
Next: Step 3: Start and Configure MariaDB Enterprise Server on Replica Servers
The network socket Enterprise Server listens on for incoming TCP/IP client connections. On Debian or Ubuntu, this system variable must be set to override the 127.0.0.1 default configuration.
Set this option to the file you want to use for the Binary Log. Setting this option enables binary logging.
Sets the numeric Server ID for this MariaDB Enterprise Server. The value set on this option must be unique to each node.
Sets the number of transactions that the server commits as a group to the binary log.
Sets the number of microseconds that the server waits for transactions to group commit before it commits the current group.
$ sudo systemctl stop mariadb[mariadb]
bind_address = 0.0.0.0
log_bin = mariadb-bin.log
server_id = 1$ systemctl start mariadbCREATE USER 'repl'@'192.0.2.%' IDENTIFIED BY 'repl_passwd';GRANT REPLICATION SLAVE,
REPLICATION CLIENT
ON *.* TO repl@'%';CREATE USER 'mxs'@'192.0.2.%'
IDENTIFIED BY 'mxs_passwd';GRANT SHOW DATABASES ON *.* TO 'mxs'@'192.0.2.%';
GRANT SELECT ON mysql.columns_priv TO 'mxs'@'192.0.2.%';
GRANT SELECT ON mysql.db TO 'mxs'@'192.0.2.%';
GRANT SELECT ON mysql.procs_priv TO 'mxs'@'192.0.2.%';
GRANT SELECT ON mysql.proxies_priv TO 'mxs'@'192.0.2.%';
GRANT SELECT ON mysql.roles_mapping TO 'mxs'@'192.0.2.%';
GRANT SELECT ON mysql.tables_priv TO 'mxs'@'192.0.2.%';
GRANT SELECT ON mysql.user TO 'mxs'@'192.0.2.%';GRANT SUPER,
REPLICATION CLIENT,
RELOAD,
PROCESS,
SHOW DATABASES,
EVENT
ON *.* TO 'mxs'@'192.0.2.%';This page details step 4 of the 7-step procedure "Deploy Primary/Replica Topology".
This step tests MariaDB Enterprise Server
Several actions require connection to MariaDB Enterprise Server. A command-line client (mariadb) was included with your ES installation. These instructions describe connection via Unix domain socket. Alternatively, a different client and connection method could be used.
Interactive commands are detailed. Alternatively, the described operations can be performed using automation.
Use Systemd to test whether the MariaDB Enterprise Server service is running.
This action is performed on each Enterprise Server node.
Check if the MariaDB Enterprise Server service is running by executing the following:
If the service is not running on any node, start the service by executing the following on that node:
Use to test the local connection to the Enterprise Server node.
This action is performed on each Enterprise Server node:
The sudo command is used here to connect to the Enterprise Server node using the root@localhost user account, which authenticates using the authentication plugin. Other user accounts can be used by specifying the --user and --password command-line options.
Use to check that replication is running properly on the replica servers.
This action is performed on each replica server.
Execute the following:
If Slave_IO_Running column is not Yes on any replica server, then check:
The network connectivity between the replica server and the primary server
The Last_IO_Error column for details on any errors
If Slave_SQL_Running column is not Yes on any replica server, then check:
The GTID position in
The Last_SQL_Error column for details on any errors
If both columns are not Yes on any replica server, then check:
The replication configuration on the replica server.
If you need to make any corrections, the slave threads can be restarted with .
Use to test DDL.
On the primary server, use the to connect to the node:
Create a test database and table:
On each replica server, use the to connect to the node:
Confirm that the database and table exist:
If the database or table do not exist on any node, then check the replication status on the node.
Use to test DML.
On the primary server, use the MariaDB Client to connect to the node:
Insert sample data into the table created in the DDL test:
On each replica server, use the to connect to the node:
Execute a query to retrieve the data:
If the data is not returned on any node, then check the replication status on the node.
Navigation in the procedure "Deploy Primary/Replica Topology":
This page was step 4 of 7.
Next: Step 5: Install MariaDB MaxScale
This page is: Copyright Β© 2025 MariaDB. All rights reserved.
This page is: Copyright Β© 2025 MariaDB. All rights reserved.
MariaDB Corporation provides package repositories for YUM (RHEL, CentOS), APT (Debian, Ubuntu), and ZYpp (SLES). A download token is required to access the MariaDB Enterprise Repository.
Customer Download Tokens are customer-specific and are available through the MariaDB Customer Portal.
To retrieve the token for your account:
Navigate to https://customers.mariadb.com/downloads/token/
Log in.
Copy the Customer Download Token.
Substitute your token for CUSTOMER_DOWNLOAD_TOKEN when configuring the package repositories.
On the MaxScale node, install the prerequisites for downloading the software from the Web.
Install on CentOS / RHEL (YUM):
Install on Debian / Ubuntu (APT):
Install on SLES (ZYpp):
On the MaxScale node, configure package repositories and specify MariaDB MaxScale 25.01:
Checksums of the various releases of the mariadb_es_repo_setup script can be found in the Versions section at the bottom of the MariaDB Package Repository Setup and Usage page. Substitute ${checksum} in the example above with the latest checksum.
On the MaxScale node, install MariaDB MaxScale.
Install on CentOS / RHEL (YUM):
Install on Debian / Ubuntu (APT):
Install on SLES (ZYpp):
Navigation in the procedure "Deploy Primary/Replica Topology":
This page was step 5 of 7.
Next: Step 6: Start and Configure MariaDB MaxScale
This page is: Copyright Β© 2025 MariaDB. All rights reserved.
$ systemctl status mariadb$ sudo systemctl start mariadb$ sudo mariadb
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 38
Server version: 11.4.5-3-MariaDB-Enterprise MariaDB Enterprise Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>SHOW REPLICA STATUS\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.0.2.1
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mariadb-bin.000001
Read_Master_Log_Pos: 645
Relay_Log_File: li282-189-relay-bin.000002
Relay_Log_Pos: 946
Relay_Master_Log_File: mariadb-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 645
Relay_Log_Space: 1259
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_SSL_Crl:
Master_SSL_Crlpath:
Using_Gtid: Slave_Pos
Gtid_IO_Pos: 0-1-2
Replicate_Do_Domain_Ids:
Replicate_Ignore_Domain_Ids:
Parallel_Mode: optimistic
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Slave_DDL_Groups: 2
Slave_Non_Transactional_Groups: 0
Slave_Transactional_Groups: 0$ sudo mariadbCREATE DATABASE IF NOT EXISTS test;
CREATE TABLE test.contacts (
id INT PRIMARY KEY AUTO_INCREMENT,
first_name VARCHAR(50),
last_name VARCHAR(50),
email VARCHAR(100)
);$ sudo mariadbSHOW CREATE TABLE test.contacts\G;$ sudo mariadbINSERT INTO test.contacts (first_name, last_name, email)
VALUES
("Kai", "Devi", "kai.devi@example.com"),
("Lee", "Wang", "lee.wang@example.com");$ sudo mariadbSELECT * FROM test.contacts;
+----+------------+-----------+----------------------+
| id | first_name | last_name | email |
+----+------------+-----------+----------------------+
| 1 | Kai | Devi | kai.devi@example.com |
| 2 | Lee | Wang | lee.wang@example.com |
+----+------------+-----------+----------------------+$ sudo yum install curl$ sudo apt install curl apt-transport-https$ sudo zypper install curl$ curl -LsSO https://dlm.mariadb.com/enterprise-release-helpers/mariadb_es_repo_setup
$ echo "${checksum} mariadb_es_repo_setup" \
| sha256sum -c -
$ chmod +x mariadb_es_repo_setup
$ sudo ./mariadb_es_repo_setup --token="CUSTOMER_DOWNLOAD_TOKEN" --apply \
--skip-server \
--skip-tools \
--mariadb-maxscale-version="25.01"$ sudo yum install maxscale$ sudo apt install maxscale$ sudo zypper install maxscaleThis page details step 1 of the 7-step procedure "Deploy Primary/Replica Topology".
This step installs MariaDB Enterprise Server
The Primary/Replica topology requires 3 or more MariaDB Enterprise Server nodes for High Availability (HA). Nodes must meet requirements.
Interactive commands are detailed. Alternatively, the described operations can be performed using automation.
MariaDB Corporation provides package repositories for CentOS / RHEL (YUM) and Debian / Ubuntu (APT). A download token is required to access the MariaDB Enterprise Repository.
Customer Download Tokens are customer-specific and are available through the MariaDB Customer Portal.
To retrieve the token for your account:
Navigate to
Log in.
Copy the Customer Download Token.
Substitute your token for CUSTOMER_DOWNLOAD_TOKEN when configuring the package repositories.
On each Enterprise ColumnStore node, install the prerequisites for downloading the software from the Web. Install on CentOS / RHEL (YUM):
Install on Debian / Ubuntu (APT):
On each Enterprise ColumnStore node, configure package repositories and specify Enterprise Server:
Checksums of the various releases of the mariadb_es_repo_setup script can be found in the section at the bottom of the page. Substitute ${checksum} in the example above with the latest checksum.
On each Enterprise Cluster node, install MariaDB Enterprise Server and MariaDB Enterprise Backup.
Install via CentOS / RHEL (YUM):
Install via Debian / Ubuntu (APT):
Install via SLES (ZYpp):
Navigation in the procedure "Deploy Primary/Replica Topology":
This page was step 1 of 7.
Next: Step 2: Start and Configure MariaDB Enterprise Server on Primary Server
This page is: Copyright Β© 2025 MariaDB. All rights reserved.
$ sudo yum install curl$ sudo apt install curl apt-transport-https$ curl -LsSO https://dlm.mariadb.com/enterprise-release-helpers/mariadb_es_repo_setup$ echo "${checksum} mariadb_es_repo_setup" \
| sha256sum -c -$ chmod +x mariadb_es_repo_setup$ sudo ./mariadb_es_repo_setup --token="CUSTOMER_DOWNLOAD_TOKEN" --apply \
--skip-maxscale \
--skip-tools \
--mariadb-server-version="11.4"$ sudo yum install MariaDB-server MariaDB-backup$ sudo apt update
$ sudo apt install mariadb-server mariadb-backup$ sudo zypper install MariaDB-server MariaDB-backupThis page explains how to set up a standard Primary/Replica replication topology for MariaDB Enterprise Server.
Enterprise Server 10.4
Enterprise Server 10.5
Enterprise Server 10.6
Enterprise Server 11.4
This procedure describes the deployment of the Primary/Replica topology with MariaDB Enterprise Server and MariaDB MaxScale.
Primary/Replica topology provides read scalability and fault tolerance through asynchronous or semi-synchronous single-primary replication.
This procedure has 7 steps, which are executed in sequence.
MariaDB products can be deployed in many different topologies to suit specific use cases. The Primary/Replica topology can be deployed on its own or integrated with MariaDB Enterprise Cluster.
This procedure represents basic product capability with 3 Enterprise Server nodes and 1 MaxScale node.
This page provides an overview of the topology, requirements, and deployment procedure.
Please read and understand this procedure before executing.
The following components are deployed during this procedure:
Primary/Replica topology provides read scalability and fault tolerance through asynchronous or semi-synchronous single-primary replication of MariaDB Enterprise Server 11.4
The Primary/Replica topology consists of:
1 or more MaxScale nodes
1 Enterprise Server node operating as the primary server
2 or more Enterprise Server nodes operating as replica servers.
The MaxScale nodes:
Monitor the health and availability of the Enterprise Server nodes
Route queries to Enterprise Server nodes using Read/Write Split (readwritesplit) and Read Connection (readconnroute) routers.
Promote replica servers in the event that the primary server fails.
The Enterprise Server node is operating as the primary server:
Receives write queries from MaxScale, logging them to the Binary Log
Provides Binary Logs to replica servers for replication
The Enterprise Server nodes are operating as replica servers:
Receive read queries from MaxScale
Replicate writes asynchronously or semi-synchronously from the primary server
These requirements are for the Primary/Replica topology when deployed with MariaDB Enterprise Server 11.4 and MariaDB MaxScale 25.01.
In alignment to the , the Primary/Replica topology with MariaDB Enterprise Server 11.4 and MariaDB MaxScale 25.01 is provided for:
AlmaLinux 8 (x86_64, ARM64)
AlmaLinux 9 (x86_64, ARM64)
Debian 11 (x86_64, ARM64)
Debian 12 (x86_64, ARM64)
MariaDB Enterprise Server packages are configured to read configuration files from different paths, depending on the operating system. Making custom changes to Enterprise Server default configuration files is not recommended because custom changes may be overwritten by other default configuration files that are loaded later.
To ensure that your custom changes will be read last, create a custom configuration file with the z- prefix in one of the include directories.
The systemctl command is used to start and stop the MariaDB Enterprise Server service.
For additional information, see "".
MariaDB Enterprise Server produces log data that can be helpful in problem diagnosis.
Log filenames and locations may be overridden in the server configuration. The default location of logs is the data directory. The data directory is specified by the system variable.
MaxScale can be configured using several methods. These methods make use of MaxScale's .
The procedure on these pages configures MaxScale using MaxCtrl.
The systemctl command is used to start and stop the MaxScale service.
For additional information, see "".
Navigation in the procedure :
Next:
This page is: Copyright Β© 2025 MariaDB. All rights reserved.\
Test MariaDB MaxScale
Red Hat Enterprise Linux 8 (x86_64, ARM64)
Red Hat Enterprise Linux 9 (x86_64, PPC64LE, ARM64)
Red Hat UBI 8 (x86_64, ARM64)
Rocky Linux 8 (x86_64, ARM64)
Rocky Linux 9 (x86_64, ARM64)
SUSE Linux Enterprise Server 15 (x86_64, ARM64)
Ubuntu 20.04 LTS (x86_64, ARM64)
Ubuntu 22.04 LTS (x86_64, ARM64)
Ubuntu 24.04 LTS (x86_64, ARM64)
<hostname>-bin
MariaDB Replication
Highly available
Asynchronous or semi-synchronous replication
Automatic failover via MaxScale
Manual provisioning of new nodes from backup
Scales reads via MaxScale
Enterprise Server 10.3+, MaxScale 2.5+
Install MariaDB Enterprise Server
Start and Configure MariaDB Enterprise Server on Primary Server
Start and Configure MariaDB Enterprise Server on Replica Servers
Test MariaDB Enterprise Server
Install MariaDB MaxScale
Start and Configure MariaDB MaxScale
Modern SQL RDBMS with high availability, pluggable storage engines, hot online backups, and audit logging.
Database proxy that extends the availability, scalability, and security of MariaDB Enterprise Servers
General purpose storage engine
ACID-compliant
Performance
Listener
Listens for client connections to MaxScale, then passes them to the router service associated with the listener
MariaDB Monitor
Tracks changes in the state of MariaDB Enterprise Servers.
Read Connection Router
Routes connections from the listener to any available Enterprise Server node
Read/Write Split Router
Routes read operations from the listener to any available Enterprise Server node, and routes write operations from the listener to a specific server operating as the primary server
Server Module
Connection configuration in MaxScale to an Enterprise Server node
maxscale
MaxScale process owner
mysql
Enterprise Server process owner
Configuration File
Configuration files (such as /etc/my.cnf) can be used to set system-variables and options. The server must be restarted to apply changes made to configuration files.
Command-line
The server can be started with command-line options that set system-variables and options.
SQL
Users can set system-variables that support dynamic changes on-the-fly using the SET statement.
CentOS
Red Hat Enterprise Linux (RHEL)
SUSE Linux Enterprise Server (SLES)
/etc/my.cnf.d/z-custom-mariadb.cnf
Debian
Ubuntu
/etc/mysql/mariadb.conf.d/z-custom-mariadb.cnf
Start
sudo systemctl start mariadb
Stop
sudo systemctl stop mariadb
Restart
sudo systemctl restart mariadb
Enable during startup
sudo systemctl enable mariadb
Disable during startup
sudo systemctl disable mariadb
Status
sudo systemctl status mariadb
<hostname>.err
server_audit.log
<hostname>-slow.log
Command-line utility to perform administrative tasks through the REST API. See MaxCtrl Commands.
MaxGUI is a graphical utility that can perform administrative tasks through the REST API.
The REST API can be used directly. For example, the curl utility could be used to make REST API calls from the command-line. Many programming languages also have libraries to interact with REST APIs.
Start
sudo systemctl start maxscale
Stop
sudo systemctl stop maxscale
Restart
sudo systemctl restart maxscale
Enable during startup
sudo systemctl enable maxscale
Disable during startup
sudo systemctl disable maxscale
Status
sudo systemctl status maxscale
<hostname>.log
This page details step 3 of the 7-step procedure "Deploy Primary/Replica Topology".
This page starts and configures a MariaDB Enterprise Server 11.4 to operate as a replica server in MariaDB Replication.
Interactive commands are detailed. Alternatively, the described operations can be performed using automation.
The installation process might have started the Enterprise Server service. The service should be stopped prior to making configuration changes.
On each Enterprise Server node, stop the MariaDB Enterprise Server service:
Enterprise Server nodes require that you set the following system variables and options:
MariaDB Enterprise Server also supports group commit.
Writes to the primary server that are group committed or logged with a Global Transaction ID in different replication domains can be applied on the replica server using parallel threads to improve performance.
On each Enterprise Server node, edit a configuration file and set these system variables and options:
Set the server_id option to a value that is unique for each Enterprise Server node.
When deploying a new replica server to an existing system, back up the primary server and restore it on the replica server to initialize the database.
Use to back up the primary server.
On the primary server, take a full backup:
Confirm successful completion of the backup operation.
On the primary server, prepare the backup:
Confirm successful completion of the prepare operation.
On the primary server, copy the backup directory to each replica server:
On the replica server, move the default to another location:
On the replica server, use to restore the backup to the :
On the replica server, set the file permissions for the :
Start MariaDB Enterprise Server. If the Enterprise Server process is already running, restart it to apply the changes from the configuration file.
For additional information, see "".
If the replica server was restored from a backup of the primary, set the GTID position.
Get the GTID position that corresponds to the restored backup. This can be found in the xtrabackup_binlong_info file.
The GTID position from the above output is 0-1-2001,1-2-5139.
Connect to the replica server:
Set the system variable to the GTID position:
Execute the CHANGE MASTER TO statement to configure the replica server to connect to the primary server at this position:
The above statement configures the replica server to connect to a primary server located at 192.0.2.10 using the repl user account. This account must first be configured on the primary server.
Use the statement to start replication:
Use statement to confirm replication is running:
Navigation in the procedure "Deploy Primary/Replica Topology":
This page was step 3 of 7.
Next: Step 4: Test MariaDB Enterprise Server
The network socket Enterprise Server listens on for incoming TCP/IP client connections. On Debian or Ubuntu, this system variable must be set to override the 127.0.0.1 default configuration.
Enables binary logging and sets the name of the binlog file.
Unique numeric identifier for each Enterprise Server node.
Sets the number of threads the replica server uses to apply replication events in parallel. Use a non-zero value to enable Parallel Replication.
Sets how the replica server applies replicated transactions.
This page is: Copyright Β© 2025 MariaDB. All rights reserved.
$ sudo systemctl stop mariadb[mariadb]
bind_address = 0.0.0.0
log_bin = mariadb-bin.log
server_id = 1$ sudo mariadb-backup --backup \
--user=mariadb-backup_user \
--password=mariadb-backup_passwd \
--target-dir=/data/backup/replica_backup$ sudo mariadb-backup --prepare \
--target-dir=/data/backup/replica_backup$ sudo rsync -av /data/backup/replica_backup 192.0.2.11:/data/backup/$ sudo mv /var/lib/mysql /var/lib/mysql_backup$ sudo mariadb-backup --copy-back \
--target-dir=/data/backup/replica_backup$ sudo chown -R mysql:mysql /var/lib/mysql$ systemctl start mariadb$ cat xtrabackup_binlog_info
mariadb-bin.000096 568 0-1-2001,1-2-5139$ sudo mariadbSET GLOBAL gtid_slave_pos='0-1-2001,1-2-5139';CHANGE MASTER TO
MASTER_USER = "repl",
MASTER_HOST = "192.0.2.10",
MASTER_PASSWORD = "repl_passwd",
MASTER_USE_GTID = slave_pos;START REPLICA;SHOW REPLICA STATUS\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.0.2.10
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mariadb-bin.000001
Read_Master_Log_Pos: 645
Relay_Log_File: li282-189-relay-bin.000002
Relay_Log_Pos: 946
Relay_Master_Log_File: mariadb-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 645
Relay_Log_Space: 1259
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_SSL_Crl:
Master_SSL_Crlpath:
Using_Gtid: Slave_Pos
Gtid_IO_Pos: 0-1-2
Replicate_Do_Domain_Ids:
Replicate_Ignore_Domain_Ids:
Parallel_Mode: optimistic
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Slave_DDL_Groups: 2
Slave_Non_Transactional_Groups: 0
Slave_Transactional_Groups: 0MariaDB MaxScale installations include a configuration file with some example objects. This configuration file should be replaced.
On the MaxScale node, replace the default /etc/maxscale.cnf with the following configuration:
For additional information, see "".
On the MaxScale node, restart the MaxScale service to ensure that MaxScale picks up the new configuration:
For additional information, see "Starting and Stopping MariaDB".
On the MaxScale node, use maxctrl create server to create a server object for each MariaDB Enterprise Server:
MaxScale uses monitors to retrieve additional information from the servers. This information is used by other services in filtering and routing connections based on the current state of the node. For MariaDB Replication, use the MariaDB Monitor (mariadbmon).
On the MaxScale node, use maxctrl create monitor to create a MariaDB Monitor:
In this example:
mdb_monitor is an arbitrary name that is used to identify the new monitor.
mariadbmon is the name of the module that implements the MariaDB Monitor.
user=MAXSCALE_USER sets the user parameter to the database user account that MaxScale uses to monitor the ES nodes.
password='MAXSCALE_USER_PASSWORD' sets the password parameter to the password used by the database user account that MaxScale uses to monitor the ES nodes.
replication_user=REPLICATION_USER sets the replication_user parameter to the database user account that MaxScale uses to setup replication.
replication_password='REPLICATION_USER_PASSWORD' sets the replication_password parameter to the password used by the database user account that MaxScale uses to setup replication.
--servers sets the servers parameter to the set of nodes that MaxScale should monitor. All non-option arguments after --servers are interpreted as server names.
Other Module Parameters supported by mariadbmon in MaxScale can also be specified.
Routers control how MaxScale balances the load between Enterprise Server nodes. Each router uses a different approach to routing queries. Consider the specific use case of your application and database load and select the router that best suits
Connection-based load balancing
Routes connections to Enterprise ColumnStore nodes designated as replica servers for a read-only pool
Routes connections to an Enterprise ColumnStore node designated as the primary server for a read-write pool.
Query-based load balancing
Routes write queries to an Enterprise ColumnStore node designated as the primary server
Routes read queries to Enterprise ColumnStore node designated as replica servers
Automatically reconnects after node failures
Automatically replays transactions after node failures
Use MaxScale Read Connection Router (readconnroute) to route connections to replica servers for a read-only pool.
On the MaxScale node, use maxctrl create service to create a router:
In this example:
connection_router_service is an arbitrary name that is used to identify the new service.
readconnroute is the name of the module that implements the Read Connection Router.
user=MAXSCALE_USER sets the user parameter to the database user account that MaxScale uses to connect to the ES nodes.
password=MAXSCALE_USER_PASSWORD sets the password parameter to the password used by the database user account that MaxScale uses to connect to the ES nodes.
router_options=slave sets the router_options parameter to slave, so that MaxScale only routes connections to the replica nodes.
--servers sets the servers parameter to the set of nodes to which MaxScale should route connections. All non-option arguments after --serversare interpreted as server names.
Other Module Parameters supported by readconnroute in MaxScale 25.01 can also be specified.
These instructions reference TCP port 3308. You can use a different TCP port. The TCP port used must not be bound by any other listener.
On the MaxScale node, use the maxctrl create listener command to configure MaxScale to use a listener for the Read Connection Router (readconnroute):
In this example:
connection_router_service is the name of the readconnroute service that was previously created.
connection_router_listener is an arbitrary name that is used to identify the new listener.
3308 is the TCP port.
protocol=MariaDBClient sets the protocol parameter.
Other Module Parameters supported by listeners in MaxScale can also be specified.
MaxScale Read/Write Split Router (readwritesplit) performs query-based load balancing. The router routes write queries to the primary and read queries to the replicas.
On the MaxScale node, use the maxctrl create service command to configure MaxScale to use the Read/Write Split Router (readwritesplit):
In this example:
query_router_service is an arbitrary name that is used to identify the new service.
readwritesplit is the name of the module that implements the Read/Write Split Router.
user=MAXSCALE_USER sets the user parameter to the database user account that MaxScale uses to connect to the ES nodes.
password=MAXSCALE_USER_PASSWORD sets the password parameter to the password used by the database user account that MaxScale uses to connect to the ES nodes.
--servers sets the servers parameter to the set of nodes to which MaxScale should route queries. All non-option arguments after --servers are interpreted as server names.
Other Module Parameters supported by readwritesplit in MaxScale can also be specified.
These instructions reference TCP port 3307. You can use a different TCP port. The TCP port used must not be bound by any other listener.
On the MaxScale node, use the maxctrl create listener command to configure MaxScale to use a listener for the Read/Write Split Router (readwritesplit):
In this example:
query_router_service is the name of the readwritesplit service that was previously created.
query_router_listener is an arbitrary name that is used to identify the new listener.
3307 is the TCP port.
protocol=MariaDBClient sets the protocol parameter.
Other Module Parameters supported by listeners in MaxScale can also be specified.
To start the services and monitors, on the MaxScale node use maxctrl start services:
Navigation in the procedure "Deploy Primary/Replica Topology":
This page was step 6 of 7.
Next: Step 7: Test MariaDB MaxScale
This page is: Copyright Β© 2025 MariaDB. All rights reserved.
[maxscale]
threads = auto
admin_host = 0.0.0.0
admin_secure_gui = false$ sudo systemctl restart maxscale$ maxctrl create server node1 192.0.2.101
$ maxctrl create server node2 192.0.2.102
$ maxctrl create server node3 192.0.2.103$ maxctrl create monitor mdb_monitor mariadbmon \
user=mxs \
password='MAXSCALE_USER_PASSWORD' \
replication_user=repl \
replication_password='REPLICATION_USER_PASSWORD' \
--servers node1 node2 node3$ maxctrl create service connection_router_service readconnroute \
user=mxs \
password='MAXSCALE_USER_PASSWORD' \
router_options=slave \
--servers node1 node2 node3$ maxctrl create listener connection_router_service connection_router_listener 3308 \
protocol=MariaDBClient$ maxctrl create service query_router_service readwritesplit \
user=mxs \
password='MAXSCALE_USER_PASSWORD' \
--servers node1 node2 node3$ maxctrl create listener query_router_service query_router_listener 3307 \
protocol=MariaDBClient$ maxctrl start servicesOptionally enforces causal reads
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.
Use command to view the global MaxScale configuration.
This action is performed on the MaxScale node:
Output should align to the global MaxScale configuration in the new configuration file you created.
Use the and commands to view the configured server objects.
This action is performed on the MaxScale node:
Obtain the full list of servers objects:
For each server object, view the configuration:
Output should align to the Server Object configuration you performed.
Use the and commands to view the configured monitors.
This action is performed on the MaxScale node:
Obtain the full list of monitors:
For each monitor, view the monitor configuration:
Output should align to the Galera Monitor (galeramon) configuration you performed.
Use the and commands to view the configured routing services.
This action is performed on the MaxScale node:
Obtain the full list of routing services:
For each service, view the service configuration:
Output should align to the Read Connection Router (readconnroute) or Read/Write Split Router (readwritesplit) configuration you performed.
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.
This action is performed on any Enterprise Cluster node:
Connect to the node:
Create the database user account for your MaxScale node:
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:
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.
This action is performed on any Enterprise Cluster node:
Create the database user account for your application server:
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:
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.
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:
If you configured the Read Connection Router, confirm that MaxScale routes connections to the replica servers.
On the MaxScale node, use the command to view the available listeners and ports:
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):
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:
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.
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 command to identify the Enterprise Cluster node currently operating as the primary server:
The server listed as Master is currently operating as the primary server.
On the MaxScale node, use the command to identify the correct listener port:
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:
The database user account for your application server should be specified by the --user option.
Using any client connection, create a test table:
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:
Using any client connection, query the table using the SELECT statement:
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.
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 to identify the Enterprise Cluster nodes that are currently operating as replica servers:
The servers listed as Slave are currently operating as replica servers.
On the MaxScale node, use the command to identify the correct listener port:
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:
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:
Confirm that MaxScale routes the SELECT statements to different replica servers.
For more information on different routing criteria, see slave_selection_criteria
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.
$ 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 β
β β } β
ββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ$ 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 β β
ββββββββββ΄ββββββββββββββ΄βββββββ΄ββββββββββββββ΄ββββββββββββββββββββββββββ΄βββββββ$ 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" β
β β } β
βββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββ$ maxctrl list monitorsβββββββββββββββββββ¬ββββββββββ¬ββββββββββββββββββββββ
β Monitor β State β Servers β
βββββββββββββββββββΌββββββββββΌββββββββββββββββββββββ€
β cluster_monitor β Running β node1, node2, node3 β
βββββββββββββββββββ΄ββββββββββ΄ββββββββββββββββββββββ$ maxctrl show monitor cluster_monitorβββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Monitor β cluster_monitor β
βββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Module β galeramon β
βββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β State β Running β
βββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Servers β node1 β
β β node2 β
β β node3 β
βββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Parameters β { β
β β .. β
β β } β
βββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Monitor Diagnostics β { β
β β .. β
β β } β
βββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββββββββ$ 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 β
βββββββββββββββββββββββββββββ΄βββββββββββββββββ΄ββββββββββββββ΄ββββββββββββββββββββ΄ββββββββββββββββββββββ$ 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 β
β β } β
β β ] β
β β } β
βββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ$ sudo mariadbCREATE USER 'app_user'@'192.0.2.104' IDENTIFIED BY 'app_user_passwd';GRANT ALL ON test.* TO 'app_user'@'192.0.2.104';CREATE USER 'app_user'@'192.0.2.11' IDENTIFIED BY 'app_user_passwd';GRANT ALL ON test.* TO 'app_user'@'192.0.2.11';$ mariadb --host 192.0.2.104 --port 3307
--user app_user --password$ maxctrl list listenersββββββββββββββββββββββββββββββ¬βββββββ¬βββββββ¬ββββββββββ¬ββββββββββββββββββββββββββββ
β Name β Port β Host β State β Service β
ββββββββββββββββββββββββββββββΌβββββββΌβββββββΌββββββββββΌββββββββββββββββββββββββββββ€
β connection_router_listener β 3308 β :: β Running β connection_router_service β
ββββββββββββββββββββββββββββββΌβββββββΌβββββββΌββββββββββΌββββββββββββββββββββββββββββ€
β query_router_listener β 3307 β :: β Running β query_router_service β
ββββββββββββββββββββββββββββββ΄βββββββ΄βββββββ΄ββββββββββ΄ββββββββββββββββββββββββββββ$ mariadb --host 192.0.2.104 --port 3308 \
--user app_user --passwordSELECT @@global.hostname;
+-------------------+
| @@global.hostname |
+-------------------+
| node2 |
+-------------------+$ 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 β β
ββββββββββ΄ββββββββββββββ΄βββββββ΄ββββββββββββββ΄ββββββββββββββββββββββββββ΄βββββββ$ 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 β
ββββββββββββββββββββββββββββββ΄βββββββ΄ββββββββ΄ββββββββββ΄ββββββββββββββββββββββββββββ$ mariadb --host=192.0.2.104 --port=3307 \
--user=app_user --password=app_user_passwdCREATE TABLE test.load_balancing_test (
id INT PRIMARY KEY AUTO_INCREMENT,
hostname VARCHAR(256)
);INSERT INTO test.load_balancing_test (hostname)
VALUES (@@global.hostname);SELECT * FROM test.load_balancing_test;+----+----------+
| id | hostname |
+----+----------+
| 1 | node3 |
| 4 | node3 |
| 7 | node3 |
+----+----------+$ 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 β β
ββββββββββ΄ββββββββββββββ΄βββββββ΄ββββββββββββββ΄ββββββββββββββββββββββββββ΄βββββββ$ maxctrl list listenersββββββββββββββββββββββββββββββ¬βββββββ¬ββββββββ¬ββββββββββ¬ββββββββββββββββββββββββββββ
β Name β Port β Host β State β Service β
ββββββββββββββββββββββββββββββΌβββββββΌββββββββΌββββββββββΌββββββββββββββββββββββββββββ€
β connection_router_listener β 3308 β β Running β connection_router_service β
β query_router_listener β 3307 β β Running β query_router_service β
ββββββββββββββββββββββββββββββ΄βββββββ΄ββββββββ΄ββββββββββ΄ββββββββββββββββββββββββββββ$ mariadb --host=192.0.2.104 --port=3307 \
--user=app_user --password=app_user_passwdSELECT @@global.hostname;
+-------------------+
| @@global.hostname |
+-------------------+
| node2 |
+-------------------+
