Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Configure the mariadbmon module to monitor primary-replica clusters. Learn to set monitoring intervals and define user credentials for health checks.
Build a resilient replication cluster. This guide explains how to combine MaxScale's failover with semi-synchronous replication to minimize data loss during crashes.
Authenticate users via Pluggable Authentication Modules (PAM). This reference details the PAMAuth module, supporting standard passwords, two-factor authentication, and SUID mode.
CREATE USER 'monitor_user'@'%' IDENTIFIED BY 'my_password';
GRANT REPLICA MONITOR ON *.* TO 'monitor_user'@'%';$ maxctrl list servers
┌──────────┬─────────────────┬──────┬─────────────┬────────┬────────────────────┬─────────┬──────────┐
│ Server │ Address │ Port │ Connections │ Status │ Status Info │ GTID │ Monitor │
├──────────┼─────────────────┼──────┼─────────────┼────────┼────────────────────┼─────────┼──────────┤
│ server1 │ 192.168.121.51 │ 3306 │ 0 │ Write │ Down │ 1-1-101 │ Monitor1 │
├──────────┼─────────────────┼──────┼─────────────┼────────┼────────────────────┼─────────┼──────────┤
│ server2 │ 192.168.121.190 │ 3306 │ 0 │ Read │ Replica, read_only │ 1-1-100 │ Monitor1 │
├──────────┼─────────────────┼──────┼─────────────┼────────┼────────────────────┼─────────┼──────────┤
│ server3 │ 192.168.121.112 │ 3306 │ 0 │ Read │ Replica, read_only │ 1-1-100 │ Monitor1 │
└──────────┴─────────────────┴──────┴─────────────┴────────┴────────────────────┴─────────┴──────────┘$ maxctrl list servers
┌──────────┬─────────────────┬──────┬─────────────┬────────┬────────────────────┬─────────┬──────────┐
│ Server │ Address │ Port │ Connections │ Status │ Status Info │ GTID │ Monitor │
├──────────┼─────────────────┼──────┼─────────────┼────────┼────────────────────┼─────────┼──────────┤
│ server1 │ 192.168.121.51 │ 3306 │ 0 │ Up │ │ 1-1-101 │ Monitor1 │
├──────────┼─────────────────┼──────┼─────────────┼────────┼────────────────────┼─────────┼──────────┤
│ server2 │ 192.168.121.190 │ 3306 │ 0 │ Write │ Primary │ 1-2-102 │ Monitor1 │
├──────────┼─────────────────┼──────┼─────────────┼────────┼────────────────────┼─────────┼──────────┤
│ server3 │ 192.168.121.112 │ 3306 │ 0 │ Read │ Replica, read_only │ 1-2-102 │ Monitor1 │
└──────────┴─────────────────┴──────┴─────────────┴────────┴────────────────────┴─────────┴──────────┘rpl_semi_sync_master_enabled=ON
rpl_semi_sync_slave_enabled=ONrpl_semi_sync_master_wait_point=AFTER_SYNCinit-rpl-role=SLAVE$ maxctrl list servers
┌──────────┬─────────────────┬──────┬─────────────┬────────┬────────────────────┬─────────┬──────────┐
│ Server │ Address │ Port │ Connections │ Status │ Status Info │ GTID │ Monitor │
├──────────┼─────────────────┼──────┼─────────────┼────────┼────────────────────┼─────────┼──────────┤
│ server1 │ 192.168.121.51 │ 3306 │ 0 │ Write │ Primary │ 1-1-100 │ Monitor1 │
├──────────┼─────────────────┼──────┼─────────────┼────────┼────────────────────┼─────────┼──────────┤
│ server2 │ 192.168.121.190 │ 3306 │ 0 │ Read │ Replica, read_only │ 1-1-101 │ Monitor1 │
├──────────┼─────────────────┼──────┼─────────────┼────────┼────────────────────┼─────────┼──────────┤
│ server3 │ 192.168.121.112 │ 3306 │ 0 │ Read │ Replica, read_only │ 1-1-101 │ Monitor1 │
└──────────┴─────────────────┴──────┴─────────────┴────────┴────────────────────┴─────────┴──────────┘[Service]
RestartSec=1minrpl_semi_sync_master_enabled=ON
rpl_semi_sync_slave_enabled=ON
rpl_semi_sync_master_wait_point=AFTER_SYNC
rpl_semi_sync_master_timeout=6000
rpl_semi_sync_slave_kill_conn_timeout=5
init-rpl-role=SLAVE
gtid_strict_mode=1
log_slave_updates=1[Splitter-Service]
type=service
router=readwritesplit
servers=dbserv1, dbserv2, dbserv3
user=maxscale
password=maxscale_pw[Splitter-Listener]
type=listener
service=Splitter-Service
port=3306[Read-Write-Listener]
type=listener
address=::
service=Read-Write-Service
authenticator=PAMAuth
[Primary-Server]
type=server
address=123.456.789.10
port=12345auth required pam_unix.so
account required pam_unix.soauthenticator_options=pam_use_cleartext_plugin=1authenticator_options=pam_mode=password_2FAauthenticator_options=pam_backend_mapping=mariadbauthenticator_options=pam_mapped_pw_file=/home/root/passwords.json,pam_backend_mapping=mariadb{
"users_and_passwords": [
{
"user": "my_mapped_user1",
"password": "my_mapped_pw1"
},
{
"user": "my_mapped_user2",
"password": "A6D4C53619FFFF4DF252A0E595EDB0A12CA44E16AF154D0ED08F687E81604BFF42218B4EBA9F3EF8D907CF35E74ABDAA"
}
]
}[MyComment]
type=filter
module=comment
inject="Comment to be injected"
[MyService]
type=service
router=readwritesplit
servers=server1
user=myuser
password=mypasswd
filters=MyComment[IPComment]
type=filter
module=comment
inject="IP=$IP"
[MyService]
type=service
router=readwritesplit
servers=server1
user=myuser
password=mypasswd
filters=IPCommentSELECT user FROM people;/* IP=::ffff:127.0.0.1 */SELECT user FROM people;Review critical information and procedures for upgrading MariaDB MaxScale versions. Learn about new features deprecated functionality and specific steps for each version transition.
GRANT SELECT ON mysql.global_priv TO 'maxscale_user'@'%';reuse_prepared_statements[My-Readwritesplit]
type=service
router=readwritesplit
reuse_prepared_statements=true[PsReuse]
type=filter
module=psreuse
[My-Readwritesplit]
type=service
router=readwritesplit
filters=PsReuseoptimistic_trx[My-Readwritesplit]
type=service
router=readwritesplit
optimistic_trx=true[OptimisticTrx]
type=filter
module=optimistictrx
[My-Readwritesplit]
type=service
router=readwritesplit
transaction_replay=true
filters=OptimisticTrxmaxctrl alter service My-Service connection_keepalive 30000maxctrl alter service My-Service connection_keepalive 30000msthreadsmariadbmon[CSMonitor]
type=monitor
module=csmon
version=1.5
...[My Server]
...
[My Service]
...
servers=My Server[MyServer]
...
[MyService]
...
servers=MyServersome_param=60s
some_param=60000mspasswd is deprecated[The-Service]
type=service
passwd=some-service-password
...
[The-Monitor]
type=monitor
passwd=some-monitor-password
...[The-Service]
type=service
password=some-service-password
...
[The-Monitor]
type=monitor
password=some-monitor-password
...authenticator_options for servers is ignoreduser@host $ maxadmin -u adminGRANT SELECT ON mysql.tables_priv TO 'username'@'maxscalehost';[RW-Split-Router]
type=service
router=readwritesplit
servers=server1,server2,server3,server4
user=jdoe
passwd=BD26E4139A15280CA882264AA1551C70
ssl=required
ssl_cert=/home/user/certs/server-cert.pem
ssl_key=/home/user/certs/server-key.pem
ssl_ca_cert=/home/user/certs/ca.pem
ssl_version=TLSv12
[RW-Split-Listener]
type=listener
service=RW-Split-Router
port=3306[RW-Split-Router]
type=service
router=readwritesplit
servers=server1,server2,server3,server4
user=jdoe
passwd=BD26E4139A15280CA882264AA1551C70
[RW-Split-Listener]
type=listener
service=RW-Split-Router
port=3306
ssl=required
ssl_cert=/home/user/certs/server-cert.pem
ssl_key=/home/user/certs/server-key.pem
ssl_ca_cert=/home/user/certs/ca.pem
ssl_version=TLSv12[binlog_configuration]
master_host=127.0.0.1
master_port=3308
master_user=repl
master_password=somepass
filestem=repl-bin# Re-install init scripts
cd /usr/local/mariadb-maxscale
./postinstUnderstand the architecture of MariaDB MaxScale. This section details the core components, including routers, monitors, and filters, that power the database proxy.
Access essential guides for deploying MariaDB MaxScale including installation, configuration, upgrades, and using the MaxGUI browser-based interface for management and monitoring.
Centralize your database proxy administration. This guide outlines tools and procedures for deploying, configuring, and maintaining MariaDB MaxScale instances.
Choose the right installation method for MariaDB MaxScale. This section includes guides for building from source code and installing via tarballs for custom or non-standard deployments.
Get started with MariaDB MaxScale, the advanced database proxy. These guides provide concise instructions for installation, configuration, and understanding core concepts for new deployments.
Regulate the rate of incoming queries. This filter prevents database overload by limiting the number of queries processed per second based on defined thresholds.
Complete MariaDB MaxScale guide. Complete resource for intelligent query routing, load balancing, connection pooling, and high availability.
Perform day-to-day operations on MaxScale. This section covers managing REST API users, rotating logs, and enabling TLS for secure client connections.
Review known limitations and constraints of MariaDB MaxScale. Understand supported features, configuration boundaries, and protocol specifics to plan your deployment effectively.
Learn to use MaxGUI, the browser-based interface for MariaDB MaxScale. Discover how to enable the GUI, secure access, visualize clusters, and execute queries directly from your dashboard.
How to obtain the complete list of MariaDB MaxScale runtime dependencies on Debian, Ubuntu, RHEL, Rocky Linux, Alma Linux, SLES, and container images.
Manage your MariaDB MaxScale instance using MaxCtrl, a command-line utility for the REST API. Monitor status, configure services, and handle administrative tasks efficiently.
Overview of security features in MariaDB MaxScale, including hardening guides, authentication configuration, and encryption settings for protecting database traffic and administrative access.
Explore the core capabilities of MariaDB MaxScale. This overview covers intelligent routing automated failover security filters and Kafka integration for scalable database architectures.
admin_ssl_certManage MariaDB MaxScale visually with MaxGUI. This browser-based dashboard simplifies configuration, monitoring, and administration tasks for your database proxy instances.
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.
Explore hands-on guides for MariaDB MaxScale. These tutorials cover essential configurations including automatic failover, read-write splitting, security setup, and database sharding.
Access the complete reference for MariaDB MaxScale. Find detailed documentation on configuration parameters, MaxCtrl commands, routers, monitors,
Filters in MariaDB MaxScale intercept and modify database traffic. Use them to transform, block, or log queries, enabling fine-grained control over your database workload and security.
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.
Recommends:maxscale-commondpkg-shlibdeps[maxscale]
...
admin_host = 0.0.0.0
admin_port = 8443$ sudo systemctl restart maxscale# From the configured MariaDB repository
apt-cache depends maxscale
# Recursive (the full transitive dependency tree)
apt-rdepends maxscale
# From a downloaded .deb file
dpkg-deb --info maxscale_*.deb | grep -E '^ (Depends|Recommends|Suggests):'dpkg -s maxscale
dpkg -s maxscale-common# From the configured MariaDB repository
dnf repoquery --requires maxscale
dnf repoquery --requires --resolve maxscale # show concrete package versions
# From a downloaded .rpm file
rpm -qpR /path/to/maxscale-*.rpmrpm -qi maxscale
rpm -qR maxscale
rpm -qR maxscale-commonzypper info --requires maxscale
rpm -qR maxscale# Inspect image labels and history
docker image inspect mariadb/maxscale:latest
docker image history mariadb/maxscale:latest
# Generate an SBOM from the running image (no MariaDB tooling required)
syft mariadb/maxscale:latest -o cyclonedx-json
trivy image --format cyclonedx mariadb/maxscale:latestldd /usr/bin/maxscale
ldd /usr/lib/*/maxscale/*.so # adjust path for your distribution layoutDiscover the capabilities of MariaDB MaxScale. This overview explains how the proxy manages high availability, load balancing, and security for your database infrastructure.
Follow step-by-step instructions to install MariaDB MaxScale on major Linux distributions. This guide covers repository configuration and package installation.
Install MariaDB MaxScale on Linux using official package repositories or RPM/DEB files. This guide details setup for RHEL, Debian, and SLES, plus essential memory and backup configuration.
Start your journey with MariaDB MaxScale. This guide introduces the database proxy's architecture, key components, and basic setup steps for first-time users.
Configure secure access to your database. This guide explains how to set up authenticators in MaxScale to manage client credentials and validate connections to backend servers.
Perform server maintenance safely. Learn how to use MaxCtrl to gracefully drain connections or force a server into maintenance mode, effectively removing it from the load balancing pool.
Handle transient failures gracefully. Learn to configure the delayed_retry parameter to pause and retry queries when backend servers are temporarily unavailable.
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.
Get an overview of the readwritesplit router. Learn how it splits traffic for MariaDB replication and Galera clusters to enhance scalability and performance.
Learn to inspect MaxScale's runtime state using the JSON report from maxctrl. Use jq to query servers services and monitors for detailed debugging and analysis.
Set up monitoring for Galera Clusters. Configure the galeramon module to automatically detect the primary node and manage cluster membership within MaxScale.
Secure your MaxScale configuration by encrypting passwords. Learn to generate encryption keys with maxkeys and obscure credentials using the maxpasswd utility.
Optimize prepared statement execution. This filter caches prepared statements on the proxy layer reducing the overhead of re-preparing statements on backend servers.
Improve performance for read-heavy transactions. This filter attempts to execute transactions on replicas first falling back to the primary only if a write occurs.
Enforce read-only access at the proxy level. This filter rejects modification statements like INSERT or UPDATE protecting the database from accidental writes.
Control query routing using SQL comments. This filter interprets hints embedded in queries to direct traffic to specific servers, primaries, or replicas.
Explore the supported authentication methods in MariaDB MaxScale. Learn how authenticators validate clients and backend servers using plugins like Native, PAM, GSSAPI, etc.
Improve read reliability. Learn to configure retry_failed_reads to automatically attempt failed SELECT queries on alternative replica servers.
Secure client connections with MaxScale authentication modules. This reference details configuration for Native, PAM, GSSAPI, and Ed25519 plugins to validate user credentials.
SET TRANSACTION READ WRITE and START TRANSACTION READ WRITE statements are blocked by this filter. This is done as a safeguard against accidental removal of the read-only transaction mode. However, if the client disables the read-only mode directly via SET tx_read_only=0, the change is not detected by the filter and writes are possible.apt update followed by apt install maxscale.[Galera-Monitor]
type=monitor
module=galeramon
servers=dbserv1, dbserv2, dbserv3
user=monitor_user
password=my_password
monitor_interval=2000msuserpasswordmaxkeysROLLBACKBEGIN[OptimisticTrx]
type=filter
module=optimistictrx
[MyService]
...
filters=OptimisticTrx/* ... */[split-router]
type = service
router = readwritesplit
...
retry_failed_reads = true$ sudo systemctl restart maxscale$ sudo groupadd maxscale
$ sudo useradd -g maxscale maxscale
$ cd /usr/local
$ sudo tar -xzvf maxscale-x.y.z.OS.tar.gz
$ sudo ln -s maxscale-x.y.z.OS maxscale
$ cd maxscale
$ sudo chown -R maxscale var$ sudo mkdir /var/log/maxscale
$ sudo mkdir /var/lib/maxscale
$ sudo mkdir /run/maxscale
$ sudo mkdir /var/cache/maxscale$ sudo chown maxscale /var/log/maxscale
$ sudo chown maxscale /var/lib/maxscale
$ sudo chown maxscale /run/maxscale
$ sudo chown maxscale /var/cache/maxscale$ sudo bin/maxscale --user=maxscale -d$ sudo bin/maxscale --user=maxscale --basedir=/usr/local/maxscale -d$ tar -xzvf maxscale-x.y.z.OS.tar.gz$ cd maxscale-x.y.z.OS
$ bin/maxscale -d --basedir=.$ bin/maxscale --help[Read-Service]
type=service
router=readconnroute
cluster=MyCluster
filters=readonlysysctl vm.overcommit_memorycat /proc/sys/vm/overcommit_memorytar -caf maxscale-backup.tar.gz /etc/maxscale.cnf /etc/maxscale.cnf.d/ /var/lib/maxscale/[my_service]
type=service
router=readwritesplit
servers=server1,server2
user=maxscale_user # User MaxScale uses to connect to backend MariaDB for UAM
password=maxscale_password
[my_listener]
type=listener
service=my_service
port=3306
authenticator=MariaDBAuth # Example: Use the standard MariaDB password authentication
# authenticator=GSSAPIAuth # Or GSSAPI authentication
# authenticator=PAMAuth # Or PAM authentication[my_listener]
# ... other settings ...
authenticator=MariaDBAuth
authenticator_options=skip_authentication=true,match_host=false$ maxctrl --secure
--user=maxscale_rest_admin
--password=maxscale_rest_admin_password
--hosts=192.0.2.100:8443
--tls-key=/certs/client-key.pem
--tls-cert=/certs/client-cert.pem
--tls-ca-cert=/certs/ca.pem
set server server1 maintenance$ maxctrl --secure
--user=maxscale_rest_admin
--password=maxscale_rest_admin_password
--hosts=192.0.2.100:8443
--tls-key=/certs/client-key.pem
--tls-cert=/certs/client-cert.pem
--tls-ca-cert=/certs/ca.pem [split-router]
type = service
router = readwritesplit
...
delayed_retry = true
delayed_retry_timeout = 30s$ sudo systemctl restart maxscale[split-router]
type = service
router = readwritesplit
...
master_reconnection = true
master_failure_mode = fail_on_write$ sudo systemctl restart maxscalemaxctrl create report maxctrl-report.jsonjq '.servers.data[].id' < maxctrl-report.jsonjq '.services.data[].id' < maxctrl-report.jsonjq '.monitors.data[].id' < maxctrl-report.jsonjq '.listeners.data[].id' < maxctrl-report.jsonjq '.filters.data[].id' < maxctrl-report.jsonjq 'keys' < maxctrl-report.jsonjq '.servers.data[0]|keys' < maxctrl-report.jsonjq '.services.data|map(select(.id == "RW-Split-Router"))' < maxctrl-report.jsonjq '.monitors.data|map(select(.id == "MariaDB-Monitor"))' < maxctrl-report.jsonjq '.servers.data|map(select(.id == "DB-1"))' < maxctrl-report.jsonjq '.servers.data|map(select(.id == "DB-1"))|.[].relationships.monitors.data' < maxctrl-report.jsonjq '[.threads.data[].attributes.stats.query_classifier_cache.size]|add' < maxctrl-report.jsonCREATE USER 'monitor_user'@'%' IDENTIFIED BY 'my_password';maxpasswd plainpassword
96F99AA1315BDC3604B006F427DD9484[My-Service]
type=service
router=readconnroute
router_options=master
servers=dbserv1, dbserv2, dbserv3
user=maxscale
password=96F99AA1315BDC3604B006F427DD9484[PsReuse]
type=filter
module=psreuse
[MyService]
...
filters=PsReusemaxctrl create filter OptimisticTrx optimistictrx
maxctrl alter service-filter MyService OptimisticTrx# The --comments flag is needed for the command line client
mariadb --comments -u my-user -psecret -e "SELECT @@hostname -- maxscale route to server db1"-- maxscale <hint body>-- maxscale route to [master | slave | server <server name>]-- maxscale route to master-- maxscale route to slave-- maxscale route to server <server name>-- maxscale route to last-- maxscale <param>=<value>-- maxscale <hint name> prepare <hint content>-- maxscale <hint name> begin-- maxscale end-- maxscale <hint name> begin <hint content>-- maxscale begin <hint content>SELECT user FROM accounts WHERE id = ? -- maxscale route to masterPREPARE my_ps FROM 'SELECT user FROM accounts WHERE id = ?';
EXECUTE my_ps USING 123; -- maxscale route to master[ReadWriteService]
type=service
router=readwritesplit
servers=server1,server2
user=maxuser
password=maxpwd
filters=Hint
[Hint]
type=filter
module=hintfilterINSERT INTO table1 VALUES ("John","Doe",1);
SELECT * FROM table1; -- maxscale route to mastersudo 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 maxscale[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=5s[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=3306sudo systemctl start maxscale
sudo systemctl enable maxscale
sudo systemctl status maxscale # Check statusmariadb -h 127.0.0.1 -P 3306 -u my-user -p● maxscale.service - MariaDB MaxScale Database Proxy
Loaded: loaded (/usr/lib/systemd/system/maxscale.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2024-09-23 08:57:14 CEST; 6s agoCREATE USER 'maxscale' IDENTIFIED BY 'maxscale_passwd';
GRANT ALL PRIVILEGES ON *.* to 'maxscale';[maxscale]
threads=auto
[server1]
type=server
address=127.0.0.1
port=3306
[MariaDB-Monitor]
type=monitor
module=mariadbmon
servers=server1
user=maxscale
password=maxscale_passwd
monitor_interval=2s
[Read-Write-Listener]
type=listener
service=Read-Write-Service
port=4006
[Read-Write-Service]
type=service
router=readwritesplit
cluster=MariaDB-Monitor
user=maxscale
password=maxscale_passwd┌─────────┬───────────┬───────┬─────────────┬─────────────────┬─────────┬─────────────────┐
│ Server │ Address │ Port │ Connections │ State │ GTID │ Monitor │
├─────────┼───────────┼───────┼─────────────┼─────────────────┼─────────┼─────────────────┤
│ server1 │ 127.0.0.1 │ 3306 │ 0 │ Master, Running │ 1-100-3 │ MariaDB-Monitor │
└─────────┴───────────┴───────┴─────────────┴─────────────────┴─────────┴─────────────────┘2024-09-17 17:55:55 notice : Read 16 user@host entries from 'server1' for service 'Read-Write-Service'.mariadb -h127.0.0.1 -P4006 -umaxscale -pmaxscale_passwd
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 7
Server version: 11.4.3-MariaDB-log MariaDB 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)]> select 1;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0,001 sec)[MariaDB-Monitor]
type=monitor
module=mariadbmon
servers=server1,server2,server3
user=maxscale
password=maxscale_passwd
monitor_interval=2s┌─────────┬───────────┬───────┬─────────────┬─────────────────┬─────────┬─────────────────┐
│ Server │ Address │ Port │ Connections │ State │ GTID │ Monitor │
├─────────┼───────────┼───────┼─────────────┼─────────────────┼─────────┼─────────────────┤
│ server1 │ 127.0.0.1 │ 3306 │ 0 │ Master, Running │ 1-100-3 │ MariaDB-Monitor │
├─────────┼───────────┼───────┼─────────────┼─────────────────┼─────────┼─────────────────┤
│ server2 │ 127.0.0.1 │ 3307 │ 0 │ Slave, Running │ 1-100-3 │ MariaDB-Monitor │
├─────────┼───────────┼───────┼─────────────┼─────────────────┼─────────┼─────────────────┤
│ server3 │ 127.0.0.1 │ 3308 │ 0 │ Slave, Running │ 1-100-3 │ MariaDB-Monitor │
└─────────┴───────────┴───────┴─────────────┴─────────────────┴─────────┴─────────────────┘[MyLogFilter]
type=filter
module=qlafilter
filebase=/var/log/maxscale/query_log
log_type=unified
flush=true[Read-Write-Service]
type=service
filters=MyLogFilter
router=readwritesplit
cluster=MariaDB-Monitor
user=maxscale
password=maxscale_passwdMask failovers from applications. Configure transaction_replay to automatically re-execute interrupted transactions on a new primary server without returning errors.
Optimize applications for read-write splitting. This guide outlines best practices for transaction management and connection handling to ensure compatibility with MaxScale.
Define your database backend servers in MaxScale. Learn to configure server objects set addresses and ports and enable TLS encryption for secure connections.
Learn about special module-specific commands in MaxScale. This guide explains how to list and execute commands using MaxCtrl for modules like authenticators, filters, and monitors.
#include <maxscale/modulecmd.hh>
bool my_simple_cmd(const MODULECMD_ARG *argv)
{
printf("%d arguments given\n", argv->argc);
}
int main(int argc, char **argv)
{
modulecmd_arg_type_t my_args[] =
{
{MODULECMD_ARG_BOOLEAN, "This is a boolean parameter"},
{MODULECMD_ARG_STRING | MODULECMD_ARG_OPTIONAL, "This is an optional string parameter"}
};
// Register the command
modulecmd_register_command("my_module", "my_command", my_simple_cmd, 2, my_args);
// Find the registered command
const MODULECMD *cmd = modulecmd_find_command("my_module", "my_command");
// Parse the arguments for the command
const void *arglist[] = {"true", "optional string"};
MODULECMD_ARG *arg = modulecmd_arg_parse(cmd, arglist, 2);
// Call the module command
modulecmd_call_command(cmd, arg);
// Free the parsed arguments
modulecmd_arg_free(arg);
return 0;
}Review the current constraints of MariaDB MaxScale. This document lists known issues regarding transaction parsing, protocol support, and specific module limitations.
Limit the size of result sets returned to clients. This filter prevents excessive resource consumption by truncating results that exceed a configured row count.
Preserve session context across connections. Learn how MaxScale's session command history replays SET statements on new replica connections to maintain state consistency.
Remove unwanted or obsolete REST API users from your MariaDB MaxScale instance. This guide demonstrates how to safely delete user credentials using the MaxCtrl command-line utility.
Implement simple connection-based routing. This tutorial shows how to dedicate specific ports for write and read traffic using the readconnroute router.
Customize load balancing algorithms. Explore options for the slave_selection_criteria parameter, including adaptive routing and least-global-connections strategies.
Integrate MaxScale with Kerberos or Active Directory using GSSAPI. Learn to configure the GSSAPIAuth module, manage keytab files, and set up service principals for secure login.
Create new users for the MaxScale REST API using MaxCtrl. This page explains the difference between basic and admin users and provides command examples for adding credentials to your system.

SELECTWITHKRB5_KTNAMECREATE 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=autoecho "<ENTERPRISE_TOKEN>" | docker login docker.mariadb.com -u <your-mariadb.id-email> --password-stdindocker pull docker.mariadb.com/maxscale:latestdocker pull docker.mariadb.com/maxscale:25.01.1docker run -d -p 8989:8989 --name mxs docker.mariadb.com/maxscale:latest## Authenticate, pull, and run in one sequence
echo "<ENTERPRISE_TOKEN>" | docker login docker.mariadb.com -u <your-mariadb.id-email> --password-stdin
docker pull docker.mariadb.com/maxscale:latest
docker run -d -p 3306:3306 -p 8989:8989 --name mxs docker.mariadb.com/maxscale:latestdocker run -d -p 3306:3306 -p 8989:8989 --name mxs docker.mariadb.com/maxscale:latestcurl -u admin:mariadb http://localhost:8989/v1/maxscaledocker run -d -p 8989:8989 --name mxs -v /path/to/your-maxscale.cnf:/etc/maxscale.cnf.d/custom.cnf docker.mariadb.com/maxscale:latestdocker run -d -p 8989:8989 --name mxs -v /path/to/your-maxscale.cnf:/etc/maxscale.cnf.d docker.mariadb.com/maxscale:latestdocker exec -it mxs bashdocker ps --filter "name=mxs"docker stop mxsdocker rm mxs[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 maxscaleLOAD DATA INFILE 'S3://my-bucket/my-data.csv' INTO TABLE t1
FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';[LDI-Filter]
type=filter
module=ldi
host=s3.amazonaws.com
region=us-east-1SET @maxscale.ldi.s3_key='<my-access-key>', @maxscale.ldi.s3_secret='<my-secret-key>';LOAD DATA INFILE 'S3://my-bucket/my-data.csv' INTO TABLE t1;[Listener]
type=listener
address=127.0.0.1
port=3306
service=Service
authenticator=mariadbauth,parsecauth[MyListener]
type=listener
authenticator=mariadbauth
authenticator_options=clear_pw_passthrough=true
ssl=true
<other options>SET autocommit=1
PREPARE hide_autocommit FROM "SET autocommit=0"
EXECUTE hide_autocommit[MaxRows]
type=filter
module=maxrows
[MaxRows-Routing-Service]
type=service
...
filters=MaxRowsmax_resultset_rows=1000max_resultset_size=128KiMariaDB [(test)]> select * from test.t4;
ERROR 1415 (0A000): Row limit/size exceeded for query: select * from test.t4debug=2[MaxRows]
type=filter
module=maxrows
max_resultset_rows=10000
max_resultset_size=256000[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$ maxctrl --secure
--user=maxscale_rest_admin
--password=maxscale_rest_admin_password
--hosts=192.0.2.100:8443
--tls-key=/certs/client-key.pem
--tls-cert=/certs/client-cert.pem
--tls-ca-cert=/certs/ca.pem
destroy user "admin"[Write-Service]
type=service
router=readconnroute
router_options=master
servers=dbserv1, dbserv2, dbserv3
user=maxscale
password=maxscale_pw
[Read-Service]
type=service
router=readconnroute
router_options=slave
servers=dbserv1, dbserv2, dbserv3
user=maxscale
password=maxscale_pw[Write-Listener]
type=listener
service=Write-Service
port=3306
[Read-Listener]
type=listener
service=Read-Service
port=3307[split-router]
type = service
router = readwritesplit
...
slave_selection_criteria = LEAST_GLOBAL_CONNECTIONS$ sudo systemctl restart maxscaleauthenticator=GSSAPIAuth
authenticator_options=principal_name=mariadb/localhost.localdomain@EXAMPLE.COMauthenticator_options=principal_name=mymariadb@EXAMPLE.COM,gssapi_keytab_path=/home/user/mymariadb.keytab$ maxctrl --secure
--user=admin
--password=mariadb
--hosts=192.0.2.100:8443
--tls-key=/certs/client-key.pem
--tls-cert=/certs/client-cert.pem
--tls-ca-cert=/certs/ca.pem
create user "maxscale_rest" "maxscale_rest_password"$ maxctrl --secure
--user=admin
--password=mariadb
--hosts=192.0.2.100:8443
--tls-key=/certs/client-key.pem
--tls-cert=/certs/client-cert.pem
--tls-ca-cert=/certs/ca.pem
create user "maxscale_rest_admin" "maxscale_rest_admin_password" --type=admin


maxctrl destroy listener \
Round-Robin-Service \
Round-Robin-ListenerRewrite or block queries using regular expressions. This versatile filter modifies SQL statements on the fly or rejects them based on pattern matching rules.
Learn how to secure your MaxCtrl connections using TLS. This guide details the necessary MaxScale configuration parameters and command-line flags to enable encrypted administrative sessions.
Implement high-security authentication using Ed25519 signatures. This guide explains how to configure the ed25519auth module and handle backend authentication via user mapping.
Ensure data consistency by routing reads to the primary server after a write. This filter guarantees that a client sees its own modifications immediately.
Selectively replicate binary log events to replica servers. This filter uses regex matching to include or exclude specific events from the replication stream.




caseextendedccrmatchignorematchignoremaxctrl show servicesmaxctrl show monitorsmaxctrl show serversmaxctrl destroy server mariadbgalera3 --force[maxscale]
...
admin_host = 0.0.0.0
admin_port = 8443[maxscale]
...
admin_ssl_key=/certs/server-key.pem
admin_ssl_cert=/certs/server-cert.pem
admin_ssl_ca_cert=/certs/ca-cert.pem$ sudo systemctl restart maxscale$ maxctrl --secure
--user=admin
--password=mariadb
--hosts=192.0.2.100:8443
--tls-key=/certs/client-key.pem
--tls-cert=/certs/client-cert.pem
--tls-ca-cert=/certs/ca.pem
create user "maxscale_rest_admin" "maxscale_rest_admin_password" --type=admin$ maxctrl --secure
--user=maxscale_rest_admin
--password=maxscale_rest_admin_password
--hosts=192.0.2.100:8443
--tls-key=/certs/client-key.pem
--tls-cert=/certs/client-cert.pem
--tls-ca-cert=/certs/ca.pem
destroy user "admin"match=TYPE[ ]*=
options=casereplace=ENGINE =source=127.0.0.1user=johnlog_file=/tmp/regexfilter.loglog_trace=true[CreateTableFilter]
type=filter
module=regexfilter
options=ignorecase
match=TYPE\s*=
replace=ENGINE=
[MyService]
type=service
router=readconnroute
servers=server1
user=myuser
password=mypasswd
filters=CreateTableFilter[maxscale]
...
admin_host = 0.0.0.0
admin_port = 8443[maxscale]
...
admin_ssl_key=/certs/server-key.pem
admin_ssl_cert=/certs/server-cert.pem
admin_ssl_ca_cert=/certs/ca-cert.pem$ maxctrl --secure
--user=maxscale_rest_admin
--password=maxscale_rest_admin_password
--hosts=192.0.2.100:8443
--tls-key=/certs/client-key.pem
--tls-cert=/certs/client-cert.pem
--tls-ca-cert=/certs/ca.pemINSERT INTO departments VALUES ('d1234', 'NewDepartment'); -- maxscale ccr=ignorematch=.*INSERT.*
ignore=.*UPDATE.*
options=case,extended[CCRFilter]
type=filter
module=ccrfilter
time=5[BinlogFilter]
type=filter
module=binlogfilter
match=/customers[.]/
exclude=/[.]orders/
[BinlogServer]
type=service
router=binlogrouter
server_id=33
filters=BinlogFilter
[BinlogListener]
type=listener
service=BinlogServer
port=4000ed25519auth to the list of authenticators for a listener.[Read-Write-Listener]
type=listener
address=::
service=Read-Write-Service
authenticator=ed25519authauthenticator_options=ed_mode=sha256authenticator_options=ed_mode=sha256,
ed_rsa_privkey_path=/tmp/sha_private_key.pem,
ed_rsa_pubkey_path=/tmp/sha_public_key.pem[Read-Write-Listener]
type=listener
address=::
service=Read-Write-Service
authenticator=ed25519auth,mariadbauth
user_mapping_file=/home/joe/mapping.json{
"user_map": [
{
"original_user": "alpha",
"mapped_user": "beta"
},
{
"original_user": "gamma",
"mapped_user": "gamma"
}
],
"server_credentials": [
{
"mapped_user": "beta",
"password": "hunter2",
"plugin": "mysql_native_password"
},
{
"mapped_user": "gamma",
"password": "letmein",
"plugin": "ed25519"
}
]
}[Read-Write-Listener]
type=listener
address=::
service=Read-Write-Service
authenticator=ed25519auth
authenticator_options=ed_mode=sha256
ssl=true
ssl_key=/tmp/my-key.pem
ssl_cert=/tmp/my-cert.pem
ssl_ca=/tmp/myCA.pem[Read-Write-Listener]
type=listener
address=::
service=Read-Write-Service
authenticator=ed25519auth
authenticator_options=ed_mode=sha256,
ed_rsa_privkey_path=/tmp/sha_private_key.pem,
ed_rsa_pubkey_path=/tmp/sha_public_key.pemopenssl genrsa -out sha_private_key.pem 2048
openssl rsa -in sha_private_key.pem -pubout -out sha_public_key.pemFollow this guide to prepare your environment for MaxScale. Learn to create necessary database users configure the server and set up basic monitoring permissions.
CREATE USER 'maxscale'@'%' IDENTIFIED BY 'maxscale_pw';
GRANT SELECT ON mysql.user TO 'maxscale'@'%';
GRANT SELECT ON mysql.db TO 'maxscale'@'%';
GRANT SELECT ON mysql.tables_priv TO 'maxscale'@'%';
GRANT SELECT ON mysql.columns_priv TO 'maxscale'@'%';
GRANT SELECT ON mysql.procs_priv TO 'maxscale'@'%';
GRANT SELECT ON mysql.proxies_priv TO 'maxscale'@'%';
GRANT SELECT ON mysql.global_priv TO 'maxscale'@'%';
GRANT SELECT ON mysql.roles_mapping TO 'maxscale'@'%';
GRANT SHOW DATABASES ON *.* TO 'maxscale'@'%';Essential hardening steps for production MaxScale environments. Learn to encrypt passwords, secure the REST API with TLS, enable audit logging, and configure encrypted database connections.
Understand how MaxScale handles MySQL protocol authentication. This guide covers the User Account Manager, required database grants, and general authentication settings like matching hosts.
Duplicate query traffic to multiple targets. This filter sends a copy of incoming requests to a secondary service or server useful for testing and auditing.
Identify the most expensive queries. This filter logs the top N slowest queries passing through MaxScale helping to pinpoint performance bottlenecks.
caseextended
[NamedServerFilter]
type=filter
module=namedserverfilter
match01=^Select.*TableOne$
target01=server2,server3
match22=^SELECT.*TableTwo$
target22=->master
[MyService]
type=service
router=readwritesplit
servers=server1,server2,server3
user=myuser
password=mypasswd
filters=NamedServerFiltermatch01=^SELECT
options=case,extendedtarget01=MyServer2source=127.0.0.1source=192.%.%.%
source=192.168.%.%
source=192.168.10.%source=192.168.21.3,192.168.10.%user=john[NamedServerFilter]
type=filter
module=namedserverfilter
match02= *from *users
target02=server2
[MyService]
type=service
router=readwritesplit
servers=server1,server2
user=myuser
password=mypasswd
filters=NamedServerFilter[MyFilter]
type=filter
module=xxxfilter[Split-Service]
type=service
router=readwritesplit
servers=dbserver1,dbserver2,dbserver3,dbserver4
user=massi
password=6628C50E07CCE1F0392EDEEB9D1203F3
filters=hints | top10[top30]
type=filter
module=topfilter
count=30
filebase=/var/log/DBSessions/top30[BubbleGame]
type=service
router=readwritesplit
servers=dbbubble1,dbbubble2,dbbubble3,dbbubble4,dbbubble5
user=maxscale
password=6628C50E07CCE1F0392EDEEB9D1203F3[CassandraDB]
type=server
address=192.168.4.28
port=3306
[Cassandra]
type=service
router=readconnroute
router_options=running
servers=CassandraDB
user=maxscale
password=6628C50E07CCE1F0392EDEEB9D1203F3[HighScores]
type=filter
module=teefilter
match=insert.*HighScore.*values
service=Cassandra[BubbleGame]
type=service
router=readwritesplit
servers=dbbubble1,dbbubble2,dbbubble3,dbbubble4,dbbubble5
user=maxscale
password=6628C50E07CCE1F0392EDEEB9D1203F3
filters=HighScoresmkdir maxscale
cd maxscale
tar -xf path/to/maxscale-25.10.2-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.0CREATE USER 'jdoe'@'maxscale-host' IDENTIFIED BY 'my_secret_password';SHOW GRANTS FOR 'jdoe'@'client-host';
+-----------------------------------------------------------------------+
| Grants for jdoe@client-host |
+-----------------------------------------------------------------------+
| GRANT SELECT, INSERT, UPDATE, DELETE ON *.* TO 'jdoe'@'client-host' |
+-----------------------------------------------------------------------+
1 row in set (0.01 sec)GRANT SELECT, INSERT, UPDATE, DELETE ON *.* TO 'jdoe'@'maxscale-host';[maxscale]
threads=autosudo systemctl start maxscalesudo service maxscale start% sudo maxctrl list services
┌──────────────────┬────────────────┬─────────────┬───────────────────┬───────────────────────────┐
│ Service │ Router │ Connections │ Total Connections │ Servers │
├──────────────────┼────────────────┼─────────────┼───────────────────┼───────────────────────────┤
│ Splitter-Service │ readwritesplit │ 1 │ 1 │ dbserv1, dbserv2, dbserv3 │
└──────────────────┴────────────────┴─────────────┴───────────────────┴───────────────────────────┘
% sudo maxctrl list servers
┌─────────┬─────────────┬──────┬─────────────┬─────────────────┬───────────┐
│ Server │ Address │ Port │ Connections │ State │ GTID │
├─────────┼─────────────┼──────┼─────────────┼─────────────────┼───────────┤
│ dbserv1 │ 192.168.2.1 │ 3306 │ 0 │ Master, Running │ 0-3000-62 │
├─────────┼─────────────┼──────┼─────────────┼─────────────────┼───────────┤
│ dbserv2 │ 192.168.2.2 │ 3306 │ 0 │ Slave, Running │ 0-3000-62 │
├─────────┼─────────────┼──────┼─────────────┼─────────────────┼───────────┤
│ dbserv3 │ 192.168.2.3 │ 3306 │ 0 │ Slave, Running │ 0-3000-62 │
└─────────┴─────────────┴──────┴─────────────┴─────────────────┴───────────┘
% sudo maxctrl list listeners Splitter-Service
┌───────────────────┬──────┬──────┬─────────┐
│ Name │ Port │ Host │ State │
├───────────────────┼──────┼──────┼─────────┤
│ Splitter-Listener │ 3306 │ │ Running │
└───────────────────┴──────┴──────┴─────────┘license_key=<key>$ maxkeys$ maxpasswd plaintextpassword
96F99AA1315BDC3604B006F427DD9484[MariaDB-Service]
type=service
router=readwritesplit
servers=MariaDB1,MariaDB2,MariaDB3
user=maxscale-user
password=96F99AA1315BDC3604B006F427DD9484[maxscale]
admin_host=10.0.0.3
admin_port=2222[maxscale]
admin_secure_gui=true
admin_ssl_key=/certs/maxscale-key.pem
admin_ssl_cert=/certs/maxscale-cert.pem
admin_ssl_ca_cert=/certs/ca-cert.pem$ maxctrl --user=my_user --password=my_password --secure --tls-ca-cert=/certs/ca-cert.pem --tls-verify-server-cert=false show maxscale$ maxctrl create user my_user my_password --type=admin$ maxctrl destroy user admin[maxscale]
admin_audit = true
admin_audit_file = /var/log/maxscale/audit_files/audit.csv$ maxctrl rotate logs[RWS-Listener]
type=listener
service=RWS-Service
ssl=true
ssl_key=/certs/my-cert-key.pem
ssl_cert=/certs/my-cert.pem[RWS-Listener]
type=listener
service=RWS-Service
ssl=true
ssl_key=/certs/my-cert-key.pem
ssl_cert=/certs/my-cert.pem
ssl_ca=/certs/my_ca_cert.pem[MariaDB-Server1]
type=server
address=...
port=...
ssl=true
ssl_verify_peer_certificate=true
ssl_ca=/certs/my_ca_cert.pem[MariaDB-Server1]
type=server
address=...
port=...
ssl=true
ssl_verify_peer_certificate=true
ssl_key=/certs/my-cert-key.pem
ssl_cert=/certs/my-cert.pem
ssl_ca=/certs/my_ca_cert.pemCREATE USER 'maxscale'@'maxscalehost' IDENTIFIED BY 'maxscale-password';
GRANT SELECT ON mysql.user TO 'maxscale'@'maxscalehost';
GRANT SELECT ON mysql.db TO 'maxscale'@'maxscalehost';
GRANT SELECT ON mysql.tables_priv TO 'maxscale'@'maxscalehost';
GRANT SELECT ON mysql.columns_priv TO 'maxscale'@'maxscalehost';
GRANT SELECT ON mysql.procs_priv TO 'maxscale'@'maxscalehost';
GRANT SELECT ON mysql.proxies_priv TO 'maxscale'@'maxscalehost';
GRANT SELECT ON mysql.global_priv TO 'maxscale'@'maxscalehost';
GRANT SELECT ON mysql.roles_mapping TO 'maxscale'@'maxscalehost';
GRANT SHOW DATABASES ON *.* TO 'maxscale'@'maxscalehost';
GRANT SET USER ON *.* TO 'maxscale'@'maxscalehost';GRANT ALL ON infinidb_vtable.* TO 'maxscale'@'maxscalehost';authenticator_options=skip_authentication=true,lower_case_table_names=1authenticator_options=skip_authentication=trueauthenticator_options=match_host=falseauthenticator_options=lower_case_table_names=0[DataMartFilter]
type=filter
module=tee
target=DataMart
[Data-Service]
type=service
router=readconnroute
servers=server1
user=myuser
password=mypasswd
filters=DataMartFiltermatch=/insert.*into.*order*/exclude=/select.*from.*t1/options=case,extendedsource=127.0.0.1user=john[Orders]
type=service
router=readconnroute
servers=server1, server2, server3, server4
user=massi
password=6628C50E07CCE1F0392EDEEB9D1203F3
filters=ReplicateOrders
[ReplicateOrders]
type=filter
module=tee
target=DataMart
match=insert[ ]*into[ ]*orders
[DataMart]
type=service
router=readconnroute
servers=datamartserver
user=massi
password=6628C50E07CCE1F0392EDEEB9D1203F3
filters=QLA-DataMart
[QLA-DataMart]
type=filter
module=qlafilter
options=/var/log/DataMart/InsertsLog
[Orders-Listener]
type=listener
target=Orders
port=4011
[DataMart-Listener]
type=listener
target=DataMart
port=4012[MyLogFilter]
type=filter
module=topfilter
[Service]
type=service
router=readconnroute
servers=server1
user=myuser
password=mypasswd
filters=MyLogFilterfilebase=/tmp/SqlQueryLogcount=30match=select.*from.*customer.*where
exclude=where
options=case,extendedsource=127.0.0.1user=john[ProductsUpdateTop20]
type=filter
module=topfilter
count=20
match=UPDATE.*PRODUCTS.*WHERE
exclude=UPDATE.*PRODUCTS_STOCK.*WHERE
filebase=/var/logs/top/ProductsUpdate[SlowAppServer]
type=filter
module=topfilter
count=20
source=192.168.0.32
filebase=/var/logs/top/SlowAppServer[ControlAppServer]
type=filter
module=topfilter
count=20
source=192.168.0.42
filebase=/var/logs/top/ControlAppServer[App-Service]
type=service
router=readconnroute
servers=server1
user=myuser
password=mypasswd
filters=SlowAppServer | ControlAppServer-bash-4.1$ cat /var/logs/top/Employees-top-10.137
Top 10 longest running queries in session.
==========================================
Time (sec) | Query
-----------+-----------------------------------------------------------------
22.985 | select sum(salary), year(from_date) from salaries s, (select distinct year(from_date) as y1 from salaries) y where (makedate(y.y1, 1) between s.from_date and s.to_date) group by y.y1
5.304 | select d.dept_name as "Department", y.y1 as "Year", count(*) as "Count" from departments d, dept_emp de, (select distinct year(from_date) as y1 from dept_emp order by 1) y where d.dept_no = de.dept_no and (makedate(y.y1, 1) between de.from_date and de.to_date) group by y.y1, d.dept_name order by 1, 2
2.896 | select year(now()) - year(birth_date) as age, gender, avg(salary) as "Average Salary" from employees e, salaries s where e.emp_no = s.emp_no and ("1988-08-01" between from_date AND to_date) group by year(now()) - year(birth_date), gender order by 1,2
2.160 | select dept_name as "Department", sum(salary) / 12 as "Salary Bill" from employees e, departments d, dept_emp de, salaries s where e.emp_no = de.emp_no and de.dept_no = d.dept_no and ("1988-08-01" between de.from_date AND de.to_date) and ("1988-08-01" between s.from_date AND s.to_date) and s.emp_no = e.emp_no group by dept_name order by 1
0.845 | select dept_name as "Department", avg(year(now()) - year(birth_date)) as "Average Age", gender from employees e, departments d, dept_emp de where e.emp_no = de.emp_no and de.dept_no = d.dept_no and ("1988-08-01" between from_date AND to_date) group by dept_name, gender
0.668 | select year(hire_date) as "Hired", d.dept_name, count(*) as "Count" from employees e, departments d, dept_emp de where de.emp_no = e.emp_no and de.dept_no = d.dept_no group by d.dept_name, year(hire_date)
0.249 | select moves.n_depts As "No. of Departments", count(moves.emp_no) as "No. of Employees" from (select de1.emp_no as emp_no, count(de1.emp_no) as n_depts from dept_emp de1 group by de1.emp_no) as moves group by moves.n_depts order by 1
0.245 | select year(now()) - year(birth_date) as age, gender, count(*) as "Count" from employees group by year(now()) - year(birth_date), gender order by 1,2
0.179 | select year(hire_date) as "Hired", count(*) as "Count" from employees group by year(hire_date)
0.160 | select year(hire_date) - year(birth_date) as "Age", count(*) as Count from employees group by year(hire_date) - year(birth_date) order by 1
-----------+-----------------------------------------------------------------
Session started Wed Jun 18 18:41:03 2014
Connection from 127.0.0.1
Username massi
Total of 24 statements executed.
Total statement execution time 35.701 seconds
Average statement execution time 1.488 seconds
Total connection time 46.500 seconds
-bash-4.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');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 maxscaleObfuscate sensitive data in query results. This filter masks specific columns based on user roles, ensuring compliance with privacy regulations without altering the database.
Protect your database by blocking unauthorized queries. This filter inspects incoming SQL against a defined set of rules to prevent SQL injection and unauthorized access.
Implement basic database sharding using the schemarouter. Learn to distribute data across multiple servers while presenting a single logical database to clients.
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> SELECT name, ssn FROM person;+-------+-------------+
+ name | ssn |
+-------+-------------+
| Alice | 721-07-4426 |
| Bob | 435-22-3267 |
...+-------+-------------+
+ name | ssn |
+-------+-------------+
| Alice | XXX-XX-XXXX |
| Bob | XXX-XX-XXXX |
...CREATE TABLE cheat (revealed_ssn TEXT);
INSERT INTO cheat SELECT ssn FROM users;
SELECT revealed_ssn FROM cheat;mysql> set @@sql_mode = 'ANSI_QUOTES';
mysql> select concat("ssn") from managers;[Mask-SSN]
type=filter
module=masking
rules=...
[SomeService]
type=service
...
filters=Mask-SSNrules=/path/to/rules-filewarn_type_mismatch=alwayslarge_payload=ignoreSELECT CONCAT(masked_column) FROM tbl;prevent_function_usage=falserequire_fully_parsed=falsetreat_string_arg_as_field=falseset @a = (select ssn from customer where id = 1);check_user_variables=falseSELECT a FROM t1 UNION SELECT b FROM t2;check_unions=falseSELECT * FROM (SELECT a AS b FROM t1) AS t2;check_subqueries=false{
"rules": [ ... ]
}{
"rules": [
{
"replace": { ... },
"with": { ... },
"applies_to": [ ... ],
"exempted": [ ... ]
}
]
}{
"rules": [
{
"replace": {
"database": "db1",
"table": "person",
"column": "ssn"
},
"with": { ... },
"applies_to": [ ... ],
"exempted": [ ... ]
}
]
}SELECT ssn FROM person2;SELECT ssn FROM person UNION SELECT ssn FROM person2;SELECT ssn FROM person2 UNION SELECT ssn FROM person2;SELECT ssn FROM person UNION SELECT ssn FROM person;"replace": {
"column": "ssn",
"match": "(123)"
},
"with": {
"fill": "X#"
}"obfuscate": {
"column": "name"
}SELECT name from db1.tbl1;`
+------+
| name |
+------+
| $-~) |
+------+{
"rules": [
{
"replace": {
"column": "ssn"
},
"with": {
"value": "XXX-XX-XXXX"
},
"applies_to": [ ... ],
"exempted": [ ... ]
},
{
"replace": {
"column": "age"
},
"with": {
"fill": "*"
},
"applies_to": [ ... ],
"exempted": [ ... ]
},
{
"replace": {
"column": "creditcard"
},
"with": {
"value": "1234123412341234",
"fill": "0"
},
"applies_to": [ ... ],
"exempted": [ ... ]
},
]
}{
"rules": [
{
"replace": { ... },
"with": { ... },
"applies_to": [ "'alice'@'host'", "'bob'@'%'" ],
"exempted": [ ... ]
}
]
}{
"rules": [
{
"replace": { ... },
"with": { ... },
"applies_to": [ ... ],
"exempted": [ "'admin'" ]
}
]
}MaxScale> call command masking reload MyMaskingFilter[MyMasking]
type=filter
module=masking
warn_type_mismatch=always
large_payload=abort
rules=masking_rules.json
[MyService]
type=service
...
filters=MyMasking{
"rules": [
{
"replace": {
"column": "ssn"
},
"with": {
"value": "012345-ABCD",
"fill": "X"
}
}
]
}# Install MaxScale
apt update
apt -y install sudo curl
curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash
apt -y install maxscale-- Create the user for the service
CREATE USER 'service_user'@'%' IDENTIFIED BY 'secret';
GRANT SELECT ON mysql.* TO 'service_user'@'%';
GRANT SHOW DATABASES ON *.* TO 'service_user'@'%';
-- Create the user for the monitor
CREATE USER 'monitor_user'@'%' IDENTIFIED BY 'secret';
GRANT REPLICATION CLIENT ON *.* TO 'monitor_user'@'%';
-- Create the application user
CREATE USER app_user@'%' IDENTIFIED BY 'secret';
GRANT SELECT, INSERT, UPDATE, DELETE ON *.* TO app_user@'%';CREATE DATABASE IF NOT EXISTS customer_01;
CREATE TABLE IF NOT EXISTS customer_01.accounts(id INT, account_type INT, account_name VARCHAR(255));
INSERT INTO customer_01.accounts VALUES (1, 1, 'foo');
-- The shared schema that's on all shards
CREATE DATABASE IF NOT EXISTS shared_info;
CREATE TABLE IF NOT EXISTS shared_info.account_types(account_type INT, type_name VARCHAR(255));
INSERT INTO shared_info.account_types VALUES (1, 'admin'), (2, 'user');CREATE DATABASE IF NOT EXISTS customer_02;
CREATE TABLE IF NOT EXISTS customer_02.accounts(id INT, account_type INT, account_name VARCHAR(255));
INSERT INTO customer_02.accounts VALUES (2, 2, 'bar');
-- The shared schema that's on all shards
CREATE DATABASE IF NOT EXISTS shared_info;
CREATE TABLE IF NOT EXISTS shared_info.account_types(account_type INT, type_name VARCHAR(255));
INSERT INTO shared_info.account_types VALUES (1, 'admin'), (2, 'user');[db-01]
type=server
address=192.168.0.102
port=3306
[db-02]
type=server
address=192.168.0.103
port=3306[Sharded-Service]
type=service
router=schemarouter
targets=db-02,db-01
user=service_user
password=secret
ignore_tables_regex=.*[Sharded-Service-Listener]
type=listener
service=Sharded-Service
port=4000[Shard-Monitor]
type=monitor
module=galeramon
servers=db-02,db-01
user=monitor_user
password=secret[db-01]
type=server
address=192.168.0.102
port=3306
[db-02]
type=server
address=192.168.0.103
port=3306
[Sharded-Service]
type=service
router=schemarouter
targets=db-02,db-01
user=service_user
password=secret
ignore_tables_regex=.*
[Sharded-Service-Listener]
type=listener
service=Sharded-Service
port=4000
[Shard-Monitor]
type=monitor
module=galeramon
servers=db-02,db-01
user=monitor_user
password=secretsystemctl start maxscale.service$ mariadb -A -u app_user -psecret -h 127.0.0.1 -P 4000
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.11.7-MariaDB-1:10.11.7+maria~ubu2004-log mariadb.org binary distribution
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)]> USE customer_01;
Database changed
MariaDB [customer_01]> SELECT c.account_name, c.account_type, s.type_name FROM accounts c
-> JOIN shared_info.account_types s ON (c.account_type = s.account_type);
+--------------+--------------+-----------+
| account_name | account_type | type_name |
+--------------+--------------+-----------+
| foo | 1 | admin |
+--------------+--------------+-----------+
1 row in set (0.001 sec)
MariaDB [customer_01]> USE customer_02;
Database changed
MariaDB [customer_02]> SELECT c.account_name, c.account_type, s.type_name FROM accounts c
-> JOIN shared_info.account_types s ON (c.account_type = s.account_type);
+--------------+--------------+-----------+
| account_name | account_type | type_name |
+--------------+--------------+-----------+
| bar | 2 | user |
+--------------+--------------+-----------+
1 row in set (0.000 sec)MariaDB [(none)]> SELECT c.account_name, c.account_type, s.type_name FROM customer_01.accounts c
-> JOIN shared_info.account_types s ON (c.account_type = s.account_type);
+--------------+--------------+-----------+
| account_name | account_type | type_name |
+--------------+--------------+-----------+
| foo | 1 | admin |
+--------------+--------------+-----------+
1 row in set (0.001 sec)
MariaDB [(none)]> SELECT c.account_name, c.account_type, s.type_name FROM customer_02.accounts c
-> JOIN shared_info.account_types s ON (c.account_type = s.account_type);
+--------------+--------------+-----------+
| account_name | account_type | type_name |
+--------------+--------------+-----------+
| bar | 2 | user |
+--------------+--------------+-----------+
1 row in set (0.001 sec)MariaDB [(none)]> SELECT * FROM customer_01.accounts UNION SELECT * FROM customer_02.accounts;
ERROR 1146 (42S02): Table 'customer_01.accounts' doesn't exist
MariaDB [(none)]> USE customer_01;
Database changed
MariaDB [customer_01]> SELECT * FROM customer_01.accounts UNION SELECT * FROM customer_02.accounts;
ERROR 1146 (42S02): Table 'customer_02.accounts' doesn't exist
MariaDB [customer_01]> USE customer_02;
Database changed
MariaDB [customer_02]> SELECT * FROM customer_01.accounts UNION SELECT * FROM customer_02.accounts;
ERROR 1146 (42S02): Table 'customer_01.accounts' doesn't existSELECT * FROM t WHERE f = ?SELECT * FROM t WHERE f = 10
SELECT * FROM t WHERE f = 20SELECT * FROM t WHERE f > 5
SELECT * FROM t WHERE f = 10
INSERT INTO t VALUES (42)
DELETE FROM t WHERE f > 20
SELECT * FROM users WHERE username = 'input' AND password = 'input'SELECT * FROM t WHERE f > ?
SELECT * FROM t WHERE f = ?
INSERT INTO t VALUES (?)
DELETE FROM t WHERE f > ?
SELECT * FROM users WHERE username = ? AND password = ?SELECT * FROM t WHERE f > 100
SELECT * FROM t WHERE f = 42
INSERT INTO t VALUES (84)
DELETE FROM t WHERE f > 200
SELECT * FROM users WHERE username = 'joe' AND password = 'secret'# != is neither > nor =
SELECT * FROM t WHERE f != 10
# During learning only one value was inserted
INSERT INTO t VALUES (1), (2)
# During learning DELETE was always accompanied by a WHERE clause
DELETE FROM t
# An apparent SQL-injection attack does not match what was learnt.
SELECT * FROM users WHERE username = '' OR '1'='1' AND password = ''[MyFirewall]
type=filter
module=firewallexclude_users=admin, 'super'@'192.168.02.1'2024-11-18 08:01:47 warning: (1) [firewall] (Service); Firewall incident (user@127.0.0.1): DELETE FROM t[MyFirewall]
type=filter
module=firewall[MyService]
type=service
router=readwritesplit
...
filters=MyFirewallmaxctrl alter filter MyFirewall mode=learn-clearmaxctrl alter filter MyFirewall mode=supervisemaxctrl alter filter MyFilter mode=enforceConfigure automatic failover for MariaDB replication clusters. This tutorial covers setting up the monitor to handle primary server failures and promote replicas automatically.
[server1]
type=server
address=192.168.121.51
port=3306
[server2]
...
[server3]
...
[server4]
...
[TheMonitor]
type=monitor
module=mariadbmon
servers=server1,server2,server3,server4
...$ maxctrl list servers
┌─────────┬─────────────────┬──────┬─────────────┬─────────────────┐
│ Server │ Address │ Port │ Connections │ State │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server1 │ 192.168.121.51 │ 3306 │ 0 │ Master, Running │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server2 │ 192.168.121.190 │ 3306 │ 0 │ Slave, Running │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server3 │ 192.168.121.112 │ 3306 │ 0 │ Slave, Running │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server4 │ 192.168.121.201 │ 3306 │ 0 │ Slave, Running │
└─────────┴─────────────────┴──────┴─────────────┴─────────────────┘Interact with MaxScale programmatically using the REST API. This tutorial demonstrates how to create, modify, and inspect MaxScale objects at runtime using curl.
Learn how to configure the Exasolrouter in MariaDB MaxScale to route analytical queries to Exasol while maintaining transactional workloads in MariaDB
Master common administrative tasks in MaxScale. Learn to start/stop services, rotate logs, manage servers with MaxCtrl, and put nodes into maintenance mode.
maxctrlsystemctl start maxscalesystemctl stop maxscale%%
# options
regex_grammar: Native
case_sensitive: true
what_if: false
continue_if_matched: false
ignore_whitespace: true
%
# match template
@{1:^}select @{2} from my_table where id = @{3}
%
# replace template
select @{2} from my_table where id = @{3}%%
# use default options by leaving this blank
%
@{1:^}select count(distinct @{2}) from @{3}
%
select count(*) from (select distinct @{1} from @{2}) as t123
Input: select count(distinct author) from books where entity != "AI"
Rewritten: select count(*) from (select distinct author from books where entity != "AI") as t123%%
%
from mytable
%
from mytable force index (myindex)
Input: select name from mytable where id=42
Rewritten: select name from mytable force index (myindex) where id=42%%
%
@{1:^}select @{2} from mytable
%
select @{2} from mytable force index (myindex)%%
%
@{1:^}select zip_code from address_book where str_id = @{1:["]}@{2:[[:digit:]]+}@{3:["]}
%
select zip_code from address_book where id = @{2}
Input: select zip_code from address_book where str_id = "1234"
Rewritten: select zip_code from address_book where id = 1234%%
regex_grammar: EPosix
continue_if_matched: true
%
wrong_table_name
%
correct_table_name
%%
regex_grammar: EPosix
%
wrong_column_name
%
correct_column_name[Rewrite]
type = filter
module = rewritefilter
template_file = /path/to/template_file.rf
...
[Router]
type=service
...
filters=Rewrite%%
options
%
match template
%
replace templatecase_sensitive: true%%
case_sensitive: false
%
@{1:^}select @{2}
from mytable
where user = @{3}
%
select @{2} from mytable where user = @{3}
and @{3} in (select user from approved_users){ "templates" :
[
{
"case_sensitive" : false,
"match_template" : "@{1:^}select @{2} from mytable where user = @{3}",
"replace_template" : "select @{2} from mytable where user = @{3}
and @{3} in (select user from approved_users)"
}
]
}maxctrl alter filter Rewrite log_replacement=false$ maxctrl list servers
┌─────────┬─────────────────┬──────┬─────────────┬────────────────┐
│ Server │ Address │ Port │ Connections │ State │
├─────────┼─────────────────┼──────┼─────────────┼────────────────┤
│ server1 │ 192.168.121.51 │ 3306 │ 0 │ Down │
├─────────┼─────────────────┼──────┼─────────────┼────────────────┤
│ server2 │ 192.168.121.190 │ 3306 │ 0 │ Slave, Running │
├─────────┼─────────────────┼──────┼─────────────┼────────────────┤
│ server3 │ 192.168.121.112 │ 3306 │ 0 │ Slave, Running │
├─────────┼─────────────────┼──────┼─────────────┼────────────────┤
│ server4 │ 192.168.121.201 │ 3306 │ 0 │ Slave, Running │
└─────────┴─────────────────┴──────┴─────────────┴────────────────┘$ maxctrl call command mariadbmon failover TheMonitor
OK$ maxctrl list servers
┌─────────┬─────────────────┬──────┬─────────────┬─────────────────┐
│ Server │ Address │ Port │ Connections │ State │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server1 │ 192.168.121.51 │ 3306 │ 0 │ Down │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server2 │ 192.168.121.190 │ 3306 │ 0 │ Master, Running │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server3 │ 192.168.121.112 │ 3306 │ 0 │ Slave, Running │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server4 │ 192.168.121.201 │ 3306 │ 0 │ Slave, Running │
└─────────┴─────────────────┴──────┴─────────────┴─────────────────┘$ maxctrl list servers
┌─────────┬─────────────────┬──────┬─────────────┬─────────────────┐
│ Server │ Address │ Port │ Connections │ State │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server1 │ 192.168.121.51 │ 3306 │ 0 │ Running │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server2 │ 192.168.121.190 │ 3306 │ 0 │ Master, Running │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server3 │ 192.168.121.112 │ 3306 │ 0 │ Slave, Running │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server4 │ 192.168.121.201 │ 3306 │ 0 │ Slave, Running │
└─────────┴─────────────────┴──────┴─────────────┴─────────────────┘[TheMonitor]
type=monitor
module=mariadbmon
servers=server1,server2,server3,server4
auto_failover=true
...$ maxctrl list servers
┌─────────┬─────────────────┬──────┬─────────────┬─────────────────┐
│ Server │ Address │ Port │ Connections │ State │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server1 │ 192.168.121.51 │ 3306 │ 0 │ Master, Running │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server2 │ 192.168.121.190 │ 3306 │ 0 │ Slave, Running │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server3 │ 192.168.121.112 │ 3306 │ 0 │ Slave, Running │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server4 │ 192.168.121.201 │ 3306 │ 0 │ Slave, Running │
└─────────┴─────────────────┴──────┴─────────────┴─────────────────┘$ maxctrl list servers
┌─────────┬─────────────────┬──────┬─────────────┬────────────────────────┐
│ Server │ Address │ Port │ Connections │ State │
├─────────┼─────────────────┼──────┼─────────────┼────────────────────────┤
│ server1 │ 192.168.121.51 │ 3306 │ 0 │ Down │
├─────────┼─────────────────┼──────┼─────────────┼────────────────────────┤
│ server2 │ 192.168.121.190 │ 3306 │ 0 │ Master, Slave, Running │
├─────────┼─────────────────┼──────┼─────────────┼────────────────────────┤
│ server3 │ 192.168.121.112 │ 3306 │ 0 │ Slave, Running │
├─────────┼─────────────────┼──────┼─────────────┼────────────────────────┤
│ server4 │ 192.168.121.201 │ 3306 │ 0 │ Slave, Running │
└─────────┴─────────────────┴──────┴─────────────┴────────────────────────┘[TheMonitor]
type=monitor
module=mariadbmon
servers=server1,server2,server3,server4
auto_failover=true
monitor_interval=2s
failcount=5
...[TheMonitor]
type=monitor
module=mariadbmon
servers=server1,server2,server3,server4
auto_failover=true
auto_rejoin=true
...$ maxctrl list servers
┌─────────┬─────────────────┬──────┬─────────────┬─────────────────┐
│ Server │ Address │ Port │ Connections │ State │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server1 │ 192.168.121.51 │ 3306 │ 0 │ Down │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server2 │ 192.168.121.190 │ 3306 │ 0 │ Master, Running │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server3 │ 192.168.121.112 │ 3306 │ 0 │ Slave, Running │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server4 │ 192.168.121.201 │ 3306 │ 0 │ Slave, Running │
└─────────┴─────────────────┴──────┴─────────────┴─────────────────┘$ maxctrl list servers
┌─────────┬─────────────────┬──────┬─────────────┬─────────────────┐
│ Server │ Address │ Port │ Connections │ State │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server1 │ 192.168.121.51 │ 3306 │ 0 │ Slave, Running │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server2 │ 192.168.121.190 │ 3306 │ 0 │ Master, Running │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server3 │ 192.168.121.112 │ 3306 │ 0 │ Slave, Running │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server4 │ 192.168.121.201 │ 3306 │ 0 │ Slave, Running │
└─────────┴─────────────────┴──────┴─────────────┴─────────────────┘$ maxctrl call command mariadbmon switchover TheMonitor server1 server2
OK$ maxctrl list servers
┌─────────┬─────────────────┬──────┬─────────────┬─────────────────┐
│ Server │ Address │ Port │ Connections │ State │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server1 │ 192.168.121.51 │ 3306 │ 0 │ Master, Running │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server2 │ 192.168.121.190 │ 3306 │ 0 │ Slave, Running │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server3 │ 192.168.121.112 │ 3306 │ 0 │ Slave, Running │
├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
│ server4 │ 192.168.121.201 │ 3306 │ 0 │ Slave, Running │
└─────────┴─────────────────┴──────┴─────────────┴─────────────────┘maxctrl create user my_user my_password --type=admin
maxctrl destroy user adminadmin_ssl_key=/certs/server-key.pem
admin_ssl_cert=/certs/server-cert.pem
admin_ssl_ca_cert=/certs/ca-cert.pemmaxctrl --user=my_user --password=my_password --secure --tls-ca-cert=/certs/ca-cert.pem --tls-verify-server-cert=false show maxscaleHTTP/1.1 200 OK
Connection: Keep-Alive
Content-Length: 0
Last-Modified: Mon, 04 Mar 2019 08:23:09 GMT
ETag: "0"
Date: Mon, 04 Mar 19 08:29:41 GMT{
"links": {
"self": "http://127.0.0.1:8989/v1/filters/"
},
"data": [
{
"id": "Hint",
"type": "filters",
"relationships": {
"services": {
"links": {
"self": "http://127.0.0.1:8989/v1/services/"
},
"data": [
{
"id": "RW-Split-Hint-Router",
"type": "services"
}
]
}
},
"attributes": {
"module": "hintfilter",
"parameters": {}
},
"links": {
"self": "http://127.0.0.1:8989/v1/filters/Hint"
}
},
{
"id": "Logger",
"type": "filters",
"relationships": {
"services": {
"links": {
"self": "http://127.0.0.1:8989/v1/services/"
},
"data": []
}
},
"attributes": {
"module": "qlafilter",
"parameters": {
"match": null,
"exclude": null,
"user": null,
"source": null,
"filebase": "/tmp/log",
"options": "ignorecase",
"log_type": "session",
"log_data": "date,user,query",
"newline_replacement": "\" \"",
"separator": ",",
"flush": false,
"append": false
},
"filter_diagnostics": {
"separator": ",",
"newline_replacement": "\" \""
}
},
"links": {
"self": "http://127.0.0.1:8989/v1/filters/Logger"
}
}
]
}{
"links": {
"self": "http://127.0.0.1:8989/v1/filters/Logger"
},
"data": {
"id": "Logger",
"type": "filters",
"relationships": {
"services": {
"links": {
"self": "http://127.0.0.1:8989/v1/services/"
},
"data": []
}
},
"attributes": {
"module": "qlafilter",
"parameters": {
"match": null,
"exclude": null,
"user": null,
"source": null,
"filebase": "/tmp/log",
"options": "ignorecase",
"log_type": "session",
"log_data": "date,user,query",
"newline_replacement": "\" \"",
"separator": ",",
"flush": false,
"append": false
},
"filter_diagnostics": {
"separator": ",",
"newline_replacement": "\" \""
}
},
"links": {
"self": "http://127.0.0.1:8989/v1/filters/Logger"
}
}
}{
"data": {
"id": "server1",
"type": "servers",
"attributes": {
"parameters": {
"address": "127.0.0.1",
"port": 3003
}
}
}
}curl -X POST -d @new_server.txt 127.0.0.1:8989/v1/serverscurl 127.0.0.1:8989/v1/servers/server1curl 127.0.0.1:8989/v1/servers/server1 > server1.txtcurl -X PATCH -d @server1.txt 127.0.0.1:8989/v1/servers/server1curl 127.0.0.1:8989/v1/servers/server1{
"data": {
"id": "server1",
"type": "servers",
"relationships": {
"services": {
"data": [
{
"id": "RW-Split-Router",
"type": "services"
}
]
}
},
"attributes": ...
}
}{
"data": {
"relationships": {
"services": {
"data": []
},
"monitors": {
"data": []
}
}
}
}curl -X DELETE 127.0.0.1:8989/v1/servers/server1maxctrl alter maxscale admin_audit_file=/var/log/maxscale/admin_audit.march.csv.$ maxctrl list services
┌────────────────────────┬────────────────┬─────────────┬───────────────────┬────────────────────────────────────┐
│ Service │ Router │ Connections │ Total Connections │ Servers │
├────────────────────────┼────────────────┼─────────────┼───────────────────┼────────────────────────────────────┤
│ CLI │ cli │ 1 │ 1 │ │
├────────────────────────┼────────────────┼─────────────┼───────────────────┼────────────────────────────────────┤
│ RW-Split-Router │ readwritesplit │ 1 │ 1 │ server1, server2, server3, server4 │
├────────────────────────┼────────────────┼─────────────┼───────────────────┼────────────────────────────────────┤
│ RW-Split-Hint-Router │ readwritesplit │ 1 │ 1 │ server1, server2, server3, server4 │
├────────────────────────┼────────────────┼─────────────┼───────────────────┼────────────────────────────────────┤
│ SchemaRouter-Router │ schemarouter │ 1 │ 1 │ server1, server2, server3, server4 │
├────────────────────────┼────────────────┼─────────────┼───────────────────┼────────────────────────────────────┤
│ Read-Connection-Router │ readconnroute │ 1 │ 1 │ server1 │
└────────────────────────┴────────────────┴─────────────┴───────────────────┴────────────────────────────────────┘$ maxctrl list sessions
┌────┬─────────┬──────────────────┬──────────────────────────┬──────┬─────────────────┐
│ Id │ User │ Host │ Connected │ Idle │ Service │
├────┼─────────┼──────────────────┼──────────────────────────┼──────┼─────────────────┤
│ 6 │ maxuser │ ::ffff:127.0.0.1 │ Thu Aug 27 10:39:16 2020 │ 4 │ RW-Split-Router │
└────┴─────────┴──────────────────┴──────────────────────────┴──────┴─────────────────┘maxctrl rotate logs/var/log/maxscale/maxscale.log {
monthly
rotate 5
missingok
nocompress
sharedscripts
postrotate
\# run if maxscale is running
if test -n "`ps acx|grep maxscale`"; then
/usr/bin/maxctrl rotate logs
fi
endscript
}/var/log/maxscale/maxscale.log {
monthly
rotate 5
missingok
nocompress
sharedscripts
postrotate
kill -USR1 `cat /run/maxscale/maxscale.pid`
endscript
}maxctrl set server db-server-3 maintenancemaxctrl clear server db-server-3 maintenancemaxctrl stop service db-servicemaxctrl start service db-servicemaxctrl stop monitor db-monitormaxctrl start monitor db-monitormaxctrl alter maxscale auth_connect_timeout 5smaxctrl create server db-server-1 192.168.0.100 3306maxctrl alter server db-server-1 port 3307maxctrl destroy server db-server-1maxctrl set server db-server-1 drainmaxctrl clear server db-server-1 drainmaxctrl create monitor db-monitor mariadbmon user=db-user password=db-passwordmaxctrl alter monitor db-monitor monitor_interval 1000maxctrl link monitor db-monitor db-server-1maxctrl unlink monitor db-monitor db-server-1maxctrl destroy monitor db-monitormaxctrl create service db-service readwritesplit user=db-user password=db-passwordmaxctrl alter service db-service user new-db-usermaxctrl link service db-service db-server1maxctrl unlink service db-service db-server1maxctrl alter service-filters my-regexfilter my-qlafiltermaxctrl destroy service db-servicemaxctrl create filter my-filter regexfilter match=ENGINE=MyISAM replace=ENGINE=InnoDBmaxctrl alter filter my-filter match=ENGINE=InnoDBmaxctrl destroy filter my-filtermaxctrl create listener db-listener db-service 4006maxctrl destroy listener db-listenermaxctrl create user basic-user basic-passwordmaxctrl create user admin-user admin-password --type=adminmaxctrl alter user admin-user new-admin-passwordmaxctrl destroy user basic-usermariadb \
-h <maxscale-ip> \
-P <mariadb exa port> \
-u <user> \
-p curl https://x-up.s3.amazonaws.com/7.x/26.2.6/Exasol_ODBC-26.2.6-Linux_x86_64.tar.gz \
-o Exasol_ODBC-26.2.6-Linux_x86_64.tar.gz
tar -xvf Exasol_ODBC-26.2.6-Linux_x86_64.tar.gz
chmod -R 755 Exasol_ODBC-26.2.6-Linux_x86_64mariadb -e "DROP USER IF EXISTS maxuser@'%'"
mariadb -e "CREATE USER maxuser@'%' IDENTIFIED BY 'aBcd123%'"
mariadb -e "GRANT SUPER, RELOAD, REPLICATION CLIENT, REPLICATION SLAVE, SHOW DATABASES ON *.* TO maxuser@'%'"
mariadb -e "GRANT SELECT ON mysql.db TO maxuser@'%'"
mariadb -e "GRANT SELECT ON mysql.user TO maxuser@'%'"
mariadb -e "GRANT SELECT ON mysql.roles_mapping TO maxuser@'%'"
mariadb -e "GRANT SELECT ON mysql.tables_priv TO maxuser@'%'"
mariadb -e "GRANT SELECT ON mysql.columns_priv TO maxuser@'%'"
mariadb -e "GRANT SELECT ON mysql.proxies_priv TO maxuser@'%'"
mariadb -e "GRANT SELECT ON mysql.procs_priv TO maxuser@'%'"
sudo su
find / -name exaplus/home/mariadbexa/.ccc/x/u/branchr/db+Titzi90-patch-2-e01f9219-64r/install/opt/exasol/db-2025.2.0/bin/Console/exaplusexaplus -c 127.0.0.1/nocertcheck:8563 -u sys -p syspassword \
--sql "CREATE USER admin_user IDENTIFIED BY \"aBc123%%\";"
exaplus -c 127.0.0.1/nocertcheck:8563 -u sys -p syspassword \
--sql "GRANT CREATE SESSION, CREATE TABLE, SELECT ANY TABLE, \
INSERT ANY TABLE, UPDATE ANY TABLE, DELETE ANY TABLE TO admin_user;"maxctrl create server mariadb1 address=127.0.0.1 port=3306 protocol=MariaDBBackend;
maxctrl create monitor mariadb_monitor mariadbmon \
servers=mariadb1 \
user=maxuser \
password=aBcd123% \
monitor_interval=1s ;maxctrl create service mariadb_exasolrouter exasolrouter \
user=maxuser \
password=aBcd123% \
preprocessor=auto \
connection_string='DRIVER=/home/rocky/Exasol_ODBC-26.2.6-Linux_x86_64/lib/libexaodbc.so;EXAHOST=102.22.2.22:8563;UID=admin_user;PWD=aBc123%%;FINGERPRINT=NOCERTCHECK' maxctrl create service mariadb_smartrouter smartrouter \
user=maxuser \
password='aBcd123%' \
targets=mariadb1,mariadb_exasolrouter \
master=mariadb1maxctrl create listener mariadb_smartrouter mariadb_smartrouter_listener 3306Log every SQL query passing through MaxScale. This filter provides comprehensive audit trails by recording query text, execution time, and client details.
Diagnose and resolve common MaxScale issues. Find solutions for systemd watchdog kills, high memory usage, authentication failures, and connectivity errors.
mariadb \
-h <maxscale-ip> \
-P <mariadb exa port> \
-u <user> \
-p -e “select 1 as connected”maxctrl alter maxscale log_debug true
maxctrl alter maxscale log_info truetail -f /var/log/maxscale/maxscale.log2026-02-13 18:14:49 info : (3) [smartrouter] (mariadb_smartrouter); Trigger re-measure, schedule 2min, perf: mariadb1, 15.2181s, SELECT DISTINCT( IF( domain_new IS NOT NULL, domain_new, IF( username ...
2026-02-13 18:15:04 info : (3) [smartrouter] (mariadb_smartrouter); Update perf: from mariadb1, 15.2181s to mariadb1, 14.5416s, SELECT DISTINCT( IF( domain_new IS NOT NULL, domain_new, IF( username ...[MyLogFilter]
type=filter
module=qlafilter
filebase=/tmp/SqlQueryLog
[MyService]
type=service
router=readconnroute
servers=server1
user=myuser
password=mypasswd
filters=MyLogFilterfilebase=/tmp/SqlQueryLoguser_match=/(^alice$)|(^bob$)/user_exclude=/(^alice$)|(^bob$)/source_match=/(^127[.]0[.]0[.]1)|(^192[.]168[.]0[.]109)/source_exclude=/(^127[.]0[.]0[.]1)|(^192[.]168[.]0[.]109)/MariaDB [test]> select secret from T where x password="clear text pwd";
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual
that corresponds to your MariaDB server version for the right syntax to
use near 'password="clear text pwd"' at line 1newline_replacement=" NL "[ProductsSelectLogger]
type=filter
module=qlafilter
match=SELECT.*from.*PRODUCTS .*
exclude=WHERE.*PRODUCT_ID.*
filebase=/var/logs/qla/SelectProducts
[Product-Service]
type=service
router=readconnroute
servers=server1
user=myuser
password=mypasswd
filters=ProductsSelectLogger07:12:56.324 7/01/2016, SELECT * FROM PRODUCTSwriteq_high_water=512writeq_low_water=128[Service]
ExecStart=valgrind --leak-check=full /usr/bin/maxscale -d
Type=simpleERROR 1045 (28000): Access denied for user 'bob'@'office' (using password: YES)GRANT SELECT ON `my\_database`.\* TO 'user'@'%' <-- bad
GRANT SELECT ON `my_database`.\* TO 'user'@'%' <-- goodsudo sysctl -w fs.pipe-max-size=8388608pkg/prelude/bootstrap.js:1872
throw error;
^
Error: ENOENT: no such file or directory, uv_cwd
1) If you want to compile the package/file into executable, please pay
attention to compilation warnings and specify a literal in 'require'
call.
2) If you don't want to compile the package/file into executable and
want to 'require' it from filesystem (likely plugin), specify an
absolute path in 'require' call using process.cwd() or process.execPath.
at Object.wrappedCwd [as cwd] (internal/bootstrap/switches/does_own_process_state.js:130:28)
at /snapshot/maxctrl/node_modules/yargs/build/index.cjs:1:59463
at Argv (/snapshot/maxctrl/node_modules/yargs/index.cjs:12:16)
at Object.<anonymous> (/snapshot/maxctrl/node_modules/yargs/index.cjs:7:1)
at Module._compile (pkg/prelude/bootstrap.js:1926:22)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at Module.require (pkg/prelude/bootstrap.js:1851:31) {
errno: -2,
code: 'ENOENT',
syscall: 'uv_cwd',
pkg: true
}sysctl -w kernel.core_pattern='|/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %e'$ cat /etc/systemd/coredump.conf
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See coredump.conf(5) for details.
[Coredump]
Storage=external
Compress=yes
ProcessSizeMax=1G
ExternalSizeMax=1G
JournalSizeMax=1G
#MaxUse=
#KeepFree=Follow the specific steps to upgrade MariaDB MaxScale to version 25.01. This guide covers new package structures, removed features, and critical configuration changes for this release.
sudo cp /etc/maxscale.cnf /data/backups/config/maxscale.cnfsudo systemctl stop maxscalesudo maxctrl show maxscale┌──────────────┬──────────────────────────────────────────────────────────────────────┐
│ Version │ 25.01.2 │
├──────────────┼──────────────────────────────────────────────────────────────────────┤
│ Commit │ 61b8bbf7f63c38ca9c408674e66f3627a0b2192e │
├──────────────┼──────────────────────────────────────────────────────────────────────┤
│ Started At │ Fri, 03 Jan 2025 18:05:18 GMT │
├──────────────┼──────────────────────────────────────────────────────────────────────┤
│ Activated At │ Fri, 03 Jan 2025 18:05:18 GMT │
├──────────────┼──────────────────────────────────────────────────────────────────────┤
│ Uptime │ 109 │
├──────────────┼──────────────────────────────────────────────────────────────────────┤
│ Parameters │ { │
│ │ "libdir": "/usr/lib/x86_64-linux-gnu/maxscale", │
│ │ "datadir": "/var/lib/maxscale", │
│ │ "process_datadir": "/var/lib/maxscale/data3850", │
│ │ "cachedir": "/var/cache/maxscale", │
│ │ "configdir": "/etc", │
│ │ "config_persistdir": "/var/lib/maxscale/maxscale.cnf.d", │
│ │ "module_configdir": "/etc/maxscale.modules.d", │
│ │ "piddir": "/var/run/maxscale", │
│ │ "logdir": "/var/log/maxscale", │
│ │ "langdir": "/var/lib/maxscale", │
│ │ "execdir": "/usr/bin", │
│ │ "connector_plugindir": "/usr/lib/x86_64-linux-gnu/mysql/plugin", │
│ │ "threads": 1, │
│ │ "thread_stack_size": 8388608, │
│ │ "writeq_high_water": 0, │
│ │ "writeq_low_water": 0, │
│ │ "auth_connect_timeout": 3, │
│ │ "auth_read_timeout": 1, │
│ │ "auth_write_timeout": 2, │
│ │ "skip_permission_checks": false, │
│ │ "admin_auth": true, │
│ │ "admin_enabled": true, │
│ │ "admin_log_auth_failures": true, │
│ │ "admin_host": "127.0.0.1", │
│ │ "admin_port": 8989, │
│ │ "admin_ssl_key": "", │
│ │ "admin_ssl_cert": "", │
│ │ "admin_ssl_ca_cert": "", │
│ │ "admin_pam_readwrite_service": "", │
│ │ "admin_pam_readonly_service": "", │
│ │ "passive": false, │
│ │ "query_classifier": "", │
│ │ "query_classifier_cache_size": 155008819, │
│ │ "retain_last_statements": 0, │
│ │ "dump_last_statements": "never", │
│ │ "session_trace": 0, │
│ │ "load_persisted_configs": true, │
│ │ "max_auth_errors_until_block": 10 │
│ │ } │
└──────────────┴──────────────────────────────────────────────────────────────────────┘Record and replay real database traffic. This filter captures client sessions to create realistic benchmarks and test environments based on production workloads.
maxctrl create filter CAPTURE_FLTR wcar
maxctrl link service RWS-Router CAPTURE_FLTRmaxctrl call command wcar start CAPTURE_FLTR <options>maxctrl call command wcar stop CAPTURE_FLTRmaxctrl unlink service RWS-Router CAPTURE_FLTR
maxctrl destroy filter CAPTURE_FLTR[CAPTURE_FLTR]
type=filter
module=wcar
capture_duration=1h # Limit capture duration to one hour
capture_size=1Gi # Limit capture size to 1GiB
start_capture=true # Start capturing immediately after starting MaxScale[server1]
type=server
address=127.0.0.1
port=3306
[MariaDB-Monitor]
type=monitor
module=mariadbmon
servers=server1
user=maxuser
password=maxpwd
[CAPTURE_FLTR]
type=filter
module=wcar
capture_duration=1h # Limit capture duration to one hour
capture_size=1Gi # Limit capture size to 1GiB
start_capture=true # Start capturing immediately after starting MaxScale
[RWS-Router]
type=service
router=readwritesplit
cluster=MariaDB-Monitor
user=maxuser
password=maxpwd
filters=CAPTURE_FLTR
[RWS-Listener]
type=listener
service=RWS-Router
port=4006maxctrl call command wcar stop CAPTURE_FLTRtar -caf captures.tar.gz -C /var/lib/maxscale wcarmaxctrl call command wcar <command> <filter> [options]maxctrl call command wcar start CAPTURE_FLTR prefix=Scenario1 size=10Gmaxctrl call command wcar stop CAPTURE_FLTRmaxplayer summary /path/to/capture.cxCREATE USER 'maxreplay'@'%' IDENTIFIED BY 'replay-pw';
GRANT ALL ON *.* TO 'maxreplay'@'%';cd /path/to/capture-dir
tar -xaf captures.tar.gzmaxplayer replay --user maxreplay --password replay-pw --host <host:port> --output baseline-result.csv /path/to/capture.cxmaxplayer replay --user maxreplay --password replay-pw --host <host:port> --output comparison-result.csv /path/to/capture.cxmaxplayer canonicals /path/to/capture.cx > canonicals.csvmaxpostprocess canonicals.csv baseline-result.csv -o baseline-summary.json
maxpostprocess canonicals.csv comparison-result.csv -o comparison-summary.jsonmaxvisualize baseline-summary.json comparison-summary.jsonmaxvisualize baseline-summary.json comparison-summary.json --Voila.ip='0.0.0.0'maxplayer -u user -p pwd --speed 1.5 -i 5s -o baseline.csv capture_2024-09-06_090002.cx --help
Usage: maxplayer [OPTION]... [COMMAND] FILE
Commands: (default: replay)
summary Show a summary of the capture.
replay Replay the capture.
convert Converts the input file (either .cx or .rx) to a replay file (.rx or .csv).
canonicals List the canonical forms of the captured SQL as CSV.
dump-data Dump capture data as SQL.
show Show the SQL of one or more events.
Options:
--user User name for login to the replay server.
-u This version does not support using the actual user names
that were used during capture.
--password Only clear text passwords are supported as of yet.
-p
--host The address of the replay server in <IP>:<port> format.
-h E.g. 127.0.0.1:4006
--output The name of the output file: e.g. baseline.csv.
-o
--report Periodically report statistics of ongoing operations.
-r The option takes a duration, such as 10s.
--report-file The --report option by default writes to stdout.
-R Provide the name of the file to write to. The file will
be truncated every time it is written to, allowing for a
simple status window by running 'watch cat <path-to-file>'
in a terminal.
--speed The value is a multiplier. 2.5 is 2.5x speed and 0.5 is half speed.
-s A value of zero means no limit, or replay as fast as possible.
A multiplier of 2.5 might not have any effect as the actual time spent
depends on many factors, such as the captured volume and replay server.
--idle-wait Relates to playback speed, and can be used together with --speed.
-i During capture there can be long delays where there is no traffic.
One hour of no capture traffic would mean replay waits for one hour.
idle-wait allows to move simulation time forwards when such gaps
occur. A 'gap' starts when all prior queries have fully executed.
--idle-wait takes a duration value. A negative value turns the feature off,
i.e. the one hour wait would happen.
--idle-wait 0s means time moves to the event start-time immediately
when a gap is detected, i.e., all gaps are skipped over.
--idle-wait 10s means time moves to the event start-time 10 seconds
(wall time) after the gap was detected. Shorter
gaps than 10 seconds will thus be fully waited for.
--idle-wait has a default value of 1 second.
Examples: 1h, 60m, 3600s, 3600000ms, which all define the same duration.
--query-filter Options: none, write-only, read-only. Default: none.
-f Replay can optionally apply only writes or only reads. This option is useful
once the databases to be tested have been prepared (see full documentation)
and optionally either a write-only run, or a full replay has been run.
Now multiple read-only runs against the server(s) are simple as no further
data synchronization is needed.
Note that this mode has its limitations as the query results may
be very different than what they were during capture.
--analyze Enabling this option will track the server Rows_read statistic for each query.
-A This will slow down the overall replay time. The query time measurements
are still valid, but currently this option should only be used when
it is of real value to know how many rows the server read for each query.
--verbose Verbose output. The option can be repeated for more verbosity: -vvv
-v
--version Display the version number and copyrights.
-V
input file: capture_2024-09-06_090002.cx
-h --help true
-u --user user
-p --password pwd
-H --host 127.1.1.0:3306
-o --output baseline.csv
-r --report 0ns
-R --report-file
-s --speed 1.5
-i --idle-wait 5s
-f --query-filter none
-A --analyze false
-v --verbose 0
-V --version 0.2sudo apt install --only-upgrade maxscalesudo zypper update maxscale[repl-monitor]
type = monitor
module = mariadbmon
servers = server1,server2,server3
user = maxscale
password = max_passwd
auto_failover = ON
auto_rejoin = ON
master_conditions = connected_slave,running_slave[col-monitor]
type = monitor
module = csmon
servers = server1,server2,server3
user = maxscale
password = max_passwd
version = 1.2sudo yum install curlcurl -LsSO https://dlm.mariadb.com/enterprise-release-helpers/mariadb_es_repo_setupchmod +x mariadb_es_repo_setupsudo ./mariadb_es_repo_setup --token="CUSTOMER_DOWNLOAD_TOKEN" --apply \
--mariadb-maxscale-version="25.01"sudo dnf update maxscalemaxctrl create monitor mdb_monitor mariadbmon \
--monitor-user mxs \
--monitor-password 'maxscale_passwd' \
replication_user='repl_user' \
replication_password='repl_pass' \
--servers node1 node2 node3maxctrl create monitor mdb_monitor mariadbmon \
user='mxs' \
password='maxscale_passwd' \
replication_user='repl_user' \
replication_password='repl_pass' \
--servers node1 node2 node3sudo apt install curlcurl -LsSO https://dlm.mariadb.com/enterprise-release-helpers/mariadb_es_repo_setupchmod +x mariadb_es_repo_setupsudo ./mariadb_es_repo_setup --token="CUSTOMER_DOWNLOAD_TOKEN" --apply \
--mariadb-maxscale-version="25.01"sudo apt updatesudo zypper install curlcurl -LsSO https://dlm.mariadb.com/enterprise-release-helpers/mariadb_es_repo_setupecho "4d483b4df193831a0101d3dfa7fb3e17411dda7fc06c31be4f9e089c325403c0 mariadb_es_repo_setup" \
| sha256sum -c -chmod +x mariadb_es_repo_setupsudo ./mariadb_es_repo_setup --token="CUSTOMER_DOWNLOAD_TOKEN" --apply \
--mariadb-maxscale-version="25.01"GRANT SHOW DATABASES ON *.*
TO 'maxscale'@'192.0.2.1';
GRANT SELECT ON mysql.columns_priv
TO 'maxscale'@'192.0.2.1';
GRANT SELECT ON mysql.db
TO 'maxscale'@'192.0.2.1';
GRANT SELECT ON mysql.procs_priv
TO 'mxs'@'192.0.2.1';
GRANT SELECT ON mysql.proxies_priv
TO 'maxscale'@'192.0.2.1';
GRANT SELECT ON mysql.roles_mapping
TO 'maxscale'@'192.0.2.1';
GRANT SELECT ON mysql.tables_priv
TO 'maxscale'@'192.0.2.1';
GRANT SELECT ON mysql.user
TO 'maxscale'@'192.0.2.1';[maxscale]
syslog=true[repl-monitor]
type = monitor
module = mariadbmon
servers = server1,server2,server3
user = maxscale
password = max_passwd
auto_failover = ON
auto_rejoin = ON
slave_conditions = running_master,writable_masterthread_specificverify_cacheableFOUND_ROWSGET_LOCKIS_FREE_LOCKIS_USED_LOCKLAST_INSERT_IDLOAD_FILELOCALTIMELOCALTIMESTAMPMASTER_POS_WAITNOWRANDRELEASE_LOCKSESSION_USERSLEEPSYSDATESYSTEM_USERUNIX_TIMESTAMPUSERUUIDUUID_SHORTread_only_transactionsall_transactionsall_transactions: The cache will be used and populated inside explicitly read-only transactions. Inside transactions that are not explicitly read-only, the cache will be used and populated until the first non-SELECT statement.20b00010currentisolatedunlikeSELECT * FROM t WHERE a=1;INSERT INTO t SET a=42;Timeline 1 Timeline 2
Clients execute INSERT ... SELECT COUNT(*) FROM tbl
MaxScale -> DB SELECT COUNT(*) FROM tbl
MaxScale -> DB INSERT ...MaxScale -> Cache Delete invalidated values
MaxScale -> Cache Store result and invalidation key[Cache]
type=filter
module=cache
hard_ttl=30
soft_ttl=20
rules=...
...
[Cached-Routing-Service]
type=service
...
filters=Cachestorage=storage_redishard_ttl=60ssoft_ttl=60smax_resultset_rows=1000max_resultset_size=128Kimax_count=1000max_size=100Mirules=/path/to/rules-filemaxctrl alter filter MyCache rules='/path/to/rules-file'cached_data=sharedselects=verify_cacheablecache_in_transactions=neverdebug=31enabled=false* `never`: No invalidation is performed. This is the default.
* `current`: When a modification is made, entries in the cache used by
the current session are invalidated. Other sessions that use the same
cache will also be affected, but sessions that use another cache will
not.* `mixed`: The data of different users is stored in the same
cache. This is the default and may cause that a user can
access data he should not have access to.
* `isolated`: Each user has a unique cache and there can be
no unintended sharing.timeout=7000msSET @maxscale.cache.populate=TRUE;
SELECT a, b FROM tbl;
SET @maxscale.cache.populate=FALSE;
SELECT a, b FROM tbl;SELECT @maxscale.cache.populate;SET @maxscale.cache.use=TRUE;
SELECT a, b FROM tbl;
SET @maxscale.cache.use=FALSE;
SELECT a, b FROM tbl;SELECT @maxscale.cache.use;SET @maxscale.cache.soft_ttl=600;
SELECT a, b FROM unimportant;
SET @maxscale.cache.soft_ttl=60;
SELECT c, d FROM important;SELECT @maxscale.cache.soft_ttl;SET @maxscale.cache.soft_ttl=600, @maxscale.cache.hard_ttl=610;
SELECT a, b FROM unimportant;
SET @maxscale.cache.soft_ttl=60, @maxscale.cache.hard_ttl=65;
SELECT c, d FROM important;SELECT @maxscale.cache.hard_ttl;[TheCache]
type=filter
module=cache
enabled=falseSET @maxscale.cache.populate=TRUE;
SELECT a, b FROM tbl1;
SELECT c, d FROM tbl2;
SELECT e, f FROM tbl3;
SET @maxscale.cache.populate=FALSE;SET @maxscale.cache.use=TRUE;
SELECT a, b FROM tbl1;
SET @maxscale.cache.use=FALSE;UPDATE tbl1 SET a = ...;
SET @maxscale.cache.populate=TRUE;
SELECT a, b FROM tbl1;
SET @maxscale.cache.populate=FALSE;{
store: [ ... ],
use: [ ... ]
}[
{
store: [ ... ],
use: [ ... ]
},
{ ... }
]{
"attribute": <string>,
"op": <string>
"value": <string>
}SELECT * FROM db1.tblUSE db1;
SELECT * FROM tblSELECT * FROM tbl WHERE a = 2 AND b = 3;SELECT * FROM tbl WHERE b = 3 AND a = 2;SELECT a FROM tbl;SELECT b FROM tbl WHERE a > 5;USE somedb;
SELECT fld FROM tbl;{
"store": [
{
"attribute": "database",
"op": "=",
"value": "db1"
}
]
}{
"store": [
{
"attribute": "table",
"op": "!=",
"value": "tbl1"
}
]
}{
"store": [
{
"attribute": "table",
"op": "!=",
"value": "db1.tbl1"
}
]
}{
"store": [
{
"attribute": "query",
"op": "like",
"value": ".*WHERE.*"
}
]
}{
"attribute": <string>,
"op": <string>
"value": <string>
}{
"attribute": "user",
"op": "=",
"value": "'bob'@'%'"
}
{
"attribute": "user",
"op": "like",
"value": "bob@.*"
}{
"use": [
{
"attribute": "user",
"op": "!=",
"value": "admin"
}
]
}MySQL [testdb]> select * from access;
ERROR 1142 (42000): SELECT command denied to user 'bob'@'localhost' for table 'access'{
"store": [
{
"attribute": "table",
"op": "=",
"value": "access"
}
]
}MySQL [testdb]> select * from access;
+------+------+
| a | b |
+------+------+
| 47 | 11 |
+------+------+MySQL [testdb]> select current_user();
+----------------+
| current_user() |
+----------------+
| bob@127.0.0.1 |
+----------------+
1 row in set (0.00 sec)
MySQL [testdb]> select * from access;
+------+------+
| a | b |
+------+------+
| 47 | 11 |
+------+------+{
"store": [
{
"attribute": "table",
"op": "=",
"value": "access"
}
],
"use": [
{
"attribute": "user",
"op": "=",
"value": "'alice'@'%'"
}
]
}storage=storage_inmemorystorage=storage_gridgain[MyCache]
...
storage=storage_gridgain
storage_gridgain.endpoints=127.0.0.1storage=storage_memcached[Cache-Filter]
type=filter
module=cache
storage=storage_memcached
storage_memcached.server=192.168.1.31
storage_memcached.max_value_size=10Mstorage_options="server=192.168.1.31,max_value_size=10M"storage=storage_redis[Cache-Filter]
type=filter
module=cache
storage=storage_redis
storage_redis.server=192.168.1.31
storage_redis.username=hello
storage_redis.password=worldstorage_options="server=192.168.1.31,username=hello,password=world"$ redis-cli flushall[MyCache]
type=filter
module=cache
storage=storage_inmemory
soft_ttl=30
hard_ttl=45
cached_data=shared
max_size=50Mi
rules=cache_rules.json
[MyService]
type=service
...
filters=MyCache{
"store": [
{
"attribute": "table",
"op": "=",
"value": "sbtest"
}
]
}{
"store": [
{
"attribute": "database",
"op": "=",
"value": "db1"
}
]
}{
"store": [
{
"attribute": "query",
"op": "like",
"value": "FROM db1\\..*"
}
]
}{
"attribute": "query",
"op": "unlike",
"value": "FROM nomatch"
}{
"attribute": "database",
"op": "!=",
"value": "nomatch"
}Complete MariaDB MaxScale configuration guide. Complete reference for listeners, servers, monitors, routers, and SSL settings with comprehensive examples and.
grep -Eautooracleon_errorneveron_closeTLSv1.0TLSv1.1TLSv1.2TLSv1.3TLSv10TLSv11TLSv12TLSv13HS256HS384HS512RS256RS384RS512PS256PS384PS512ES256ES384ES512ED25519ED448ED448HS256implicitcodePUTPOSTPATCHDELETEHEADOPTIONSCONNECTTRACE0sfile_only_alwaysTLSv1.0TLSv1.1TLSv1.2TLSv1.3TLSv10TLSv11TLSv12TLSv13# This is a comment before a parameter
some_parameter=123[MyService]
type=service
router=readconnroute
servers=server1,
server2,
server3max_size=1099511628000
max_size=1073741824Ki
max_size=1048576Mi
max_size=1024Gi
max_size=1Timax_size=1000000000000
max_size=1000000000k
max_size=1000000M
max_size=1000G
max_size=1Tsoft_ttl=1h
soft_ttl=60m
soft_ttl=60min
soft_ttl=3600s
soft_ttl=3600000mssome_param=42%router_options=master,slavepath_list_parameter=/tmp/something.log:/var/log/maxscale/maxscale.log# Valid options are:
# threads=[<number of threads> | auto ]
[MaxScale]
threads=autorebalance_period=10srebalance_threshold=15auth_connect_timeout=10s# Note: to get a clean compressed file, kill the 'tail' process and instead of
# using Ctrl+C to kill 'gzip'.
tail -F /var/log/maxscale/maxscale.trace | gzip > maxscale.trace.gz# Valid options are:
# log_augmentation=<0|1>
log_augmentation=1# A valid value looks like
# log_throttling = X, Y, Z
#
# where the first value X is a positive integer and means the number of times
# a specific error may be logged within a duration of Y, before the logging
# of that error is suppressed for a duration of Z.
log_throttling=8, 2s, 15000mslog_throttling=log_throttling=0, 0, 0logdir=/var/log/maxscale/datadir=/var/lib/maxscale/libdir=/usr/lib64/maxscale/connector_plugindir=/usr/lib64/maxscale/plugin/persistdir=/var/lib/maxscale/maxscale.cnf.d/module_configdir=/etc/maxscale.modules.d/# 1MB query classifier cache
query_classifier_cache_size=1MBsome_parameter=$SOME_VALUEsubstitute_variables=truesql_mode=oracleset sql_mode=oracle;set sql_mode=default;local_address=192.168.1.254users_refresh_time=120susers_refresh_interval=2hretain_last_statements=20session_trace=20session_trace=1000
session_trace_match=/You have an error in your SQL syntax/REST API HTTP daemon error: Setting priorities to ... failed: The request is invalid.admin_ssl_cipher=SECURE256:-ECDHE-RSA:-AES-256-CCM:+AES-128-GCMadmin_readwrite_hosts=192.168.1.1,127.0.0.1/21admin_readonly_hosts=mydomain%.comGRANT SELECT, INSERT, UPDATE, CREATE ON `mysql`.`maxscale_config`CREATE TABLE IF NOT EXISTS mysql.maxscale_config(
cluster VARCHAR(256) PRIMARY KEY,
version BIGINT NOT NULL,
config JSON NOT NULL,
origin VARCHAR(254) NOT NULL,
nodes JSON NOT NULL
) ENGINE=InnoDB;key_manager=file
file.keyfile=/path/to/keyfileevent.X.facility=LOG_LOCAL0
event.X.level=LOG_ERRauth,authpriv.* /var/log/auth.logevent.authentication_failure.facility=LOG_AUTH
event.authentication_failure.level=LOG_CRITevent_firewall_incident_facility=LOG_AUTH
event_firewall_incident_level=LOG_CRIT[Test-Service]
type=servicerouter=readconnroute
router_options=slaverouter=readconnroute
router_options=master,slavefilters=counter | QLAtargets=My-Service,server2servers=server1,server2,server3cluster=TheMonitoruser=maxscale
password=Mhu87p2Duser=maxscale
password=Mhu87p2Dversion_string=10.11.2-MariaDB-RWsplit[Test-Service]
wait_timeout=300s[Test-Service]
max_connections=100session_track_state_change = ON
session_track_transaction_info = CHARACTERISTICSmaxctrl alter service MyService retain_last_statements 5SET @my_planet='Earth'; -- This command will be removed by history simplification
SET @my_home='My home is: ' || @my_planet; -- Command #1 in the history
SET @my_planet='Earth'; -- Command #2 in the historyuser_accounts_file=/home/root/users.json{
"user": [
{
"user": "test1",
"host": "%",
"global_db_priv": true
},
{
"user": "test2",
"host": "127.0.0.1",
"password": "*032169CDF0B90AF8C00992D43D354E29A2EACB42",
"plugin": "mysql_native_password",
"default_role": "role2"
},
{
"user": "",
"host": "%",
"plugin": "pam",
"proxy_priv": true
}
],
"db": [
{
"user": "test2",
"host": "127.0.0.1",
"db": "test"
}
],
"roles_mapping": [
{
"user": "test2",
"host": "127.0.0.1",
"role": "role2"
}
]
}user_accounts_file_usage=file_only_alwaysidle_session_pool_time=900msmax_slave_connections=1
lazy_connect=1
transaction_replay=true[server1]
type=server
max_routing_connections=1000 #this should be based on MariaDB Server capacity
persistpoolmax=1000 #same as above
persistmaxtime=10
#other server settings...
[myservice]
type=service
max_slave_connections=1
transaction_replay=true
idle_session_pool_time=500ms
lazy_connect=1
#other service settings...multiplex_timeout=33s[MyMariaDBServer1]
type=server
address=127.0.0.1
port=3000[MyListener1]
type=listener
service=MyService1
port=3006[Monitor1]
type=monitor
module=mariadbmon
user=the_user
password=the_password
handle_events=false
monitor_interval=2000ms
backend_connect_timeout = 3s
backend_connect_attempts = 5
servers=Server1, Server2
[Monitor2]
type=monitor
module=mariadbmon
user=the_user
password=the_password
handle_events=false
monitor_interval=2000ms
backend_connect_timeout = 3s
backend_connect_attempts = 5
servers=Server3, Server4[Monitor-Common]
type=include
module=mariadbmon
user=the_user
password=the_password
handle_events=false
monitor_interval=2000ms
backend_connect_timeout = 3s
backend_connect_attempts = 5
[Monitor1]
type=monitor
@include=Monitor-Common
servers=Server1, Server2
[Monitor2]
type=monitor
@include=Monitor-Common
servers=Server3, Server3@include=Some-Common-Attributes, Other-Common-Attributes[Monitor2]
type=monitor
@include=Monitor-Common
servers=Server3, Server3
backend_connect_timeout = 5s[Monitor-Common]
type=include
@include=Base-Common
...
[Monitor2]
type=monitor
@include=Monitor1
...ssl_passphrase=env:MY_SECRET_PASSWORD
ssl_passphrase=file:/path/to/pass.txt
ssl_passphrase=pass:MySecretPasswordssl_verify_peer_certificate=true
ssl_verify_peer_host=true[server1]
type=server
address=10.131.24.62
port=3306
ssl=true
ssl_cert=/usr/local/mariadb/maxscale/ssl/crt.max-client.pem
ssl_key=/usr/local/mariadb/maxscale/ssl/key.max-client.pem
ssl_ca_cert=/usr/local/mariadb/maxscale/ssl/crt.ca.maxscale.pem[RW-Split-Listener]
type=listener
service=RW-Split-Router
port=3306
ssl=true
ssl_cert=/usr/local/mariadb/maxscale/ssl/crt.maxscale.pem
ssl_key=/usr/local/mariadb/maxscale/ssl/key.csr.maxscale.pem
ssl_ca_cert=/usr/local/mariadb/maxscale/ssl/crt.ca.maxscale.pem# Usage: maxkeys [PATH]
maxkeys /var/lib/maxscale/# Usage: maxpasswd PATH PASSWORD
maxpasswd /var/lib/maxscale/ MaxScalePw001
61DD955512C39A4A8BC4BB1E5F116705[Split-Service]
type=service
router=readwritesplit
servers=server1,server2,server3,server4
user=maxscale
password=61DD955512C39A4A8BC4BB1E5F116705├──────────────┼─────────────────────────────────────────────────────────────┤
│ Config Sync │ { │
│ │ "checksum": "3dd6b467760d1d2023f2bc3871a60dd903a3341e", │
│ │ "nodes": { │
│ │ "maxscale": "OK", │
│ │ "maxscale2": "OK" │
│ │ }, │
│ │ "origin": "maxscale", │
│ │ "status": "OK", │
│ │ "version": 2 │
│ │ } │
├──────────────┼─────────────────────────────────────────────────────────────┤maxctrl alter maxscale config_sync_cluster ""maxscale --export-config=/tmp/maxscale.cnf.combined[maxscale]
key_manager=file
file.keyfile=/var/lib/maxscale/encryption.key
[NoSQL-Listener]
type=listener
service=My-Service
protocol=nosqlprotocol
nosqlprotocol.authentication_key_id=1
nosqlprotocol.authentication_user=my_user
nosqlprotocol.authentication_password=my_password
# Add services, servers, monitors etc.$ openssl rand -hex 32|vault kv put secret/1 data=-
== Secret Path ==
secret/data/1
======= Metadata =======
Key Value
--- -----
created_time 2022-06-23T06:50:55.29063873Z
custom_metadata <nil>
deletion_time n/a
destroyed false
version 1$ bin/maxctrl show threads
┌────────────────────────┬────────┬────────┬────────┬────────┬─────┐
│ Id │ 0 │ 1 │ 2 │ 3 │ All │
├────────────────────────┼────────┼────────┼────────┼────────┼─────┤
│ State │ Active │ Active │ Active │ Active │ N/A │
├────────────────────────┼────────┼────────┼────────┼────────┼─────┤
...$ bin/maxctrl alter maxscale threads=2
OK
$ bin/maxctrl show threads
┌────────────────────────┬────────┬────────┬──────────┬──────────┬─────────┐
│ Id │ 0 │ 1 │ 2 │ 3 │ All │
├────────────────────────┼────────┼────────┼──────────┼──────────┼─────────┤
│ State │ Active │ Active │ Draining │ Draining │ N/A │
├────────────────────────┼────────┼────────┼──────────┼──────────┼─────────┤
...┌────────────────────────┬────────┬────────┬─────────┬──────────┬────────┐
│ Id │ 0 │ 1 │ 2 │ 3 │ All │
├────────────────────────┼────────┼────────┼─────────┼──────────┼────────┤
│ State │ Active │ Active │ Dormant │ Draining │ N/A │
├────────────────────────┼────────┼────────┼─────────┼──────────┼────────┤
...$ bin/maxctrl show threads
┌────────────────────────┬────────┬────────┬──────┐
│ Id │ 0 │ 1 │ All │
├────────────────────────┼────────┼────────┼──────┤
│ State │ Active │ Active │ N/A │
├────────────────────────┼────────┼────────┼──────┤
...$ bin/maxctrl show threads
┌────────────────────────┬────────┬────────┬─────────┬──────────┬────────┐
│ Id │ 0 │ 1 │ 2 │ 3 │ All │
├────────────────────────┼────────┼────────┼─────────┼──────────┼────────┤
│ State │ Active │ Active │ Dormant │ Draining │ N/A │
├────────────────────────┼────────┼────────┼─────────┼──────────┼────────┤
...$ bin/maxctrl alter maxscale threads=3
OK
wikman@johan-P53s:maxscale $ bin/maxctrl show threads
┌────────────────────────┬────────┬────────┬────────┬──────────┬────────┐
│ Id │ 0 │ 1 │ 2 │ 3 │ All │
├────────────────────────┼────────┼────────┼────────┼──────────┼────────┤
│ State │ Active │ Active │ Active │ Draining │ N/A │
├────────────────────────┼────────┼────────┼────────┼──────────┼────────┤
...$ bin/maxctrl show threads
┌────────────────────────┬────────┬────────┬────────┬──────┐
│ Id │ 0 │ 1 │ 2 │ All │
├────────────────────────┼────────┼────────┼────────┼──────┤
│ State │ Active │ Active │ Active │ N/A │
├────────────────────────┼────────┼────────┼────────┼──────┤
...$ maxctrl show maxscale
...
├──────────────┼────────────────────────────────────────────────────────────────────────────┤
│ System │ { │
│ │ "machine": { │
│ │ "cores_available": 8, │
│ │ "cores_physical": 8, │
│ │ "cores_virtual": 4, │
│ │ "memory_available": 20858544128, │
│ │ "memory_physical": 41717088256 │
│ │ }, │
│ │ "maxscale": { │
│ │ "query_classifier_cache_size": 6257563238, │
│ │ "threads": 8 │
│ │ }, │
│ │ "os": { │
│ │ "machine": "x86_64", │
│ │ "nodename": "johan-P53s", │
│ │ "release": "5.4.0-125-generic", │
│ │ "sysname": "Linux", │
│ │ "version": "#141~18.04.1-Ubuntu SMP Thu Aug 11 20:15:56 UTC 2022" │
│ │ } │
│ │ } │
└──────────────┴────────────────────────────────────────────────────────────────────────────┘[maxscale]
threads=4
query_classifier_cache_size=3100000000
...WatchdogSec=30s
PUTPOSTPATCHDELETEHEADOPTIONSCONNECTTRACEHS256HS384HS512RS256RS384RS512PS256PS384PS512ES256ES384ES512ED25519ED448implicitcodeTLSv1.0TLSv1.1TLSv1.2TLSv1.3TLSv10TLSv11TLSv12TLSv13on_errorneveroracleautofile_only_always0sTLSv1.0TLSv1.1TLSv1.2TLSv1.3TLSv10TLSv11TLSv12TLSv130""oracle""upreadwritesecondary""mariadbpassword_2FAsuidread_only_transactionsall_transactionsthread_specificcurrentverify_cacheableisolatedcaseextendedabortalwayserrorokcaseextendedsessiondateuserreply_timetotal_reply_timequerydefault_dbnum_rowsreply_sizetransactiontransaction_timenum_warningserror_msgunifiedstdoutignorecaseextendedcaseextendedcaseextendedcaseextendedmaster_upslave_downslave_upserver_downserver_uplost_masterlost_slavenew_masternew_slaveorgaleramonwsrep_local_indexmajority_of_allmajority_of_runningconnecting_slaveconnected_slaverunning_slaveprimary_monitor_masterdisk_space_oklinked_masterrunning_masterwritable_masterprimary_monitor_masteronyes1falseoffno0safe35data.attributes.parameters.userdata.attributes.parameters.userzstandardAES_CTRAES_GCMotherignoreon_discrepancyneverread_writeactivate-onlycustom:<path>disabledSCRAM-SHA-256SCRAM-SHA-512SCRAM-SHA-256SCRAM-SHA-512keyfilekafkaslavesyncedrunninglocalglobalfastfast_globaluniversalfast_universalfail_on_writeerror_on_writeadaptive_routingleast_behind_masterleast_router_connectionsleast_global_connectionssofthardresult_onlyno_insert_idall