Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
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.
Access essential guides for deploying MariaDB MaxScale including installation, configuration, upgrades, and using the MaxGUI browser-based interface for management and monitoring.
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.
We recommend to install MaxScale on a separate server, to ensure that there can be no competition of resources between MaxScale and a MariaDB Server that it manages.
The recommended approach is to use to install MaxScale. After enabling the repository by following the instructions, MaxScale can be installed with the following commands.
For RHEL/Rocky Linux/Alma Linux, use dnf install maxscale.
For Debian and Ubuntu, run apt update followed by apt install maxscale.
For SLES, use zypper install maxscale.
Download the correct MaxScale package for your CPU architecture and operating system from the . MaxScale can be installed with the following commands.
For RHEL/Rocky Linux/Alma Linux, use dnf install /path/to/maxscale-*.rpm
For Debian and Ubuntu, use apt install /path/to/maxscale-*.deb.
For SLES, use zypper install /path/to/maxscale-*.rpm.
MaxScale can also be installed using a tarball. This may be required if you are using a Linux distribution for which there exist no installation package or if you want to install many different MaxScale versions side by side. For instructions on how to do that, please refer to .
Alternatively, you may download the MariaDB MaxScale source and build your own binaries. To do this, refer to the separate document .
MaxScale assumes that memory allocations always succeed and in general does not check for memory allocation failures. This assumption is compatible with the Linux kernel parameter having the value 0, which is also the default on most systems.
With vm.overcommit_memory being 0, memory allocations made by an application never fail, but instead the application may be killed by the so-called OOM (out-of-memory) killer if, by the time the application actually attempts to use the allocated memory, there is not available free memory on the system.
If the value is 2, then a memory allocation made by an application may fail and unless the application is prepared for that possibility, it will likely crash with a SIGSEGV. As MaxScale is not prepared to handle memory allocation failures, it will crash in this situation.
The current value of vm.overcommit_memory can be checked with this command:
Alternatively, use this command:
covers the first steps in configuring your MariaDB MaxScale installation. Follow this tutorial to learn how to configure and start using MaxScale.
For a detailed list of all configuration parameters, refer to the and the module specific documents found in the .
Read the section of the configuration guide to set up password encryption for the configuration file.
There are various administration tasks that may be done with MariaDB MaxScale. A command line tools is available, , that interacts with a running MariaDB MaxScale and allows the status of MariaDB MaxScale to be monitored and give some control of the MariaDB MaxScale functionality.
The covers the common administration tasks that need to be done with MariaDB MaxScale.
The main configuration file for MaxScale is in /etc/maxscale.cnf and additional user-created configuration files are in /etc/maxscale.cnf.d/. Objects created or modified at runtime are stored in /var/lib/maxscale/maxscale.cnf.d/. Some modules also store internal data in /var/lib/maxscale/ named after the module or the configuration object.
The simplest way to back up the configuration and runtime data of a MaxScale installation is to create an archive from the following files and directories:
/etc/maxscale.cnf
/etc/maxscale.cnf.d/
/var/lib/maxscale/
This can be done with the following command:
If MaxScale is configured to store data in custom locations, these should be included in the backup as well.
This page is licensed: CC BY-SA / Gnu FDL
sysctl vm.overcommit_memorycat /proc/sys/vm/overcommit_memorytar -caf maxscale-backup.tar.gz /etc/maxscale.cnf /etc/maxscale.cnf.d/ /var/lib/maxscale/Manage MariaDB MaxScale visually with MaxGUI. This browser-based dashboard simplifies configuration, monitoring, and administration tasks for your database proxy instances.
Manage your MariaDB MaxScale instance using MaxCtrl, a command-line utility for the REST API. Monitor status, configure services, and handle administrative tasks efficiently.
Perform day-to-day operations on MaxScale. This section covers managing REST API users, rotating logs, and enabling TLS for secure client connections.
TLS
MaxGUI
Operations
This page is: Copyright © 2025 MariaDB. All rights reserved.
Enable remote management by configuring the MaxScale REST API. Learn to set listening ports, bind addresses, and secure administrative traffic with TLS.
MaxScale's MaxScale's REST API is used by both MaxCtrl and MaxGUI.
The REST API is enabled by default. However, the default configuration is not optimal for production systems, because:
It only allows requests from the local host address by default.
It does not use TLS by default.
It used a hard-coded user (admin) and password (mariadb) by default.
for remote connections by configuring several global parameters in maxscale.cnf.
For example:
Restart the MaxScale instance.
This page is: Copyright © 2025 MariaDB. All rights reserved.
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.
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.
MaxScale has a , which can be configured to require authentication. When first installed, it has a single default admin user (admin) and password (mariadb). However, this user can be deleted, and other users can be created.
MaxCtrl is a command-line utility that can perform administrative tasks using MaxScale's . It can create a user for the REST API.
To enable MaxGUI in a testing mode, add admin_host=0.0.0.0 and admin_secure_gui=false under the [maxscale] section of the MaxScale configuration file. Once enabled, MaxGUI will be available on port 8989: http://127.0.0.1:8989/
To make MaxGUI secure, set admin_secure_gui=true and configure both theadmin_ssl_key and admin_ssl_cert parameters.
See Configuration Guide and Configuration and Hardening for instructions on how to harden your MaxScale installation for production use.
MaxGUI uses the same credentials as maxctrl. The default username is admin with mariadb as the password.
Internally, MaxGUI uses JSON Web Tokens as the authentication method for persisting the user's session. If the Remember me checkbox is ticked, the session will persist for 24 hours. Otherwise, the session will expire as soon as MaxGUI is closed.
To log out, simply click the username section in the top right corner of the page header to access the logout menu.
This page provides an overview of MaxScale configuration which includes Monitors, Servers, Services, Sessions, Listeners, and Filters.
By default, the refresh interval is 10 seconds.
This page shows information on each MaxScale object and allow to edit its parameter, relationships and perform other manipulation operations.
Access this page by clicking on the MaxScale object name on the dashboard page
This page visualizes MaxScale configuration and clusters.
Configuration: Visualizing MaxScale configuration.
Cluster: Visualizing a replication cluster into a tree graph and provides manual cluster manipulation operations such asswitchover, reset-replication, release-locks, failover, rejoin . At the moment, it supports only servers monitored by Monitor using mariadbmon module.
Access this page by clicking the graph icon on the sidebar navigation.
This page shows and allows editing of MaxScale parameters.
Access this page by clicking the gear icon on the sidebar navigation.
Realtime MaxScale logs can be accessed by clicking the logs icon on the sidebar navigation.
The "Workspace" page offers a versatile set of tools for effectively managing data and database interactions. It includes the following key tasks:
Execute queries on various servers, services, or listeners to retrieve data and perform database operations. Visualize query results using different graph types such as line, bar, or scatter graphs. Export query results in formats like CSV or JSON for further analysis and sharing.
The "Data Migration" feature facilitates seamless transitions from PostgreSQL to MariaDB. Transfer data and database structures between the two systems while ensuring data integrity and consistency throughout the process.
Generating Entity-Relationship Diagrams (ERDs) to gain insights regarding data structure, optimizing database design for both efficiency and clarity.
This page is licensed: CC BY-SA / Gnu FDL
• This parameter defines the network address that the REST API listens on.• The default value is 127.0.0.1.
• This parameter defines the network port that the REST API listens on.• The default value is 8989.
There are two types of users:
Basic
The user has read-only access
Admin
The user can change global MaxScale parameters and reconfigure modules.
Configure the REST API if the default configuration is not sufficient.
Use MaxCtrl to execute the create user command:
Replace maxscale_rest and maxscale_rest_password with the desired user and password.
Configure the REST API if the default configuration is not sufficient.
Use MaxCtrl to execute the create user command with the --type=admin option:
Replace maxscale_rest_admin and maxscale_rest_admin_password with the desired user and password.
This page is: Copyright © 2025 MariaDB. All rights reserved.
[maxscale]
...
admin_host = 0.0.0.0
admin_port = 8443$ 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" "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=adminInstall MariaDB MaxScale manually using generic tarball binaries. Learn the system requirements, directory setup, and configuration steps to run MaxScale without a package manager.
MariaDB MaxScale is also made available as a tarball, which is named likemaxscale-x.y.z.OS.tar.gz where x.y.z is the same as the corresponding version and OS identifies the operating system, e.g. maxscale-2.5.6.centos.7.tar.gz.
In order to use the tarball, the following libraries are required:
libcurl
libaio
OpenSSL
gnutls
The tarball has been built with the assumption that it will be installed in /usr/local. However, it is possible to install it in any directory, but in that case MariaDB MaxScale must be invoked with a flag.
/usr/localIf you have root access to the system you probably want to install MariaDB MaxScale under the user and group maxscale.
The required steps are as follows:
Creating the symbolic link is necessary, since MariaDB MaxScale has been built with the assumption that the plugin directory is /usr/local/maxscale/lib/maxscale.
The symbolic link also makes it easy to switch between different versions of MariaDB MaxScale that have been installed side by side in /usr/local; just make the symbolic link point to another installation.
In addition, the first time you install MariaDB MaxScale from a tarball you need to create the following directories:
and make maxscale the owner of them:
The following step is to create the MariaDB MaxScale configuration file /etc/maxscale.cnf. The file etc/maxscale.cnf.template can be used as a base. Please refer to for details.
When the configuration file has been created, MariaDB MaxScale can be started.
The -d flag causes maxscale not to turn itself into a daemon, which is advisable the first time MariaDB MaxScale is started, as it makes it easier to spot problems.
If you want to place the configuration file somewhere else but in /etc you can invoke MariaDB MaxScale with the --config flag, for instance, --config=/usr/local/maxscale/etc/maxscale.cnf.
Note also that if you want to keep everything under /usr/local/maxscale you can invoke MariaDB MaxScale using the flag --basedir.
That will cause MariaDB MaxScale to look for its configuration file in/usr/local/maxscale/etc and to store all runtime files under /usr/local/maxscale/var.
Enter a directory where you have the right to create a subdirectory. Then do as follows.
The next step is to create the MaxScale configuration file maxscale-x.y.z/etc/maxscale.cnf. The file maxscale-x.y.z/etc/maxscale.cnf.template can be used as a base. Please refer to for details.
When the configuration file has been created, MariaDB MaxScale can be started.
With the flag --basedir, MariaDB MaxScale is told where the lib, etc and var directories are found. Unless it is specified, MariaDB MaxScale assumes the lib directory is found in /usr/local/maxscale, and the var and etc directories in /.
It is also possible to specify the directories and the location of the configuration file individually. Invoke MaxScale like
to find out the appropriate flags.
This page is licensed: CC BY-SA / Gnu FDL
Safely remove a server from rotation using the MaxGUI dashboard. This guide shows how to enable maintenance mode to stop traffic routing and gracefully drain connections for upgrades.
When using MaxScale, it is often necessary to temporarily remove a server from the load balancing pool without actually shutting down the server. This is usually needed to perform maintenance on the server, such as when upgrading the server's software or when performing schema upgrades.
MaxScale allows users to set servers to "maintenance mode", which prevents MaxScale from routing traffic to the server and prevents it from being elected as the new primary server during failover or switchover.
MaxGUI is a graphical utility that can perform administrative tasks using MaxScale's MaxScale's REST API. It can be used to set a server to maintenance mode.
.
Visit MaxGUI in your web browser. For example, if you are accessing it from local host with the default port, then visit this address:
Enter your username and password to log in.
On the dashboard, the "Servers" tab is shown by default.
Visit MaxGUI in your web browser. For example, if you are accessing it from local host with the default port, then visit this address:
Enter your user and password to login.
On the dashboard, the "Servers" tab is shown by default.
This page is: Copyright © 2025 MariaDB. All rights reserved.
Compare the available tools for managing MaxScale. Understand the differences between the MaxCtrl command-line utility, the MaxGUI web interface, and the REST API.
MariaDB MaxScale provides various administrative interfaces can be used to perform the following tasks:
Setting a server to maintenance mode.
Reconfiguring monitors.
Reconfiguring routers.
And much more.
MaxScale supports different administrative interfaces for different kinds of environments and preferences:
This page is: Copyright © 2025 MariaDB. All rights reserved.
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.
MaxScale has a REST API, which can be configured to require authentication. When it is first installed, it has a single default admin user (admin) and password (mariadb). However, this user can be deleted, and other users can be created.
MaxCtrl is a command-line utility that can perform administrative tasks using MaxScale's REST API. It can be used to delete a user for the REST API.
if the default configuration is not sufficient.
Use MaxCtrl to execute the command:
Replace admin with the actual user.
This page is: Copyright © 2025 MariaDB. All rights reserved.
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.
When using MaxScale, it is often necessary to temporarily remove a server from the load balancing pool without actually shutting down the server. This is usually needed to perform maintenance on the server, such as when upgrading the server's software or when performing schema upgrades.
MaxScale allows users to set servers to "maintenance mode", which prevents MaxScale from routing traffic to the server and prevents it from being elected as the new primary server during failover or switchover.
MaxCtrl is a command-line utility that can perform administrative tasks using MaxScale's REST API. It can be used to set a server to maintenance mode.
Configure the REST API if the default configuration is not sufficient.
Use MaxCtrl to execute the set server command with the maintenance option:
Replace server1 with the name of the specific server.
If the specified server is a primary server, then MaxScale will allow open transactions to complete before closing any connections.
Use MaxCtrl to execute the set server command with the maintenance --force option:
Replace server1 with the specific server name. When --force is used, MaxScale immediately closes all connections, even if the server is a primary server with open transactions.
This page is: Copyright © 2025 MariaDB. All rights reserved.
Enable the MaxGUI dashboard by configuring the MaxScale REST API. Learn to set up network listeners, enable TLS security, and create the required administrative user credentials.
Compile MariaDB MaxScale from source code. This guide details the build prerequisites, CMake configuration options, and steps to generate custom binary packages for your system.
Click the server that you want to set to maintenance mode. This will bring up a page for the specific server.
Click the gear icon at the top left corner of the page next to the server name. This will show some options in a popup.
Click the pause icon. This will open a popup window.
Click the "Maintain" button. If the specified server is a primary server, then MaxScale will allow open transactions to complete before closing any connections.
Click the server that you want to set to maintenance mode. This will bring up a page for the specific server.
Click the gear icon at the top left corner of the page next to the server name. This will show some options in a popup.
Click the pause icon. This will open a popup window.
Check the "Force closing" checkbox.
Click the "Maintain" button. When the "Force closing" checkbox is specified, MaxScale immediately close all connections, even if the server is a primary server that has open transactions.
Command-line administrative utility.
Graphical administrative utility.
REST API for programmatic administration.
unixODBC
GCC version 4.9 or later
OpenSSL version 1.1.1 or later
GNUTLS
Node.js 14 or newer for building MaxCtrl and the GUI (webpack), Node.js 10 or newer for running MaxCtrl
PAM
SASL2 (cyrus-sasl)
SQLite3 version 3.3 or later
Tcl
git
jansson
libatomic
libcurl
libmicrohttpd
libuuid
libxml2
libssh
pcre2
zstd
This is the minimum set of requirements that must be met to build the MaxScale core package. Some modules in MaxScale require optional extra dependencies.
libuuid (binlogrouter)
boost (binlogrouter)
Bison 2.7 or later (dbfwfilter)
Flex 2.5.35 or later (dbfwfilter)
librdkafka (kafkacdc, kafkaimporter and mirror)
memcached (storage_memcached for the cache filter)
hiredis (storage_redis for the cache filter)
Some of these dependencies are not available on all operating systems and are downloaded automatically during the build step. To skip the building of modules that need automatic downloading of the dependencies, use -DBUNDLE=N when configuring CMake.
This installs MaxScale as if it was installed from a package. Install git before running the following commands.
For a definitive list of packages, consult the install_build_deps.sh script.
The tests and other parts of the build can be controlled via CMake arguments.
Here is a small table with the names of the most common parameters and what they control. These should all be given as parameters to the -D switch in NAME=VALUE format (e.g. -DBUILD_TESTS=Y).
CMAKE_INSTALL_PREFIX
Location where MariaDB MaxScale will be installed to. Set this to /usr if you want MariaDB MaxScale installed into the same place the packages are installed.
BUILD_TESTS
Build unit tests
WITH_SCRIPTS
Install systemd and init.d scripts
PACKAGE
Enable building of packages
TARGET_COMPONENT
Which component to install, default is the 'core' package. Other targets are 'experimental', which installs experimental packages and 'all' which installs all components.
TARBALL
Build tar.gz packages, requires PACKAGE=Y
Note: You can look into defaults.cmake for a list of the CMake variables.
To run the MaxScale unit test suite, configure the build with -DBUILD_TESTS=Y, compile and then run the make test command.
If you wish to build packages, just add -DPACKAGE=Y to the CMake invocation and build the package with make package instead of installing MaxScale withmake install. This process will create a RPM/DEB package depending on your system.
To build a tarball, add -DTARBALL=Y to the cmake invocation. This will create a maxscale-x.y.z.tar.gz file where x.y.z is the version number.
Some Debian and Ubuntu systems suffer from a bug where make package fails with errors from dpkg-shlibdeps. This can be fixed by running make beforemake package and adding the path to the libmaxscale-common.so library to the LD_LIBRARY_PATH environment variable.
The MaxScale build system is split into multiple components. The main component is the core MaxScale package which contains MaxScale and all the modules. This is the default component that is build, installed and packaged. There is also the experimental component that contains all experimental modules which are not considered as part of the core MaxScale package and are either alpha or beta quality modules.
To build the experimental modules along with the MaxScale core components, invoke CMake with -DTARGET_COMPONENT=core,experimental.
This page is licensed: CC BY-SA / Gnu FDL
$ 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$ 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"$ 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 git clone https://github.com/mariadb-corporation/MaxScale
mkdir build
cd build
../MaxScale/BUILD/install_build_deps.sh
cmake ../MaxScale -DCMAKE_INSTALL_PREFIX=/usr
make
sudo make install
sudo ./postinstmake
LD_LIBRARY_PATH=$PWD/server/core/ make packageIf you want to use MaxGUI remotely, configure the REST API for remote connections.
Several global parameters must be configured in maxscale.cnf.
• This parameter defines the network address that the REST API listens on.• The default value is 127.0.0.1.
• This parameter defines the network port that the REST API listens on.• The default value is 8989.
For example:
MaxGUI requires TLS, so you must enable TLS for MaxScale's REST API Several global parameters must be configured in maxscale.cnf.
* This parameter defines the private key used by the REST API.
* This parameter defines the certificate used by the REST API.
*This parameter defines the CA certificate that signed the REST API's certificate.
For example:
Ensure that the admin_gui global parameter is enable. It is enabled by default, so it will only be disabled if it was previously disabled manually.
Restart the MaxScale instance.
Create a new admin REST API user with MaxCtrl:
Replace maxscale_rest_admin and maxscale_rest_admin_password with the desired user and password.
Delete the default REST API named admin with MaxCtrl:
Visit MaxGUI in your web browser.
For example:
If you were accessing it from local host with the default port, then you would visit this address: 127.0.0.1:8989
If you were accessing it with the above example configuration, then you would visit this address: 192.168.2.100:8443
Enter your user and password to login.
This page is: Copyright © 2025 MariaDB. All rights reserved.
[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"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.
_MaxCtrl is a command-line utility that can perform administrative tasks using MaxScale's REST API. It is possible to connect to MaxScale using TLS with MaxCtrl.
or , depending on what kind of user you need:
Replace maxscale\_rest\_admin and maxscale\_rest\_admin\_password with the desired user and password.
If you want to use MaxCtrl remotely, . Several global parameters must be configured in maxscale.cnf.
For example:
Several global parameters must be configured in maxscale.cnf.
For example:
Ensure that the client also has a TLS certificate, a private key, and the CA certificate.
Use to connect with TLS:
Replace maxscale_rest_admin and maxscale_rest_admin_password with the actual user and password.
This page is: Copyright © 2025 MariaDB. All rights reserved.
Review the current constraints of MariaDB MaxScale. This document lists known issues regarding transaction parsing, protocol support, and specific module limitations.
This parameter defines the network address that the REST API listens on. The default value is 127.0.0.1.
This parameter defines the network port that the REST API listens on. The default value is 8989.
* This parameter defines the private key used by the REST API.
* This parameter defines the certificate used by the REST API.
*This parameter defines the CA certificate that signed the REST API's certificate.
In versions 2.1.2 and earlier, the configuration files are limited to 1024 characters per line. This limitation was increased to 16384 characters in MaxScale 2.1.3. MaxScale 2.3.0 increased this limit to 16777216 characters.
In versions 2.2.12 and earlier, the section names in the configuration files were limited to 49 characters. This limitation was increased to 1023 characters in MaxScale 2.2.13.
Starting with MaxScale 2.4.0, on systems with Linux kernels 3.9 or newer due to the addition of SO_REUSEPORT support, it is possible for multiple MaxScale instances to listen on the same network port if the directories used by both instances are completely separate and there are no conflicts which can cause unexpected splitting of connections. This will only happen if users explicitly tell MaxScale to ignore the default directories and will not happen in normal use.
The parser of MaxScale correctly parses WITH statements, but fails to collect columns, functions and tables used in the SELECT defining theWITH clause.
Consequently, the database firewall will not block WITH statements where the SELECT of the WITH clause refers to forbidden columns.
MaxScale assumes that certain configuration parameters in MariaDB are set to their default values. These include but are not limited to:
autocommit: Autocommit is enabled for all new connections.
tx_read_only: Transactions use READ WRITE permissions by default.
If a module in MaxScale requires tracking of transaction boundaries but does not require query classification, a custom parser is used to detect them. Currently the only situation in which this parser is used is when a readconnroute service uses the cache filter.
The custom parser detects a subset of the full SQL syntax used to start transactions. This means that more complex statements will not be fully parsed and will cause the transaction state to not match the real state on the database. For example, SET @my_var = (SELECT 1), autocommit = 0 is not parsed by the custom parser and causes the autocommit modification to not be noticed.
MaxScale will treat statements executed after XA START and before XA END as if they were executed in a normal read-write transaction started with START TRANSACTION. This means that only XA transactions in the ACTIVE state will be routed as transactions and all statements after XA END are routed normally.
XA transactions and normal transactions are mutually exclusive in MariaDB. This means that a START TRANSACTION command will fail if the connection already has an open XA transaction. MaxScale currently only inspects the SQL and deduces the transaction state from that. If a transaction fails to start due to an open XA transaction, the state in MaxScale and in MariaDB can be different and MaxScale will keep routing statements as if they were inside of a transaction. However, as this is an unlikely scenario, usually no action needs to be taken.
For its proper functioning, MaxScale needs in general to be aware of the transaction state and autocommit mode. In order to be that, MaxScale parses statements going through it.
However, if a transaction is committed or rolled back, or the autocommit mode is changed using a prepared statement, MaxScale will miss that and its internal state will be incorrect, until the transaction state or autocommit mode is changed using an explicit statement.
For instance, after the following sequence of commands, MaxScale will still think autocommit is on:
To ensure that MaxScale functions properly, do not commit or rollback a transaction or change the autocommit mode using a prepared statement.
Compression is not included in the server handshake.
If a KILL [CONNECTION] <ID> statement is executed, MaxScale will intercept it. If the ID matches a MaxScale session ID, it will be closed by sending modified KILL commands of the same type to all backend server to which the session in question is connected to. This results in behavior that is similar to how MariaDB does it. If the KILL CONNECTION USER <user> form is given, all connections with a matching username will be closed instead.
MariaDB MaxScale does not support KILL QUERY ID <query_id> type statements. If a query by a query ID is to be killed, it needs to be done directly on the backend databases.
Any KILL commands executed using a prepared statement are ignored by MaxScale. If any are executed, it is highly likely that the wrong connection ends up being killed.
If a KILL connection kills a session that is connected to a readwritesplit service that has transaction_replay or delayed_retry enabled, it is possible that the query is retried even if the connection is killed. To avoid this, use KILL QUERY instead.
A KILL on one service can cause a connection from another service to be closed even if it uses a different protocol.
The change user command (COM_CHANGE_USER) only works with standard authentication.
If a COM_CHANGE_USER succeeds on MaxScale yet fails on the server the session ends up in an inconsistent state. This can happen if the password of the target user is changed and MaxScale uses old user account data when processing the change user. In such a situation, MaxScale and server will disagree on the current user. This can affect e.g. reconnections.
MySQL old style passwords are not supported. MySQL versions 4.1 and newer use a new authentication protocol which does not support pre-4.1 style passwords.
When users have different passwords based on the host from which they connect MariaDB MaxScale is unable to determine which password it should use to connect to the backend database. This results in failed connections and unusable usernames in MariaDB MaxScale.
The Tee filter does not support binary protocol prepared statements. The execution of a prepared statements through a service that uses the tee filter is not guaranteed to succeed on the service where the filter branches to as it does on the original service.
This possibility exists due to the fact that the binary protocol prepared statements are identified by a server-generated ID. The ID sent to the client from the main service is not guaranteed to be the same that is sent by the branch service.
A server can only be monitored by one monitor. Two or more monitors monitoring the same server is considered an error.
The default master selection is based only on MIN(wsrep_local_index). This can be influenced with the server priority mechanic described in the Galera Monitor manual.
Refer to individual router documentation for a list of their limitations.
The ETL feature in MaxScale always uses the MariaDB Connector/ODBC driver to perform the data loading into MariaDB. The recommended minimum version of the connector is 3.1.18. Older versions of the driver suffer from problems that may manifest as crashes or memory leaks. The driver must be installed on the system in order for the ETL feature to work.
The data loading into MariaDB is done with autocommit, unique_checks and foreign_key_checks disabled inside of a single transaction. This is done to leverage the optimizations done for InnoDB that allows faster insertions into empty tables. When loading data into MariaDB versions 10.5 or older, this can translate into long rollback times in case the ETL operation fails.
For ETL operations that migrate data from PostgreSQL, we recommend using the official PostgreSQL ODBC driver. Use of other PostgreSQL ODBC drivers is possible but not recommended: correct configuration of the driver is necessary to prevent the driver from consuming too much memory.
Triggers on tables are not migrated automatically.
Check constraints are defined using the native PostgreSQL syntax. Incompatibilities must be manually fixed.
All indexes specific to PostgreSQL will be converted into normal indexes in MariaDB.
The GEOMETRY type is assumed to be the type provided by PostGIS. It is converted into a MariaDB GEOMETRY type and is extracted using ST_AsText.
It is the responsibility of the end-user to correctly configure the ODBC driver. Some drivers read the whole resultset into memory by default which will result in MaxScale running out of memory
ETL operations that operate on more than one catalog are not supported.
This page is licensed: CC BY-SA / Gnu FDL
$ maxctrl create user "maxscale_rest_admin" "maxscale_rest_admin_password" --type=admin[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.pemSET autocommit=1
PREPARE hide_autocommit FROM "SET autocommit=0"
EXECUTE hide_autocommitDiagnose and resolve common MaxScale issues. Find solutions for systemd watchdog kills, high memory usage, authentication failures, and connectivity errors.
This can occur if a reverse DNS name lookup takes a long time. To disable reverse name lookups of client IPs to client hostnames, add skip\_name\_resolve=true under the [maxscale] section.
MaxScale starting with 22.08.4
The default value of writeq\_high\_water was lowered to 64KiB to reduce excessive memory usage. This change should result in a net decrease in memory usage and possibly a small improvement in performance.
Set writeq\_high\_water and writeq\_low\_water to lower values, for example writeq_high_water=512 and writeq_low_water=128. The default is to buffer a maximum of 16MB in memory before network throttling begins which under intensive loads can result in a large amount of memory being used per client.
The query classifier cache in MaxScale by default takes up to 15% of memory to cache query classification data. This value can be lowered using the query\_classifier\_cache\_size parameter.
The retain\_last\_statements and session\_trace debugging parameters can cause memory usage to increase. Disabling them under intensive loads is recommended if they are not needed. Note that the maxctrl list queries requires that retain_last_statements=1 is set.
Profiling the memory usage can be useful for finding out why MaxScale appears to use more memory than it should. It is especially helpful for analyzing OOM situations or other cases where the memory grows linearly and causes problems.
To profile the memory usage of MaxScale, there are multiple options. The following sections describe the methods that are available.
If a problem in memory usage is identified and it appears to be due to a bug in MaxScale, please open a new bug report on the . Remember to include all the profiling and leak check reports along with the MaxScale version number and the configuration file with all password and other sensitive information removed.
The instructions on the page that are for the MariaDB server also apply to MaxScale. The following modifications to the commands must be done in order for them to work with MaxScale.
Replace /usr/sbin/mariadbd with /usr/bin/maxscale
Replace /var/lib/mysql/ with /var/log/maxscale/
Replace pidof mariadbd with pidof maxscale
Valgrind can be used to analyze memory usage problems but usually it is left as the last resort due to the heavy performance penalty that it incurs. However, the use of Valgrind is simple as it is widely available and can be used with existing MaxScale binaries.
To use valgrind for memory leak detection, edit the systemd service file with systemctl edit maxscale.service and add the following values to it:
Then restart the MaxScale process with systemctl restart maxscale.service. Once the memory problem is confirmed, stop the MaxScale process with systemctl stop maxscale.service. Valgrind will print the leak report into the system journal that can be viewed with journalctl -u maxscale.
Access DeniedIf you are receiving authentication errors like this:
Make sure you create users for both 'bob'@'office' and 'bob'@'maxscale'. The host 'office' is where the client is attempting to connect from and 'maxscale' is the host where MaxScale is installed.
If you do not want to create a second set of users, you can enable proxy\_protocol in MaxScale and configure the MariaDB server to from the MaxScale host.
MaxScale connection
SSH to the server where MaxScale is installed
Connect to MariaDB
Check output of
Service Grants
Make sure that the MaxScale services have a user configured and that it has the correct grants. Refer to the MariaDB protocol documentation on what grants are required for services.
Monitor Grants
The monitor user requires different grants than the service user and each monitor type requires different grants.
Asynchronous MariaDB replication with mariadbmon
Galera clusters with galeramon
For all authentication and permission related errors, add debug=enable-statement-logging under the [maxscale] section of your MaxScale configuration file. This will cause all SQL statements to be logged on the notice level which will help you figure out what the problem is.
If you want to connect as root, you'll need to add to the service.
There seems to be a bug for databases containing underscores. Connect as root and use "SHOW GRANTS FOR user".
If you got a grant containing a escaped underscore, you can add the strip\_db\_esc=true parameter to the service to automatically strip escape characters or just replace the grant with a unescaped one.
Failed to write message: 11, Resource temporarily unavailableMaxScale starting with 22.08.0
MaxScale 22.08 no longer uses pipes for internal communication. This means that this error is never logged and the pipe size no longer needs to be adjusted.
MaxScale starting with 6.4.5
Older MaxScale versions suffer from a bug () that caused messages in the queue to take up 4096 bytes of memory per message instead of the intended 24 bytes which translates to a maximum of 256 messages instead of the expected 43690 messages with a 1MiB pipe size.
Starting with MaxScale 6.4.5 and 2.5.25, the size is 24 bytes as expected which causes the maximum limit to be the expected 43690 messages. The problem still theoretically exists under extreme workloads where there are more than 43k concurrent clients but in practice the problem should almost never occur.
The MaxScale can log the Failed to write message: 11, Resource temporarily unavailable message under extremely intensive workloads (see and ).
The first action to take when these messages are encountered is to upgrade your MaxScale installation to the latest version. Whenever this message is seen, it means that something is causing the internal message queue in MaxScale to fill up. More often than not it is a sign of a possible bug in MaxScale and most likely has been fixed in the most recent release of MaxScale.
If this is still seen even after upgrading to the latest release, the pipe buffer size can be increased from the default 1MB to a higher value to prevent the problem from occurring. At least 8MB is recommended and should be increased until the message stops appearing.
To set the pipe buffer size, execute the following command.
If after all these actions you still see these warnings, please open a bug report on the MariaDB Jira under the MaxScale project.
This is a common error when system limits for open files is too low. The fix to this is to increase the limits.
Edit or add LimitNOFILE=<number of files> under the [Service] section in /usr/lib/systemd/system/maxscale.service.
Error: ENOENT: no such file or directory, uv_cwdIf MaxCtrl fails to start and throws the following error, it means that the current working directory no longer exists. Moving into a directory that does exist fixes the problem.
Pkg: Error reading from file.If MaxCtrl fails to start and throws this error, it most likely means that the maxctrl executable has been stripped of symbols. To fix this problem, reinstall the MaxScale package.
Make sure you are connecting on the port where the binlogrouter is listening. A common mistake is to connect to a readwritesplit or readconnroute port and execute the replication configuration commands there.
For most problems, resetting the conversion state is the solution. If the conversion repeatedly stops at a certain point, please .
Stop MaxScale
Remove the avro.index and avro-conversion.ini files along with any generated .avro files from the director where the Avro files are stored
Start MaxScale
Make sure the start_index parameter is set to the lowest binlog file number. For example, to start from mariadb-bin-000005, set start_index=5.
Create the user with maxadmin call command cdc add_user <service name> <user> <password> or maxctrl call command cdc add_user <service name> <user> <password>.
Check that sysctl kernel.core_pattern is set to forward coredupms to systemd-coredump:
Also make sure that SystemD is configured to allow coredumps. In External images are disabled suitable size limits must be set as they are set to zero by default.
Read the MariaDB documentation for and Most of the operating system level documentation applies to MaxScale as well except that MaxScale is always run as a SystemD service and it only supports Linux as the platform.
This page is licensed: CC BY-SA / Gnu FDL
Replace mariadb.service with maxscale.service
Client connection
SSH to theserver where client is connecting from
Connect to MariaDB
Check output of SHOW GRANTS
[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.
These instructions detail the upgrade to MariaDB MaxScale 25.01 in a MaxScale Instance configuration on a range of .
MariaDB MaxScale is an advanced database proxy and query router.
Upgrades can move or change configuration files. Before starting an upgrade, always back up your configuration files to ensure you can revert to the working system in the event that you encounter any issues during the upgrade.
To back up a configuration file, create a copy:
MariaDB Corporation provides package repositories for YUM (RHEL, CentOS, Rocky Linux), APT (Debian, Ubuntu), and ZYpp (SLES).
Before upgrading MariaDB MaxScale, first stop the current process.
For distributions that use systemd (most supported OSes), you can manage the Server process using the systemctl command:
Upgrade MaxScale following the instructions for your Linux distribution:
Upgrade via DNF (RHEL)
Customer Download Token
Retrieve your Customer Download Token at and substitute for CUSTOMER_DOWNLOAD_TOKEN in the following directions.
Configure YUM / DNF package repository
Pass the version you want to install using the --mariadb-maxscale-version
Configuration parameters can change between releases of MariaDB MaxScale, which can have unexpected results.
Determine which parameters have changed by reviewing all the changes made between your current release and the upgrade release.
Change the specific parameters in maxscale.cnf.
Changes in MaxScale 23.02
When upgrading from MaxScale 22.08 and earlier to MaxScale 25.01, the changes introduced in MaxScale 23.02 must be taken into consideration.
MariaDB MaxScale 22.08 is fully compatible with MariaDB MaxScale 23.02 with the exception that some features have been removed.
Removed Features
The csmon monitor has been removed after previously being deprecated in MaxScale 22.08.2.
The auroramon
MariaDB MaxScale installations includes configuration to start, stop, restart, enable/disable on boot, and check the status of the MaxScale Instance using the operating system default process management system.
For distributions that use systemd (most supported OSes), you can manage the MaxScale process using the systemctl command:
When you have MariaDB MaxScale up and running, you should test it to ensure that it is working and that weren't any issues during startup.
Check that MaxScale is running properly by using the utility:
25.01.To configure YUM package repositories:
Upgrade MariaDB MaxScale and package dependencies:
Configure MaxScale
The upgrade process only loads MaxScale onto the system. MaxScale requires configuration before MaxScale is ready for use.
Upgrade via APT (Debian, Ubuntu)
Customer Download Token
Retrieve your Customer Download Token at https://customers.mariadb.com/downloads/token/ and substitute for CUSTOMER_DOWNLOAD_TOKEN in the following directions.
Configure APT package repository
Pass the version you want to install using the --mariadb-maxscale-version flag to the script. The following directions reference 25.01.
To configure APT package repositories:
Upgrade MariaDB MaxScale and package dependencies
Configure MaxScale
The upgrade process only loads MaxScale onto the system. MaxScale requires configuration before MaxScale is ready for use.
Upgrade via ZYpp (SLES)
Customer Download Token
Retrieve your Customer Download Token at https://customers.mariadb.com/downloads/token/ and substitute for CUSTOMER_DOWNLOAD_TOKEN in the following directions.\
Configure ZYpp package repository
Pass the version you want to install using the --mariadb-maxscale-version flag to the script. The following directions reference 25.01.
To configure ZYpp package repositories:
Upgrade MariaDB MaxScale and package dependencies
Configure MaxScale
The upgrade process only loads MaxScale onto the system. MaxScale requires configuration before MaxScale is ready for use.
The maxctrl cluster commands have been removed after previously being deprecated in MaxScale 22.08.2
The maxctrl drain command has been removed, because it is obsolete.
Removed Deprecated maxctrl Commands
In MariaDB MaxScale 23.02, some deprecated MaxCtrl commands were removed:
maxctrl cluster
maxctrl drain has been removed and can be replaced with maxctrl set server SERVER_NAME drain
Removed Deprecated maxctrl Options
In MariaDB MaxScale 23.02, several deprecated MaxCtrl command-line options were removed, since MaxScale previously added the ability to specify module parameters to MaxCtrl as key-value pairs.
This change can impact backward compatibility. Some scripts and tools written for previous versions of MaxCtrl will require updates to continue functioning with MaxCtrl from MaxScale 23.02. The old command-line parameters have been deprecated since MaxScale 22.08. The new syntax to specify parameters as key-value pairs has been supported since MariaDB MaxScale 6.2.0.
For example, in previous releases, the following maxctrl create monitor command could be executed:
Starting with MariaDB MaxScale 23.02, some deprecated command-line options have been removed and must be replaced with a key-value pair using the corresponding module parameter:
For maxctrl create listener, the following deprecated command-line options were removed and must be replaced with a key-value pair using the listed parameter:
--authenticator
authenticator
--authenticator-options
authenticator_options
--interface
interface
--protocol
protocol
--tls-ca-cert
ssl_ca
--tls-cert
For maxctrl create monitor, the following deprecated command-line options were removed and must be replaced with a key-value pair using the listed parameter:
--monitor-password
password
--monitor-user
user
Changes in MaxScale 22.08
When upgrading from MaxScale 6 and earlier to MaxScale 25.01, the changes introduced in MaxScale 22.08 must be taken into consideration.
Database Firewall Filter
The dbfwfilter that was deprecated in MaxScale 6 has been removed in MaxScale 22.08.
Deprecated Parameters
The server parameter ssl_ca_cert has been renamed to ssl_ca and ssl_ca_cert has been deprecated. ssl_ca_cert is now an alias for ssl_ca and can still be used, but MariaDB recommends using ssl_ca, as support for ssl_ca_cert will be removed in a future release.
The server parameter admin_ssl_ca_cert has been renamed to admin_ssl_ca and admin_ssl_ca_cert has been deprecated. admin_ssl_ca_cert is now an alias for admin_ssl_ca and can still be used, but MariaDB recommends using admin_ssl_ca, as support for admin_ssl_ca_cert will be removed in a future release.
Removed Parameters
The following MariaDB Monitor (mariadbmon) parameters have been removed:
ignore_external_masters
detect_replication_lag
Default Changed for Logging Behavior
Prior to MaxScale 22.08.1, by default MaxScale logs to syslog in addition to the MaxScale log.
Starting with MaxScale 22.08.1, by default MaxScale only logs to the MaxScale log and no longer logs to syslog.
To retain the behavior of prior releases, in your MaxScale configuration, under the [maxscale] section, specify syslog=true:
REST API Endpoint Removed
The /v1/maxscale/tasks/ endpoint has been removed from the REST API.
Changes in MaxScale 6
When upgrading from MaxScale 2.5 and earlier to MaxScale 25.01, the changes introduced in MaxScale 6 must be taken into consideration.
TLS/SSL
MaxScale's ssl parameter can no longer be set to required or disabled:
ssl=true replaces ssl=required
ssl=false replaces ssl=disabled
Deprecated Features
dbfwfilter is deprecated (but not removed) in MaxScale 6.
Multi-line configuration parameters are deprecated (but not removed) in MaxScale 6.
Defaults Changed
The default value of threads has changed from 1 to auto
ColumnStore
When using MaxScale with ColumnStore 5 and later, MariaDB Monitor (mariadbmon) is used instead of ColumnStore Monitor (csmon).
Changes in MaxScale 2.5
When upgrading from MaxScale 2.4 and earlier to MaxScale 25.01, the changes introduced in MaxScale 2.5 must be taken into consideration.
Passwords
MaxScale's password encryption features have been updated to be more secure. Passwords encrypted in old versions will still work, but it is recommended to generate a new encryption key with the maxkeys command and to re-encrypt passwords with the maxpasswd command.
User Account Privileges
MaxScale's user account requires additional privileges in MaxScale 2.5.
Ensure that the user account has the following privileges:
MariaDB Monitor
MaxScale 2.5 includes configuration changes for :
The detect_stale_master and the detect_standalone_master parameters have been deprecated. They can still be used, but they will be removed in a later version of MaxScale. Users should use the master_conditions parameter instead.
For example:
The detect_stale_slave parameter has been deprecated. It can still be used, but it will be removed in a later version of MaxScale. Users should use the slave_conditions parameter instead.
ColumnStore Monitor
MaxScale 2.5 includes configuration changes for :
The version parameter was previously optional, but it is now required.
For example:
Binlog Router
MaxScale 2.5 includes a completely re-implemented :
Thoroughly test your configuration with the new implementation to ensure that the new version meets your needs.
MaxScale instance
MariaDB MaxScale running by itself on a single host.
It interacts with other hosts, such as deployments using , Galera Cluster, and .
It serves as the database proxy and load balancer.
upgrade
A change from lower-versioned release of MariaDB MaxScale to a higher-versioned release of MariaDB MaxScale.
Start
sudo systemctl start maxscale
Stop
sudo systemctl stop maxscale
Restart
sudo systemctl restart maxscale
Enable during startup
sudo systemctl enable maxscale
Disable during startup
sudo systemctl disable maxscale
Status
sudo systemctl status maxscale
Review critical information and procedures for upgrading MariaDB MaxScale versions. Learn about new features deprecated functionality and specific steps for each version transition.
Before upgrading to MariaDB MaxScale, it is critical to review the changes. This guide outlines new features, altered parameters, and deprecated functionality to ensure a smooth transition.
For more information about what has changed, please refer to the ChangeLog and release notes of the releases you are upgrading from and upgrading to.
Before starting the upgrade, any existing configuration files should be backed up.
The service users now require a SELECT grant on the mysql.global_priv table in order to be able to support authentication of users with multiple authentication mechanisms. If this grant is not given to the service users, a warning is logged. The following SQL shows how the grant is given to a user:
In MaxScale 25.10, only one monitor backend timeout remains: . This replaces the old backend_connect_timeout, backend_write_timeout and backend_read_timeout, using the same value for all underlying timeouts. backend_connect_timeout is still supported as an alias for backend_timeout, but any values given to backend_write_timeout and backend_read_timeout are ignored.
reuse_prepared_statementsThe reuse_prepared_statements parameter has been replaced with the use of the filter module.
The functionality that previously was enabled with:
Should now be implemented with:
optimistic_trxThe optimistic_trx parameter has been replaced with the use of the filter module.
The functionality that previously was enabled with:
Should now be implemented with:
The MaxScale packaging has been modified in 24.02 to include all of the necessary files in the package itself. This removes the need for a post-installation script that installs them while also clearly stating what's included in the package.
However, as a result of this change, downgrades from 24.02 to older major versions may cause the removal of necessary directories, namely the /var/cache/maxscale/ directory.
To downgrade from MaxScale 24.02 to an older MaxScale major release:
Remove MaxScale 24.02 (e.g. dnf remove maxscale or apt -y remove maxscale)
Install the older MaxScale version
MariaDB Monitor switchover requires an additional grant on MariaDB Server 10.5 and later. See for more information.
The csmon and auroramon monitors have been removed.
The obsolete maxctrl drain command has been removed.
The maxctrl cluster commands have been removed.
The support for legacy encryption keys generated with maxkeys from pre-2.5 versions has been removed. This feature was deprecated in MaxScale 2.5 when the new key storage format was introduced. To migrate to the new key storage format, create a new key file with maxkeys and re-encrypt the passwords withmaxpasswd.
The deprecated Database Firewall filter has been removed.
Using duration type parameters without an explicit suffix has been deprecated in MaxScale 2.4. In MaxScale 6 they are no longer allowed when used with the REST API or MaxCtrl. This means that any create or alter commands in MaxCtrl that use a duration type parameter must explicitly specify the suffix of the unit.
For example, the following command:
should be replaced with:
Duration type parameters can still be defined in the configuration file without an explicit suffix but this behavior is deprecated. The recommended approach is to add explicit suffixes to all duration type parameters when upgrading to MaxScale 6.
threadsThe default value of threads was changed to auto.
The following deprecated core parameters have been removed:
thread_stack_size
The deprecated aliases for the schemarouter parameters ignore_databases andignore_databases_regex have been removed. They can be replaced withignore_tables and ignore_tables_regex.
In addition, the preferred_server parameter that was deprecated in 2.5 has also been removed.
mariadbmonMariaDBMonitor settings ignore_external_masters, detect_replication_lagdetect_standalone_master, detect_stale_master and detect_stale_slave have been removed. The first two were ineffective, the latter three are replaced by master_conditions and slave_conditions.
The prune_sescmd_history, max_sescmd_history and disable_sescmd_history have been made into generic service parameters that are shared between all routers that support it.
The default value of prune_sescmd_history was changed from false totrue. This was done as most MaxScale installations either benefit from it being enabled or are not affected by it.
The deprecated MaxAdmin interface has been removed in 2.5.0 in favor of the REST API and the MaxCtrl command line client. The cli and maxscaled modules can no longer be used.
The credentials used by services now require additional grants. For a full list of required grants, refer to the .
The settings detect_stale_master, detect_standalone_master anddetect_stale_slave are replaced by master_conditions andslave_conditions. The old settings may still be used, but will be removed in a later version.
The encrypted passwords feature has been updated to be more secure. Users are recommended to generate a new encryption key and re-encrypt their passwords using the maxkeys and maxpasswd utilities. Old passwords still work.
The default state of servers in 2.4 was Running and in 2.5 it is nowDown. This was done to prevent newly added servers from being accidentally used before they were monitored.
It is now mandatory to specify in the configuration what version the monitored Columnstore cluster is.
The binlog router delivered with MaxScale 2.5 is completely new and not 100% backward compatible with the binlog router delivered with earlier MaxScale versions. If you use the binlog router, carefully assess whether the functionality provided by the new one fulfills your requirements, before upgrading MaxScale.
The tee filter parameter service has been deprecated in favor of the target parameter. All usages of service can be replaced with target.
Section and object names starting with @@ are now reserved for internal use by MaxScale.
In case such names have been used, they must manually be changed in all configuration files of MaxScale, before MaxScale 2.4 is started.
Those files are:
The main configuration file; typically /etc/maxscale.cnf.
All nested configuration files; typically /etc/maxscale.cnf.d/*.
All dynamic configuration files; typically /var/lib/maxscale/maxscale.cnd.d/*.
Whitespace in section names that was deprecated in MaxScale 2.2 will now be rejected, which will cause the startup of MaxScale to fail.
To prevent that, section names like
must be changed, for instance, to
Durations can now be specified using one of the suffixes h, m, s and ms for specifying durations in hours, minutes, seconds and milliseconds, respectively.
Not providing an explicit unit has been deprecated in MaxScale 2.4, so it is advisable to add suffixes to durations. For instance,
MaxScale 2.4 will use a SHA2-512 hash for new admin user passwords. To upgrade a user to use the better hashing algorithm, either recreate the user or use themaxctrl alter user command.
The following settings have been removed and cause a startup error if defined:
mysql51_replication
multimaster
allow_cluster_recovery.
If multiple masters are available for a readwritesplit service, the one with the lowest connection count is selected.
If a master server is placed into maintenance mode, all open transactions are allowed to gracefully finish before the session is closed. To forcefully close the connections, use the --force option for maxctrl set server.
The lazy_connect feature can be used as a workaround to . It also reduces the overall load on the system when connections are rapidly opened and closed.
Starting with MaxScale 2.3.0 up to 40% of the memory can be used for caching parsed queries. The most noticeable change is that it improves performance in almost all cases where queries need to be parsed. Most of the time this happens when the readwritesplit router or filters are used.
The amount of memory that MaxScale uses can be controlled with thequery_classifier_cache_size parameter. For example, to limit the total memory to 1GB, add query_classifier_cache_size=1G to your configuration. To disable it, set the value to 0.
In addition to the aforementioned query classifier caching, the readwritesplit session command history is enabled by default in 2.3 but is limited to a maximum of 50 commands after which the history is disabled. This is unlikely to show in any metrics but it contributes to the increased memory footprint of MaxScale.
All unknown parameters are now treated as errors. Check your configuration for errors if MaxScale fails to start after upgrading to 2.3.1.
passwd is deprecatedIn the configuration file, passwords for monitors and services should be specified using password; the support for the deprecatedpasswd will be removed in the future. That is, the following
should be changed to
authenticator_options for servers is ignoredAuthenticator options are now only used with listeners.
The file format for the administrative users used by MaxScale has been changed. Old style files are automatically upgraded and a backup of the old file is stored in /var/lib/maxscale/passwd.backup.
Modules may now use a built-in regular expression string parameter type instead of a normal string when accepting patterns. The modules that use the new regex parameter type are qlafilter and tee. When inputting pattern, enclose the string in slashes, e.g. match=/^select/ defines the pattern ^select.
Binlog server automatically accepts GTID connection from MariaDB 10 slave servers by saving all incoming GTIDs into a SQLite map database.
In the 2.2.1 beta version MaxCtrl was in its own package whereas in 2.2.2 it is in the main maxscale package. If you have a previous installation of MaxCtrl, please remove it before upgrading to MaxScale 2.2.2.
MaxScale 2.1.2 added support for IPv6 addresses. The default interface that listeners bind to was changed from the IPv4 address 0.0.0.0 to the IPv6 address ::. To bind to the old IPv4 address, add address=0.0.0.0 to the listener definition.
Starting with MaxScale 2.1, any changes made with the newly added runtime configuration change will be persisted in a configuration file. These files are located in /var/lib/maxscale/maxscale.cnf.d/.
The name of the log file was changed from maxscaleN.log to maxscale.log. The default location for the log file is /var/log/maxscale/maxscale.log.
Rotating the log files will cause MaxScale to reopen the file instead of renaming them. This makes the MaxScale logging facility logrotate compatible.
The disable_sescmd_history option is now enabled by default. This means that slaves will not be recovered mid-session even if a replacement slave is available. To enable the legacy behavior, add the disable_sescmd_history=true parameter to the service definition.
The MariaDB session state is reset in MaxScale 2.1 for persistent connections. This means that any modifications to the session state (default database, user variable etc.) will not survive if the connection is put into the connection pool. For most users, this is the expected behavior.
The location of the MariaDB user data cache was moved from/var/cache/maxscale/<Service> to /var/cache/maxscale/<Service>/<Listener>.
Galeramon will assign the master status only to the node which has a_wsrep_local_index_ value of 0. This will guarantee consistent writes with multiple MaxScales but it also causes slower changes of the master node.
To enable the legacy behavior, add root_node_as_master=false to the Galera monitor configuration.
The default editing mode was changed from vim to emacs mode. To start maxadmin in the legacy mode, use the -i option.
The default way the communication between MaxAdmin and MariaDB MaxScale is handled has been changed from an internet socket to a Unix domain socket. The former alternative is still available but has been deprecated.
If no arguments are given to MaxAdmin, it will attempt to connect to MariaDB MaxScale using a Unix domain socket. After the upgrade you will need to provide at least one internet socket related flag - -h, -P,-u or -p - to force MaxAdmin to use the internet socket approach.
E.g.
The MySQL Monitor now assigns the stale state to the master server by default. In addition to this, the slave servers receive the stale slave state when they lose the connection to the master. This should not cause changes in behavior but the output of MaxAdmin will show new states when replication is broken.
The service users now also need SELECT privileges on mysql.tables_priv. This is required for the resolution of table level grants. To grant SELECT privileges for the service user, replace the user and hostname in the following example.
MaxScale 1.4 upgrades the used password encryption algorithms to more secure ones. This requires that the password files are recreated with the maxkeys tool.
The SSL configuration parameters are now a part of the listeners. If a service used the old style SSL configuration parameters, the values should be moved to the listener which is associated with that service.
Here is an example of an old style configuration.
And here is the new, 1.4 compatible configuration style.
Please also note that the enabled SSL mode is no longer supported due to the inherent security issues with allowing SSL and non-SSL connections on the same port. In addition to this, SSLv3 is no longer supported due to vulnerabilities found in it.
The master server details are now provided with a master.ini file located in the binlog directory and it can be changed using a CHANGE MASTER TO command issued via a MySQL connection to MaxScale.
This file, properly filled, is now mandatory and without it the binlog router cannot connect to the master database.
Before starting binlog router after MaxScale 1.3 upgrade, please add relevant information to master.ini, example:
Additionally, the option servers=masterdb in the service definition is no longer required.
This document describes upgrading MaxScale from version 1.1.1 to 1.2 and the major differences in the new version compared to the old version. The major changes can be found in the Changelog.txt file in the installation directory and the official release notes in the ReleaseNotes.txt file.
Upgrading MaxScale will copy the MaxScale.cnf file in/usr/local/mariadb-maxscale/etc/ to /etc/ and renamed to maxscale.cnf. Binary log files are not automatically copied and should be manually moved from /usr/local/mariadb-maxscale to /var/lib/maxscale/.
MaxScale 1.2 follows the and installs to /usr/ and /var/ subfolders. Here are the major changes and file locations.
Configuration files are located in /etc/ and use lowercase letters: /etc/maxscale.cnf
Binary files are in /usr/bin/
Libraries and modules are in /usr/lib64/maxscale/. If you are using custom modules, please make sure they are in this directory before starting MaxScale.
MaxScale can run as a non-root user with the 1.2 version. RPM and DEB packages install the maxscale user and maxscale group which are used by the init scripts and systemd configuration files. If you are installing from a binary tarball, you can run the postinst script included in it to manually create these groups.
This document describes upgrading MaxScale from version 1.0.5 to 1.1.0 and the major differences in the new version compared to the old version. The major changes can be found in the Changelog.txt file in the installation directory and the official release notes in the ReleaseNotes.txt file.
If you are installing MaxScale from a RPM package, we recommend you back up your configuration and log files and that you remove the old installation of MaxScale completely. If you choose to upgrade MaxScale instead of removing it and re-installing it afterwards, the init scripts in /etc/init.d folder will be missing. This is due to the RPM packaging system but the script can be re-installed by running the postinst script found in the/usr/local/mariadb-maxscale folder.
The 1.1.0 version of MaxScale installs into /usr/local/mariadb-maxscale instead of /usr/local/skysql/maxscale. This will cause external references to MaxScale's home directory to stop working so remember to update all paths with the new version.
The MaxAdmin client's default password in MaxScale 1.1.0 is mariadb instead of skysql.
This page is licensed: CC BY-SA / Gnu FDL
sudo dnf update maxscaleGRANT 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';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 │
│ │ } │
└──────────────┴──────────────────────────────────────────────────────────────────────┘sudo 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"maxctrl 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 node3detect_standalone_master
detect_stale_master (replaced by master_conditions)
detect_stale_slave (replaced by slave_conditions)
ssl_cert
--tls-cert-verify-depth
ssl_cert_verify_depth
--tls-crl
ssl_crl
--tls-key
ssl_key
--tls-verify-peer-certificate
ssl_verify_peer_certificate
--tls-verify-peer-host
ssl_verify_peer_host
--tls-version
ssl_version
Transaction replays now have a limit on how many times a replay is attempted. The default values is five attempts and is controlled by thetransaction_replay_attempts parameter.
If transaction replay is enabled and a deadlock occurs (SQLSTATE 40XXX), the transaction is automatically retried.
Log files are in the var/log/maxscale/ folder
MaxScale's PID file is located in /var/run/maxscale/maxscale.pid
Data files and other persistent files are in /var/lib/maxscale/
sudo 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 apt install --only-upgrade maxscalesudo 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"sudo zypper update maxscale[maxscale]
syslog=true[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.2[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_masterGRANT SELECT ON mysql.global_priv TO 'maxscale_user'@'%';[My-Readwritesplit]
type=service
router=readwritesplit
reuse_prepared_statements=true[PsReuse]
type=filter
module=psreuse
[My-Readwritesplit]
type=service
router=readwritesplit
filters=PsReuse[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 30000ms[CSMonitor]
type=monitor
module=csmon
version=1.5
...[My Server]
...
[My Service]
...
servers=My Server[MyServer]
...
[MyService]
...
servers=MyServersome_param=60s
some_param=60000ms[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
...user@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
./postinstExplore the complete reference for configuring MariaDB MaxScale, covering core concepts, server objects, monitors services, listeners, and parameter management for optimal database routing.
This document describes how to configure MariaDB MaxScale and presents some possible usage scenarios. MariaDB MaxScale is designed with flexibility in mind, and consists of an event processing core with various support functions and plugin modules that tailor the behavior of the program.
A server represents an individual database server to which a client can be connected via MariaDB MaxScale. The status of a server varies during the lifetime of the server and typically the status is updated by some monitor. However, it is also possible to update the status of a server manually.
For more information on how to manually set these states via MaxCtrl, read the .
A monitor module is capable of monitoring the state of a particular kind of cluster and making that state available to the routers of MaxScale.
Examples of monitor modules are mariadbmon that is capable of monitoring a regular primary-replica cluster and in addition of performing both switchover and failover, galeramon that is capable of monitoring a Galera cluster, and csmon that is capable of monitoring a Columnstore cluster.
Monitor modules have sections of their own in the MaxScale configuration file.
A filter module resides in front of routers in the request processing chain of MaxScale. That is, a filter will see a request before it reaches the router and before a response is sent back to the client. This allows filters to reject, handle, alter or log information about a request.
Examples of filters cache that provides query caching according to rules, regexfilter that can rewrite requests according to regular expressions, and qlafilter that logs information about requests.
Filters have sections of their own in the MaxScale configuration file that are referred to from services.
Simple filters that do not have any settings can be created automatically by referring to them by the module name in the filters list of a service. For example, using filters=hintfilter in a service will create a filter named hintfilter using the module hintfilter.
Limitations:
MaxScale: No limitations.
MaxScale Lite: At most 2 filters can be created.
A router module is capable of routing requests to backend servers according to the characteristics of a request and/or the algorithm the router implements. Examples of routers are readconnroute that provides connection routing, that is, the server is chosen according to specified rules when the session is created and all requests are subsequently routed to that server, and readwritesplit that provides statement routing, that is, each individual request is routed to the most appropriate server.
Routers do not have sections of their own in the MaxScale configuration file, but are referred to from services.
A service abstracts a set of databases and makes them appear as a single one to the client. Depending on what router (e.g. readconnroute or readwritesplit) the service uses, the servers are used in some particular way. If the service uses filters, then all requests will be pre-processed in some way before they reach the router.
Services have sections of their own in the MaxScale configuration file.
Limitations:
MaxScale: No limitations.
MaxScale Lite: At most 2 services can be created.
A listener defines a port MaxScale listens on. Connection requests arriving on that port will be forwarded to the service the listener is associated with. A listener may be associated with a single service, but several listeners may be associated with the same service.
Listeners have sections of their own in the MaxScale configuration file.
An defines common parameters used in other configuration sections.
The administration of MaxScale can be divided in two parts:
Writing the MaxScale configuration file, which is described in the following .
Performing runtime modifications using
For detailed information about MaxCtrl please refer to the specific documentation referred to above. In the following it will only be explained how MaxCtrl relate to each other, as far as user credentials go.
Note: By default all runtime configuration changes are saved on disk and loaded on startup. Refer to the section for more details on how it works and how to disable it.
MaxCtrl can connect using TCP/IP sockets. When connecting with MaxCtrl using TCP/IP sockets, the user and password must be provided and are checked against a separate user credentials database. By default, that database contains the user admin whose password is mariadb.
Note that if MaxCtrl is invoked without explicitly providing a user and password then it will by default use admin and mariadb. That means that when the default user is removed, the credentials must always be provided.
The REST API calls to MaxScale can be logged by enabling .
For more detail see the admin audit configuration values admin_audit, admin_audit_file and admin_audit_exclude_methods below and .
The following global configuration parameters can NOT be changed at runtime and can only be defined in a configuration file:
admin_auth
admin_enabled
admin_gui
admin_host
All other parameters that relate to objects can be altered at runtime or can be changed by destroying and recreating the object in question.
MaxScale by default reads configuration from the file /etc/maxscale.cnf. If the command line argument --configdir=<path> is given, maxscale.cnf is searched for in <path> instead. If the argument --config=<file> is given, configuration is read from the file <file>.
MaxScale also looks for a directory with the same name as the configuration file, followed by ".d" (for example /etc/maxscale.cnf.d). If found, MaxScale recursively reads all files with the ".cnf" suffix in the directory hierarchy. Other files are ignored.
After loading normal configuration files, MaxScale reads runtime-generated configuration files, if any, from the .
Different configuration sections can be arranged with little restrictions. Global path settings such as logdir, piddir and datadir are only read from the main configuration file. Other global settings are also best left in the main file to ensure they are read before other configuration sections are parsed.
The configuration file format used is , similar to the MariaDB Server. The files contain sections and each section can contain multiple key-value pairs.
Comments are defined by prefixing a row with a hash (#). Trailing comments are not supported.
A parameter can be defined on multiple lines as shown below. A value spread over multiple lines is simply concatenated. The additional lines of the value definition need to have at least one whitespace character in the beginning.
Section names may not contain whitespace and must not start with the characters @@.
As the object names are used to form URLs in the MaxScale REST API, they must be safe for use in URLs. This means that only alphanumeric characters (i.e. a-z, A-Z and 0-9) and the special characters _.~- can be used.
By default all changes done at runtime via the MaxScale GUI, MaxCtrl or the REST API will be saved on disk, inside the directory. The changes done at runtime will override the configuration found in the static configuration files for that particular object.
This means that if an object that is found in /etc/maxscale.cnf is modified at runtime, all future changes to it must also be done at runtime. Any modifications done to /etc/maxscale.cnf after a runtime change has been made are ignored for that object.
To prevent the saving of runtime changes and to make all runtime changes volatile, add and under the [maxscale] section. This will make MaxScale behave like the MariaDB server does: any changes done with SET GLOBAL statements are lost if the process is restarted.
Boolean type parameters interpret the values true, yes, on and 1 as true values and false, no, off and 0 as false values. Starting with MaxScale 23.02, the REST API also accepts the same boolean values for boolean type parameters.
Where specifically noted, a number denoting a size can be suffixed by a subset of the IEC binary prefixes or the SI prefixes. In the former case the number will be interpreted as a certain multiple of 1024 and in the latter case as a certain multiple of 1000. The supported IEC binary suffixes are Ki, Mi, Gi and Ti and the supported SI suffixes are k, M, G and T. In both cases, the matching is case-insensitive.
For instance, the following entries
are equivalent, as are the following
A number denoting a duration can be suffixed by one of the case-insensitive suffixes h, m or min, s and ms, for specifying durations in hours, minutes, seconds and milliseconds, respectively.
For instance, the following entries
are equivalent.
Note that if an explicit unit is not specified, then it is specific to the configuration parameter whether the duration is interpreted as seconds or milliseconds.
Not providing an explicit unit has been deprecated in MaxScale 2.4.
A number denoting a percent must be suffixed with %.
For instance
Many modules have settings which accept a regular expression. In most cases, these settings are named either match or exclude, and are used to filter users or queries. MaxScale uses the for matching regular expressions.
When writing a regular expression (regex) type parameter to a MaxScale configuration file, the pattern string should be enclosed in slashes e.g. ^select -> match=/^select/. This clarifies where the pattern begins and ends, even if it includes whitespace. Without slashes the configuration loader trims the pattern from the ends. The slashes are removed before compiling the pattern. For backwards compatibility, the slashes are not yet mandatory. Omitting them is, however, deprecated and will be rejected in a future release of MaxScale. Currently, binlogfilter, ccrfilter, qlafilter, tee and avrorouter accept parameters in this type of regular expression form. Some other modules may not handle the slashes yet correctly.
PCRE2 supports a complicated regular expression . MaxScale typically uses regular expressions simply, only checking whether the pattern and subject match at some point. For example, using the QLAFilter and setting match=/SELECT/ causes the filter to accept any query with the text "SELECT" somewhere within. To force the pattern to only match at the beginning of the query, set match=/^SELECT/. To only match the end, setmatch=/SELECT$/.
Modules which accept regular expression parameters also often accept options which affect how the patterns are compiled. Typically, this setting is called options and accepts values such as ignorecase, case and extended.
ignorecase: Causes the regular expression matcher to ignore letter case, and is often on by default. When enabled, /SELECT/ would match both SELECT andselect.
extended: Ignores whitespace and # comments in the pattern. Note that this is not the same as the extended regular expression syntax that for examplegrep -E uses.
These settings can also be defined in the pattern itself, so they can be used even in modules without pattern compilation settings. The pattern settings are (?i) for ignorecase and (?x) for extended. See the for more information.
Standard regular expression settings for filters
Many filters use the settings match, exclude and options. Since these settings are used in a similar way across these filters, the settings are explained here. The documentation of the filters link here and describe any exceptions to this generalized explanation.
These settings typically limit the queries the filter module acts on. match and exclude define PCRE2 regular expression patterns while options affects how both of the patterns are compiled. options works as explained above, accepting the values ignorecase, case and extended, with ignorecase being the default.
The queries are matched as they arrive to the filter on their way to a routing module. If match is defined, the filter only acts on queries matching that pattern. If match is not defined, all queries are considered to match.
If exclude is defined, the filter only acts on queries not matching that pattern. If exclude is not defined, nothing is excluded.
If both are defined, the query needs to match match but not match exclude.
Even if a filter does not act on a query, the query is not lost. The query is simply passed on to the next module in the processing chain as if the filter was not there.
Enumeration type parameters have a predefined set of accepted values. For types declared as enum, only one value is accepted. For enum_mask types, multiple values can be defined by separating them with commas. All enumeration values in MaxScale are case-sensitive.
For example the router_options parameter in the readconnroute router is a mask type enumeration:
A pathlist type parameter expects one or more filesystem paths separated by colons. The value must not include space between the separators.
Here is an example path list parameter that points to /tmp/something.log and /var/log/maxscale/maxscale.log:
The global settings, in a section named [MaxScale], allow various parameters that affect MariaDB MaxScale as a whole to be tuned. This section must be defined in the root configuration file which by default is /etc/maxscale.cnf.
core_fileType:
Default: false
Dynamic: No
This parameter specifies whether a core file should be generated if MaxScale crashes. Since 25.10 the default is false because usually a core file is not needed, as MaxScale is capable of logging the full stack trace of all threads when it crashes.
auto_tuneType: string list
Values: all or list of auto tunable parameters, separated by ,
Default: No
Mandatory: No
An auto tunable parameter is a parameter whose value can be derived from a particular server variable. With this parameter it can be specified whether all or a specific set of parameters should automatically be set.
The current auto tunable parameters are:
The values of the server variables are collected by monitors, which means that if the servers of a service are not monitored by a monitor, then the parameters of that service will not be auto tuned.
Note that even if auto_tune is set to all, the auto tunable parameters can still be set in the configuration file and modified with maxctrl. However, the specified value will be overwritten at the next auto tuning round, but only if the servers of the service are monitored by a monitor.
threadsType: number or auto
Mandatory: No
Dynamic: No
Default: auto
This parameter controls the number of worker threads that are used for routing client traffic. The default is auto which uses as many threads as there are virtual CPU cores available to MaxScale, rounded up to the nearest integer. If no limitations have been set using CPU affinities or cgroup CPU quotas, this will be the same as the number of CPU cores. In general, as of 24.08, MaxScale will use the appropriate number of threads, also when it is running in a container.
The maximum value for threads is specified by .
From 23.02 onwards it is possible to change the number threads at runtime. Please see for more details.
Additional threads will be created to execute other internal services within MariaDB MaxScale. This setting is used to configure the number of threads that will be used to manage the user connections.
threads_maxType: positive integer
Default: 256
Dynamic: No
This parameter specifies the hard limit for the number of worker threads, which is specified using .
At startup, if the value of threads is larger than that of threads_max, the value of threads will be reduced to that. At runtime, an attempt to increase the value of threads beyond that of threads_max is an error.
rebalance_periodType:
Mandatory: No
Dynamic: Yes
Default: 0s
This duration parameter controls how often the load of the worker threads should be checked. The default value is 0, which means that no checks and no rebalancing will be performed.
Note that the value of rebalance_period should not be smaller than the value of rebalance_window whose default value is 10.
If the value of rebalance_period is significantly shorter than that of rebalance_window, it may lead to oscillation where work is constantly moved from one thread to another.
rebalance_thresholdType: number
Mandatory: No
Dynamic: Yes
Default: 20
This integer parameter controls at which point MaxScale should start moving work from one worker thread to another.
If the difference in load between the thread with the maximum load and the thread with the minimum load is larger than the value of this parameter, then work will be moved from the former to the latter.
Although the load of a thread can vary between 0 and 100, the value of this parameter must be between 5 and 100.
Note that rebalancing will not be performed unless rebalance_period has been specified.
rebalance_windowType: number
Mandatory: No
Dynamic: Yes
Default: 10
This integer parameter controls how many seconds of load should be taken into account when deciding whether work should be moved from one thread to another.
The default value is 10, which means that the load during the last 10 seconds is considered when deciding whether work should be moved.
The minimum value is 1 and the maximum 60.
skip_name_resolveType:
Mandatory: No
Dynamic: Yes
Default: false
This parameter controls whether reverse domain name lookups are made to convert client IP addresses to hostnames. If enabled, client IP addresses will not be resolved to hostnames during authentication or for the REST API even if requested.
If you have database users that use a hostname in the host part of the user (i.e. 'user'@'my-hostname.org'), a reverse lookup on the client IP address is done to see if it matches the host. Reverse DNS lookups can be very slow which is why it is recommended that they are disabled and that users are defined using an IP address.
host_cache_sizeType: integer
Default: 128
Dynamic: Yes
How many hostname entries are stored in the reverse name lookup cache. Each thread in MaxScale has a cache for the reverse name resolution of client IP addresses to hostnames. Whenever the client authentication requires that a hostname lookup is done, the cache is consulted first. If an entry is found and it was updated less than 300 seconds ago, the cached result is used.
With host_cache_size=0, the cache is disabled and a fresh reverse name lookup is always done.
auth_connect_timeoutType:
Mandatory: No
Dynamic: Yes
Default: 10s
Duration, default 10s. This setting defines the connection timeout when attempting to fetch MariaDB/MySQL/Clustrix users from a backend server. The same value is also used for read and write timeouts. Increasing this value causes MaxScale to wait longer for a response from a server before user fetching fails. Other servers may then be attempted.
The value is given as . If no explicit unit is provided, the value is interpreted as seconds. In subsequent versions a value without a unit may be rejected. Since the granularity of the timeout is seconds, a timeout specified in milliseconds will be rejected even if the given value is longer than a second.
auth_read_timeoutDeprecated and ignored as of MaxScale 2.5.0. See auth_connect_timeout above.
auth_write_timeoutDeprecated and ignored as of MaxScale 2.5.0. See auth_connect_timeout above.
query_retriesType: number
Mandatory: No
Dynamic: No
Default: 1
Deprecated and ignored.
query_retry_timeoutType:
Mandatory: No
Dynamic: Yes
Default: 10s
Deprecated and ignored.
passiveType:
Mandatory: No
Dynamic: Yes
Default: false
Deprecated since MariaDB MaxScale 25.01. Use instead.
Controls whether MaxScale is a passive node in a cluster of multiple MaxScale instances.
This parameter is intended to be used with multiple MaxScale instances that use failover functionality to manipulate the cluster in some form. Passive nodes only observe the clusters being monitored and take no direct actions.
The following functionality is disabled when passive mode is enabled:
Automatic failover in the mariadbmon module
Automatic rejoin in the mariadbmon module
Launching of monitor scripts
NOTE: Even if MaxScale is in passive mode, it will still accept clients and route any traffic sent to it. The only operations affected by the passive mode are the ones listed above.
ms_timestampType:
Mandatory: No
Dynamic: Yes
Default: false
Enable or disable the high precision timestamps in logfiles. Enabling this adds millisecond precision to all logfile timestamps.
syslogType:
Mandatory: No
Dynamic: Yes
Default: false
Log messages to the system journal. This logs messages using the native SystemD journal interface. The logs can be viewed with journalctl.
MaxScale 22.08 changed the default value of syslog from true to false. This was done to remove the redundant logging that it caused as both syslog and maxlog were enabled by default. This caused each message to be logged twice: once into the system journal and once into MaxScale's own logfile.
maxlogType:
Mandatory: No
Dynamic: Yes
Default: true
Log messages to MariaDB MaxScale's log file. The name of the log file is maxscale.log and it is located in the directory pointed by .
log_warningType:
Mandatory: No
Dynamic: Yes
Default: true
Log messages whose syslog priority is warning.
MaxScale logs warning level messages whenever a condition is encountered that the user should be notified of but does not require immediate action or it indicates a minor problem.
log_noticeType:
Mandatory: No
Dynamic: Yes
Default: true
Log messages whose syslog priority is notice.
These messages contain information that is helpful for the user and they usually do not indicate a problem. These are logged whenever something worth nothing happens in either MaxScale or in the servers it monitors.
log_infoType:
Mandatory: No
Dynamic: Yes
Default: false
Log messages whose syslog priority is info.
These messages provide detailed information about the internal workings of MariaDB MaxScale. These messages should only be enabled when there is a need to inspect the internal logic of MaxScale. A common use-case is to see why a particular query was handled in a certain way. Almost all modules log some messages on the info level and this can be very helpful when trying to solve routing related problems.
log_debugType:
Mandatory: No
Dynamic: Yes
Default: false
Log messages whose syslog priority is debug.
These messages are intended for development purposes and are disabled by default. These are rarely useful outside of debugging core MaxScale issues.
Note: If MariaDB MaxScale has been built in release mode, then debug messages are excluded from the build and this setting will not have any effect. If an attempt to enable these is made, a warning is logged.
trace_file_dirType: path
Mandatory: No
Dynamic: No
Path to a directory where trace files will be generated to.
The trace logging offers a low overhead alternative to log_info that is designed to be placed on a local in-memory file system. By placing the files in a location that is not persistent, the overhead of writing to the files is minimal while still allowing the trace logs to be processed as normal log files.
If this parameter is defined along with trace_file_size, MaxScale will write all log messages from all log levels into a set of trace files located in this directory. The files are named maxscale.trace.N where N is an increasing number and whenever a new file is created the oldest one is removed if there are more than 10 trace files.
Starting with MaxScale 24.08.1, the maxscale.trace symlink will be created in that will point to the latest log file. This symlink can be used with tail -F to interactively monitor the trace stream or to copy the trace output directly into a compressed file:
The trace files differ from the normal log file written by MaxScale in that they do not contain the local timestamp and instead contain a raw fractional UNIX timestamp. The format of the trace file is subject to change and it may in the future be identical to the normal log generated by MaxScale.
trace_file_sizeType:
Mandatory: No
Dynamic: Yes
The desired amount of log data to keep in the trace files. Each individual trace file will be one tenth the size of trace_file_size and once they exceed this amount, a trace log rotation will occur. For example with trace_file_size=100Mi, roughly 100MiB of log data is kept in 10 files with about 10MiB of data in each file.
Individual trace files may sometimes exceed this limit and under heavy load the system may end up temporarily using more space than is intended.
log_warn_super_userType:
Mandatory: No
Dynamic: No
Default: false
When enabled, a warning is logged whenever a client with SUPER-privilege successfully authenticates. This also applies to COM_CHANGE_USER-commands. The setting is intended for diagnosing situations where a client interferes with a primary server switchover. Super-users bypass the read_only-flag which switchover uses to block writes to the primary.
log_augmentationType: number
Mandatory: No
Dynamic: Yes
Default: 0
Enable or disable the augmentation of messages. If this is enabled, then each logged message is appended with the name of the function where the message was logged. This is primarily for development purposes and hence is disabled by default.
To disable the augmentation use the value 0 and to enable it use the value 1.
log_throttlingType: number, ,
Mandatory: No
Dynamic: Yes
Default: 10, 1000ms, 10000ms
It is possible that a particular error (or warning) is logged over and over again, if the cause for the error persistently remains. To prevent the log from flooding, it is possible to specify how many times a particular error may be logged within a time period, before the logging of that error is suppressed for a while.
In the example above, the logging of a particular error will be suppressed for 15 seconds if the error has been logged 8 times in 2 seconds.
The default is 10, 1000ms, 10000ms, which means that if the same error is logged 10 times in one second, the logging of that error is suppressed for the following 10 seconds.
Whenever an error message that is being throttled is logged within the triggering window (the second argument), the suppression window is extended. This continues until there is a pause in the messages that is longer than the triggering window.
For example, with the default configuration the messages must pause for at least one second in order for the throttling to eventually stop. This mechanism prevents long-lasting error conditions from slowly filling up the log with short bursts of messages.
To disable log throttling, add an entry with an empty value
or one where any of the integers is 0.
The durations can be specified as documented . If no explicit unit is provided, the value is interpreted as milliseconds in MaxScale 2.4. In subsequent versions a value without a unit may be rejected.
Note that notice, info and debug messages are never throttled.
logdirType: path
Mandatory: No
Dynamic: No
Default: /var/log/maxscale
Set the directory where the logfiles are stored. The folder needs to be both readable and writable by the user running MariaDB MaxScale.
datadirType: path
Mandatory: No
Dynamic: No
Default: /var/lib/maxscale
Set the directory where the data files used by MariaDB MaxScale are stored. Modules can write to this directory and for example the binlogrouter uses this folder as the default location for storing binary logs.
This is also the directory where the password encryption key is read from that is generated by maxkeys.
secretsdirType: path
Mandatory: No
Dynamic: No
Default: ""
The location where the .secrets file is read from. If secretsdir is not defined, the file is read from .
This parameter was added in MaxScale 6.4.16, 22.08.13, 23.02.10, 23.08.6 and 24.02.2.
libdirType: path
Mandatory: No
Dynamic: No
Default: OS Dependent
Set the directory where MariaDB MaxScale looks for modules. The library directory is the only directory that MariaDB MaxScale uses when it searches for modules. If you have custom modules for MariaDB MaxScale, make sure you have them in this folder.
The default value depends on the operating system. For RHEL versions the value is /usr/lib64/maxscale/. For Debian and Ubuntu it is /usr/lib/x86_64-linux-gnu/maxscale/
sharedirType: path
Mandatory: No
Dynamic: No
Default: /usr/share/maxscale
Sets the directory where static data assets are loaded.
The MaxScale GUI static files are located in the gui/ subdirectory. If the GUI files have been manually moved somewhere else, this path must be configured to point to the parent directory of the gui/ subdirectory.
The MaxScale REST API only serves files for the GUI that are located in the gui/ subdirectory of the configured sharedir. Any files whose real path resolves to outside of this directory are not served by the MaxScale GUI: this is done to prevent other files from being accessible via the MaxScale REST API. This means that path to the GUI source directory can contain symbolic links but all parts after the /gui/ directory must reside inside it.
cachedirRemoved in MaxScale 25.08. In MaxScale 1, this controlled the location where the database users were cached when access to the servers was not possible. This directory has not been used since the MaxScale 2.0 release.
piddirType: path
Mandatory: No
Dynamic: No
Default: /run/maxscale
Configure the directory for the PID file for MariaDB MaxScale. This file contains the Process ID for the running MariaDB MaxScale process.
MaxScale versions before 24.08.1 used the path /var/run/maxscale/ for the PID files. This was a legacy path according to the Filesystem Hierarchy Standard and starting with MaxScale 24.08.1, the appropriate modern PID file path is used.
The value of piddir should not be changed when MaxScale is installed from a DEB/RPM package and is run as a SystemD service. The SystemD service file in /lib/systemd/systemd/maxscale.service depends on the PID file being stored at /run/maxscale/maxscale.pid. However, if piddir must be modified to point to a non-default location, it must also be modified in the SystemD service file configuration to point to the new location.
execdirRemoved in MaxScale 25.10.
connector_plugindirType: path
Mandatory: No
Dynamic: No
Default: OS Dependent
Location of the MariaDB Connector-C plugin directory. The MariaDB Connector-C used in MaxScale can use this directory to load authentication plugins. The versions of the plugins must be binary compatible with the connector version that MaxScale was built with.
Starting with version 6.2.0, the plugins are bundled with MaxScale and the default value now points to the bundled plugins. The location where the plugins are stored depends on the operating system. For RHEL versions the value is /usr/lib64/maxscale/plugin/. For Debian and Ubuntu it is /usr/lib/x86_64-linux-gnu/maxscale/plugin/.
Older versions of MaxScale used /usr/lib/mysql/plugin/ as the default value.
persistdirType: path
Mandatory: No
Dynamic: No
Default: /var/lib/maxscale/maxscale.cnf.d/
Configure the directory where persisted configurations are stored. When a new object is created via MaxCtrl, it will be stored in this directory. Do not use this directory for normal configuration files, use /etc/maxscale.cnf.d/ instead. The user MaxScale is running as must be able to write into this directory.
module_configdirType: path
Mandatory: No
Dynamic: No
Default: /etc/maxscale.modules.d/
Configure the directory where module configurations are stored. Path arguments are resolved relative to this directory. This directory should be used to store module specific configurations.
Any configuration parameter that is not an absolute path will be interpreted as a relative path. The relative paths use the module configuration directory as the working directory.
For example, the configuration parameter file=my_file.txt would be interpreted as /etc/maxscale.modules.d/my_file.txt whereas file=/home/user/my_file.txt would be interpreted as /home/user/my_file.txt.
languageRemoved in MaxScale 25.08. In MaxScale 1, this controlled the location of an internal data file which has not been used since the MaxScale 2.0 release.
query_classifierDeprecated since MariaDB MaxScale 23.08.
query_classifier_cache_sizeType:
Mandatory: No
Dynamic: Yes
Default: System Dependent
Specifies the maximum size of the query classifier cache. The default limit is 15% of available system memory. The available system memory may be less than the total system memory, if MaxScale is running in a container whose resources have been limited.
When the query classifier cache has been enabled, MaxScale will, after a statement has been parsed, store the classification result using the canonicalized version of the statement as the key.
If the classification result for a statement is needed, MaxScale will first canonicalize the statement and check whether the result can be found in the cache. If it can, the statement will not be parsed at all but the cached result is used.
The configuration parameter takes one integer that specifies the maximum size of the cache. The size of the cache can be specified as explained .
Note that MaxScale uses a separate cache for each worker thread. To obtain the amount of memory available for each thread, divide the cache size with the value of threads. If statements are evicted from the cache (visible in the diagnostic output), consider increasing the cache size.
Note also that limit is not a hard limit, but an approximate one. Namely, although the memory needed for storing the canonicalized statement and the classification result is correctly accounted for, there is additional overhead whose size is not exactly known and over which we do not have direct control.
Using maxctrl show threads it is possible to check what the actual size of the cache is and to see performance statistics.
query_classifier_argsDeprecated since MariaDB MaxScale 23.08.
substitute_variablesType:
Mandatory: No
Dynamic: No
Default: false
Enable or disable the substitution of environment variables in the MaxScale configuration file. If the substitution of variables is enabled and a configuration line like
is encountered, then $SOME_VALUE will be replaced with the actual value of the environment variable SOME_VALUE. Note:
Variable substitution will be made only if '$' is the first character of the value.
Everything following '$' is interpreted as the name of the environment variable.
Referring to a non-existing environment variable is a fatal error.
The setting of substitute_variables will have an effect on all parameters in the all other sections, irrespective of where the [maxscale] section is placed in the configuration file. However, in the [maxscale] section, to ensure that substitution will take place, place the substitute_variables=true line first.
sql_modeType:
Mandatory: No
Dynamic: No
Values: default, oracle
Specifies whether the query classifier parser should initially expect MariaDB or PL/SQL kind of SQL.
The allowed values are: default: The parser expects regular MariaDB SQL. oracle : The parser expects PL/SQL.
NOTE If sql_mode is set to oracle, then MaxScale will also assume that autocommit initially is off.
At runtime, MariaDB MaxScale will recognize statements like
and
and change mode accordingly.
NOTE If set sql_mode=oracle; is encountered, then MaxScale will also behave as if autocommit had been turned off and conversely, if set sql_mode=default; is encountered, then MaxScale will also behave as if autocommit had been turned on.
Note that MariaDB MaxScale is not explicitly aware of the sql mode of the server, so the value of sql_mode should reflect the sql mode used when the server is started.
local_addressType: string
Mandatory: No
Dynamic: No
Default: ""
What specific local address/interface to use when connecting to servers.
This can be used for ensuring that MaxScale uses a particular interface when connecting to servers, in case the computer MaxScale is running on has multiple interfaces.
If given as a hostname, MaxScale will perform name lookup on the address when starting and reuse the result.
users_refresh_timeType:
Mandatory: No
Dynamic: Yes
Default: 30s
How often, in seconds, MaxScale at most may refresh the users from the backend server.
MaxScale will at startup load the users from the backend server, but if the authentication of a user fails, MaxScale assumes it is because a new user has been created and will thus refresh the users. By default, MaxScale will do that at most once per 30 seconds and with this configuration option that can be changed. A value of 0 allows infinite refreshes and a negative value disables the refreshing entirely.
The value is specified as documented . If no explicit unit is provided, the value is interpreted as seconds in MaxScale 2.4. In subsequent versions a value without a unit may be rejected. Note that since the granularity of the timeout is seconds, a timeout specified in milliseconds will be rejected, even if the duration is longer than a second.
In MaxScale 2.3.9 and older versions, the minimum allowed value was 10 seconds but, due to a bug, the default value was 0 which allowed infinite refreshes.
users_refresh_intervalType:
Mandatory: No
Dynamic: Yes
Default: 0s
How often, in seconds, MaxScale will automatically refresh the users from the backend server.
This configuration is used to periodically refresh the backend users, making sure they are up to date. The default value for this setting is 0, meaning the users are not periodically refreshed. However, they can still be refreshed in case of failed authentication depending on users_refresh_time.
retain_last_statementsType: number
Mandatory: No
Dynamic: Yes
Default: 0
How many statements MaxScale should store for each session. This is for debugging purposes, as in case of problems it is often of value to be able to find out exactly what statements were sent before a particular problem turned up.
Note: See also dump_last_statements using which the actual dumping of the statements is enabled. Unless both of the parameters are defined, the statement dumping mechanism doesn't work.
dump_last_statementsType:
Mandatory: No
Dynamic: Yes
Values: on_close, on_error, never
With this configuration item it is specified in what circumstances MaxScale should dump the last statements that a client sent. The allowed values are never, on_error and on_close. With never the statements are never logged, with on_error they are logged if the client closes the connection improperly, and with on_close they are always logged when a client session is closed.
Note that you need to specify with retain_last_statements how many statements MaxScale should retain for each session. Unless it has been set to another value than 0, this configuration setting will not have an effect.
session_traceType: number
Mandatory: No
Dynamic: Yes
Default: 0
How many log entries are stored in the session specific trace log. This log is written to disk when a session ends abnormally and can be used for debugging purposes. Currently the session trace log is written to the log in the following situations:
When MaxScale receives a fatal signal and is about to crash.
Whenever an unexpected response is read from a server
If the session is not closed gracefully (i.e. client doesn't send a COM_QUIT packet)
Whenever readwritesplit receives a response that is was not expecting.
It would be good to enable this if a session is disconnected and the log is not detailed enough. In this case the info log might reveal the true cause of why the connection was closed.
Default is 0.
The session trace log is also exposed by REST API and is shown withmaxctrl show sessions.
The order in which the session trace messages are logged into the log changed in MaxScale 6.4.9 (MXS-4716). Newer versions will log the messages in the "normal log order" of older events coming first and newer events appearing later in the file. Older versions of MaxScale logged the trace dump in the reverse order with the newest messages first and oldest ones last.
session_trace_matchType:
Mandatory: No
Dynamic: Yes
Default: None
If both session_trace and session_trace_match are defined, and a trace log entry of a session matches the regular expression, the trace log is written to disk and then cleared. This way subsequent matches will only write new log entries.
In MaxScale versions 24.08 and older, the check for the match was done only when the session was stopping.
The most effective way to debug MaxScale related issues is to turn on log_info and observe the events written into the MaxScale log. The only problem with this approach is that it can cause a severe performance bottleneck and can easily fill up the disk as the amount of data written to it is significant. With session_trace and session_trace_match, the content that actually gets logged can be filtered to only what is needed.
For example, the following configuration would only log the trace log messages from sessions that execute SQL queries with syntax errors:
This could be used to easily identify which applications execute the queries without having to gather the info level log output from all the sessions that connect to MaxScale. For every session that ends up logging a syntax error message, the last 1000 lines of log output done by that session is written into the MaxScale log.
writeq_high_waterType:
Mandatory: No
Dynamic: Yes
Default: 65536
High water mark for network write buffer. When the size of the outbound network buffer in MaxScale for a single connection exceeds this value, network traffic throttling for that connection is started. The parameter accepts . The default value was 16777216 bytes before 22.08.4.
More specifically, if the client side write queue is above this value, it will block traffic coming from backend servers. If the backend side write queue is above this value, it will block traffic from client.
The buffer that this parameter controls is the buffer internal to MaxScale and is not the kernel TCP send buffer. This means that the total amount of buffered data is determined by both the kernel TCP buffers and the value of writeq_high_water.
Network throttling is only enabled when writeq_high_water is non-zero. In MaxScale 23.02 and earlier, also writeq_low_water had to be non-zero.
writeq_low_waterType:
Mandatory: No
Dynamic: Yes
Default: 1024
Low water mark for network write buffer. Once the traffic throttling is enabled, it will only be disabled when the network write buffer is below writeq_low_water bytes. The parameter accepts . The default value was 8192 bytes before 22.08.4.
The value of writeq_high_water must always be greater than the value of writeq_low_water.
persist_runtime_changesType:
Default: true
Dynamic: No
Persist changes done at runtime. This parameter was added in MaxScale 22.08.0.
When persist_runtime_changes is enabled, runtime configuration changes done with the GUI, MaxCtrl or via the REST API cause a new configuration file to be saved in /var/lib/maxscale/maxscale.cnf.d/. If load_persisted_configs is enabled, these files will be applied on top of any existing values found in static configuration files whenever MaxScale is starting up.
load_persisted_configsType:
Mandatory: No
Dynamic: No
Default: true
Load persisted runtime changes on startup. This parameter was added in MaxScale 2.3.6.
All runtime configuration changes are persisted in generated configuration files located by default in /var/lib/maxscale/maxscale.cnf.d/ and are loaded on startup after main configuration files have been read. To make runtime configurations volatile (i.e. they are lost when maxscale is restarted), use load_persisted_configs=false. All changes are still persisted since it stores the current runtime state of MaxScale. This makes problem analysis easier if an unexpected outage happens.
max_auth_errors_until_blockType: number
Mandatory: No
Dynamic: Yes
Default: 10
The maximum number of authentication failures that are tolerated before a host is temporarily blocked. The default value is 10 failures. After a host is blocked, connections from it are rejected for 60 seconds. To disable this feature, set the value to 0.
Note that the configured value is not a hard limit. The number of tolerated failures is between max_auth_errors_until_block and threads * max_auth_errors_until_block where max_auth_errors_until_block is the configured value of this parameter and threads is the number of configured threads.
debugType: string
Mandatory: No
Dynamic: No
Default: ""
Define debug options from the --debug command line option. Either the command line option or the parameter should be used, not both. The debug options are only for testing purposes and are not to be used in production.
require_secure_transportType:
Default: false
Dynamic: No
If enabled, listeners, servers and REST-API must be configured to use SSL. Any static configuration or runtime configuration change that disables SSL will fail. Kafka connections created by the KafkaCDC and KafkaImporter modules must also be configured for SSL. ODBC connection strings used with the REST-API SQL Connection Interface are not affected. Listeners and servers that use Unix socket connections are ignored as they are considered secure even without SSL.
The MaxScale REST API is an HTTP interface that provides JSON format data intended to be consumed by monitoring applications and visualization tools.
The following options must be defined under the [maxscale] section in the configuration file.
admin_hostType: string
Mandatory: No
Dynamic: No
Default: "127.0.0.1"
The network interface where the REST API listens on. The default value is the IPv4 address 127.0.0.1 which only listens for local connections.
admin_portType: number
Mandatory: No
Dynamic: No
Default: 8989
The port where the REST API listens on. The default value is port 8989.
admin_authType:
Mandatory: No
Dynamic: No
Default: true
Enable REST API authentication using HTTP Basic Access authentication. This is not a secure method of authentication without HTTPS but it does add a small layer of security.
For more information, read the .
admin_ssl_keyType: path
Mandatory: No
Dynamic: No
Default: ""
The path to the TLS private key in PEM format for the admin interface.
If the admin_ssl_key and admin_ssl_cert options are all defined, the admin interface will use encrypted HTTPS instead of plain HTTP.
The REST-API only supports PKCS#8 PEM private keys and using a PKCS#1 PEM private key will result in an error. If your private key is in PKCS#1 PEM format, convert it to PKCS#8 PEM format first before starting up MaxScale.
If the key is protected by a password, the password must be provided with .
admin_ssl_certType: path
Mandatory: No
Dynamic: No
Default: ""
The path to the TLS public certificate in PEM format. See admin_ssl_key documentation for more details.
admin_ssl_ca_certDeprecated since MariaDB MaxScale 22.08. See admin_ssl_ca.
admin_ssl_caType: path
Mandatory: No
Dynamic: No
Default: ""
The path to the TLS CA certificate in PEM format.
If defined, the certificate is used as an additional CA certificate for all outbound HTTP request that are done when e.g. admin_oidc_url is defined. This can be used when the OIDC server either uses self-signed certificates or the CA is not trusted by default by the operating system.
This does not enable mTLS in the REST-API which means that client TLS certificates are not validated even if a CA is specified.
admin_ssl_passphraseType: string
Mandatory: No
Dynamic: Yes
Default: ""
For details, please see that behaves exactly like admin_ssl_passphrase.
admin_ssl_versionType:
Mandatory: No
Dynamic: No
Values: MAX, TLSv1.0, TLSv1.1
This parameter controls the enabled TLS versions in the REST API. Accepted values are:
TLSv10
TLSv11
TLSv12
TLSv13
MaxScale versions 6.4.16, 22.08.13, 23.02.10, 23.08.6, 24.02.2 and all newer releases accept also the following alias values:
TLSv1.0
TLSv1.1
TLSv1.2
TLSv1.3
The default value is MAX which negotiates the highest level of encryption that both the client and server support. The list of supported TLS versions depends on the operating system and what TLS versions the GnuTLS library supports.
For example, to enable only TLSv1.1 and TLSv1.3, use admin_ssl_version=TLSv1.1,TLSv1.3.
This parameter was added in MaxScale 2.5.7.
Older versions of MaxScale interpreted admin_ssl_version as the minimum allowed TLS version. In those versions, admin_ssl_version=TLSv1.2 allowed both TLSv1.2 and TLSv1.3. In MaxScale 6.4.16, 22.08.13, 23.02.10, 23.08.6, 24.02.2 and all newer versions, the value is a enumeration of accepted TLS protocol versions. In these versions, admin_ssl_version=TLSv1.2 only allows TLSv1.2. To retain the old behavior, specify all the accepted values with admin_ssl_version=TLSv1.2,TLSv1.3
admin_ssl_cipherType: string
Mandatory: No
Dynamic: No
Additional TLS cipher settings. The configured value is prepended to and the resulting string is given as is to . If left undefined, NORMAL is used.
Adding unrecognized elements to this setting will cause REST-API startup to fail with the error:
The value should typically start with a collection of ciphersuites, such as "NORMAL" or "SECURE256". Then, add or remove algorithms with more specific cipher definitions such as "+AES-128-GCM" or "-AES-128-GCM".
admin_enabledType:
Mandatory: No
Dynamic: No
Default: true
Enable or disable the admin interface. This allows the admin interface to be completely disabled to prevent access to it.
admin_guiType:
Mandatory: No
Dynamic: No
Default: true
Enable or disable the admin graphical user interface.
MaxScale provides a GUI for administrative operations via the REST API. When the GUI is enabled, the root REST API resource (i.e. http://localhost:8989/) will serve the GUI. When disabled, the REST API will respond with a 200 OK to the request. By disabling the GUI, the root resource can be used as a low overhead health check.
admin_secure_guiType:
Mandatory: No
Dynamic: No
Default: true
Whether to serve the GUI only over secure HTTPS connections.
To be secure by default, the GUI is only served over HTTPS connections as it uses a token authentication scheme. This also controls whether the /auth endpoint requires an encrypted connection.
To allow use of the GUI without having to configure TLS certificates for the MaxScale REST API, set this parameter to false.
admin_log_auth_failuresType:
Mandatory: No
Dynamic: Yes
Default: true
Log authentication failures for the admin interface.
admin_pam_readwrite_serviceType: string
Mandatory: No
Dynamic: No
Default: ""
Use Pluggable Authentication Modules (PAM) for REST API authentication. This setting and admin_pam_readonly_service accept a PAM service name which is used during authentication if normal authentication fails. admin_pam_readwrite_service should accept users who can do any MaxCtrl/REST-API-operation. admin_pam_readonly_service should accept users who can only do read operations. Because REST-API does not support back and forth communication between the client and MaxScale, the PAM services must be simple. They should only ask for the password and nothing else.
If only admin_pam_readwrite_service is configured, both read and write operations can be authenticated by PAM. If only admin_pam_readonly_service is configured, only read operations can be authenticated by PAM. If both are set, the service used is determined by the requested operation. Leave or set both empty to disable PAM for REST-API.
admin_pam_readonly_serviceType: string
Mandatory: No
Dynamic: No
Default: ""
See .
admin_readwrite_hostsType: string
Mandatory: No
Dynamic: No
Default: %
Limit REST-API logins to specific source addresses/hosts. Supports a comma-separated list of addresses and hostnames. Addresses can be given in CIDR-notation. Admin clients still need to supply credentials as usual. By default, all source addresses are allowed. admin_readwrite_hosts lists the hosts from which any operation is allowed.
This setting was added in MaxScale 24.02.0.
When listing hostnames, % and _ act as wildcards, similar to the hostname component in MariaDB Server user accounts. localhost is a reserved hostname and will not match any connection (use 127.0.0.1 for loopback connections).
When checking the source host of the incoming REST-API client, MaxScale first compares against addresses and address masks. If a match was not found and the setting values contain hostnames, reverse name lookup is performed on the client address. The lookup can take a while in rare cases. To prevent such slowdown, use only IP-addresses in the host lists.
skip_name_resolve cannot be enabled if admin_readwrite_hosts or admin_readonly_hosts includes hostname patterns, as these would not work.
admin_readonly_hostsWorks similar to admin_readwrite_hosts. Lists the hosts from which only read operations are allowed. An admin client can do a read operation if their source address matches either admin_readwrite_hosts or admin_readonly_hosts.
This setting was added in MaxScale 24.02.0.
admin_jwt_algorithmType:
Mandatory: No
Dynamic: No
Values: auto, HS256, HS384
The signature algorithm used by the MaxScale REST API when generating JSON Web Tokens.
For more information about the tokens and how they work, refer to .
If a symmetric algorithm is used (i.e. HS256, HS384 or HS512), MaxScale will generate a random encryption key on startup and use that to sign the messages. The symmetric key can also be retrieved from an if the admin_jwt_key parameter is defined.
If an asymmetric algorithm (i.e. public key authentication) is used, both the admin_ssl_cert and admin_ssl_key parameters must be defined and they must contain a private key and a public certificate of the correct type. If the wrong key type, key length or elliptic curve is used, MaxScale will refuse to start.
Asymmetric key algorithms make it possible for the clients of the REST API to validate that the token was indeed generated by the correct entity.
Symmetric algorithms make it easy to share the same tokens between multiple MaxScale instances as the shared secret can be stored in a key management system.
The possible values for this parameter are:
auto
MaxScale will attempt to detect the best algorithm to use for signatures. The algorithm used depends on the private key type: RSA keys use PS256, EC keys use the ES256, ES384 or ES512 depending on the curve, Ed25519 keys use ED25519 and Ed448 keys uses ED448. If MaxScale cannot auto-detect the key type, it falls back to
admin_jwt_keyType: string
Mandatory: No
Dynamic: No
Default: ""
The ID for the encryption key used to sign the JSON Web Tokens. If configured, an must also be configured and it must contain the key with the given ID. If no key is defined, MaxScale will use a random encryption key whenever a symmetric signature algorithm is used.
Currently, the encryption key is only read on startup. This means that the tokens will be signed by the latest key version that is available on startup: rotating the encryption key in the key management system will not cause the JWTs to be signed with newer versions of the key.
admin_jwt_max_ageType:
Mandatory: No
Dynamic: No
Default: 24h
The maximum lifetime of a token generated by the /auth endpoint.
If a client requests for a token with a lifetime that exceeds the configured value, the token lifetime is silently truncated to this value. This can be used to control the maximum length of a MaxGUI session.
This also acts as the effective maximum age of any database connection created from the /sql endpoint.
admin_oidc_urlType: string
Mandatory: No
Dynamic: Yes
Default: ""
The URL to a OpenID Connect server that is used for JWT validation.
If defined, any tokens signed by this server are accepted as valid bearer tokens for the MaxScale REST API. The "sub" field of the token is assumed to be the username of an administrative user in MaxScale and the "account" claim is assumed to be the type of the user: "admin" for administrative users with full access to the REST-API and "basic" for users with read-only access to the REST-API. This means that all users must be first created with maxctrl create user before the tokens are accepted if the OIDC provider is not able to add the "account" claim.
Modifying admin_oidc_url will cause the certificates to be fetched again. They are also fetched when the maxctrl reload tls command is executed or when the admin_ssl_cert and admin_ssl_key settings are modified.
MaxScale versions 22.08.16 and earlier only fetched the new certificates when the maxctrl reload tls command was executed.
admin_oidc_flowType:
Mandatory: No
Dynamic: Yes
Values: auto, implicit, code
The OpenID Connect authentication flow that's used for authenticating clients when Single Sing-On is being used.
By default, the choice of the flow is made based on the supported capabilities of the authorization server. The code flow is preferred if it is supported by the authorization server and if it doesn't, the implicit flow is used as a fallback.
admin_oidc_client_idType: string
Mandatory: No
Dynamic: Yes
Default: ""
The client ID that's used when doing OpenID Connect requests. When using another MaxScale as the authorization server, this is the REST-API username that's used.
If client_id is not configured, the value of admin_jwt_issuer is used as the client_id for all OpenID Connect requests.
admin_oidc_client_secretType: password
Mandatory: No
Dynamic: Yes
Default: ""
The client secret that's used when doing OpenID Connect requests. When using another MaxScale as the authorization server, this is the REST-API password that's used.
admin_oidc_ssl_insecureType:
Mandatory: No
Dynamic: Yes
Default: false
Disable TLS certificate validation when fetching OIDC certificates. This should only be enabled when testing with a local OpenID Connect provider with self-signed certificates.
admin_oidc_extra_optionsType: string
Mandatory: No
Dynamic: No
Default: ""
Extra options that are added to the initial authorization request. These options are sometimes needed to pass extra information to the identity provider service.
For , the API that is used must be defined with this setting. For example, if the API name is my-api then admin_oidc_extra_options=audience=my-api should be used.
admin_verify_urlType: string
Mandatory: No
Dynamic: No
Default: ""
URL to a server to which the REST API token verification is delegated.
If the URL is defined, any tokens passed to the REST API will be validated by doing a GET request to the URL with the client's token as a bearer token. The Referer header of the request is set to the URL being requested by the client and the custom X-Referrer-Method header is set to the HTTP method being used (PUT, GET etc.).
Note: When admin_verify_url is used and the remote server cannot be accessed, all REST API access that uses tokens will be disabled. The only way to use the REST API with tokens is to remove admin_verify_url from the configuration which requires restarting MaxScale. The REST API still accepts HTTP Basic Access authentication even if the remote server cannot be reached.
By delegating the authentication and authorization of the REST API to an external server, users can implement custom access control systems for the MaxScale REST API.
admin_jwt_issuerType: string
Mandatory: No
Dynamic: No
Default: maxscale
The issuer ("iss") claim of all JWTs generated by MaxScale. This can be set to a custom value to uniquely identify which MaxScale issued a JWT. This is especially useful for cases where the MaxScale GUI is used from behind a reverse proxy.
admin_auditType:
Mandatory: No
Dynamic: Yes
Default: false
Enable logging of incoming REST API calls.
admin_audit_fileType: string
Mandatory: No
Dynamic: Yes
Default: /var/log/maxscale/admin_audit.csv
The file where the REST API auditing information is logged.
If a non-default value is used, the directory where the file resides must exist. For example, with /var/log/maxscale/audit_files/audit.csv, the directory /var/log/maxscale/audit_files must exist.
admin_audit_exclude_methodsType:
Mandatory: No
Dynamic: Yes
Values: GET, PUT, POST
List of comma separated HTTP methods to exclude from logging Currently MaxScale does not use CONNECT or TRACE.
Resetting to log all methods can be done in the configuration file by writing admin_audit_exclude_methods= or at runtime with maxctrl alter maxscale admin_audit_exclude_methods=. Remember that once a runtime change has been made, the entry for that setting is ignored in the main configuration file (usually maxscale.cnf).
config_sync_clusterType: monitor
Mandatory: No
Dynamic: Yes
Default: None
This parameter controls which cluster (i.e. monitor) is used to synchronize configuration changes between MaxScale instances. The first server labeled Master will be used for the synchronization.
By default configuration synchronization is not enabled and it must be explicitly enabled by defining a monitor name for config_sync_cluster.
When config_sync_cluster is defined, config_sync_user and config_sync_password must also be defined.
For a detailed description of this feature, refer to the section.
config_sync_userType: string
Mandatory: No
Dynamic: Yes
Default: None
The username for the account that is used to synchronize configuration changes across MaxScale instances. Both this parameter and config_sync_password are required if config_sync_cluster is configured.
This account must have the following grants:
The mysql.maxscale_config table can be pre-created in which case the CREATE grant is not needed by the user configured in config_sync_user. The following SQL is used to create the table.
If the database where the table is created is changed with config_sync_db, the grants must be adjusted to target that database instead.
config_sync_passwordType: password
Mandatory: No
Dynamic: Yes
Default: None
The password for config_sync_user. Both this parameter and config_sync_user are required if config_sync_cluster is configured. This password can optionally be encrypted using maxpasswd.
config_sync_dbType: string
Mandatory: No
Dynamic: No
Default: mysql
The database where the maxscale_config table is created. By default the table is created in the mysql database. This parameter was added in MaxScale versions 6.4.6 and 22.08.5.
As tables in the mysql database cannot have triggers on them, the database must be changed to a user-created one in order to create triggers on the table. An example use-case for triggers on this table is to track all configuration changes done to MaxScale by inserting them into a separate table.
config_sync_intervalType:
Mandatory: No
Dynamic: Yes
Default: 5s
How often to synchronize the configuration with the cluster.
As the synchronization involves selecting the configuration version from the database, this value should not be set to an unreasonably low value. The default value of 5 second should provide a good compromise between responsiveness and how much load it places on the database.
config_sync_timeoutType:
Mandatory: No
Dynamic: Yes
Default: 10s
Timeout for all SQL operations done during the configuration synchronization. If an operation exceeds this timeout, the configuration change is treated as failed and an error is reported to the client that did the change.
telemetryType:
Mandatory: No
Dynamic: Yes
Default: false
When enabled MaxScale sends telemetry to the OpenTelemetry Collector.
telemetry_attributesType: stringlist
Default: empty
Dynamic: Yes
Mandatory: No
Optional global attributes to send with every metric. Example telemetry_attributes=project=default-project,cluster=mariadb1,instance=maxscale1
telemetry_update_intervalType:
Mandatory: No
Dynamic: Yes
Default: 60s
Minimum interval to send metrics to the collector.
telemetry_ssl_insecureType:
Mandatory: No
Dynamic: Yes
Default: false
When enable and SSL certificates are defined, MaxScale OpenTelemetry uses insecure HTTPS and doesn't validate certificates.
telemetry_urlType: string
Mandatory: No
Dynamic: No
Default: http://localhost:4318/v1/metrics
The OpenTelemetrymetrics URL where MaxScale pushes metrics.
telemetry_ssl_keyType: path
Mandatory: No
Dynamic: No
Default: ""
The path to the TLS private key in PEM format for sending telemetry.
If the telemetry_ssl_ca and telemetry_ssl_cert options are all defined, the sending of metrics will use encrypted HTTPS instead of plain HTTP. If setting SSLm you also must to change the telemetry_url to https as in https://localhost:4318/v1/metrics.
telemetry_ssl_certType: path
Mandatory: No
Dynamic: No
Default: ""
The path to the TLS public certificate in PEM format. See telemetry_ssl_key and admin_ssl_key for more documentation details.
telemetry_ssl_caType: path
Mandatory: No
Dynamic: No
Default: ""
The path to a TLS CA certificate in PEM format.
key_managerType:
Dynamic: Yes
Values: none, file, kmip, vault
The encryption key manager to use. The available encryption key managers are:
none - No key manager, encryption keys are not available.
file -
kmip -
Refer to the section for more information on how to configure the key managers. The key managers each have their configuration in their own namespace and must have their name as a prefix.
For example to configure the file key manager, the following must be used:
MaxScale logs warnings and errors for various reasons and often it is self- evident and generally applicable whether some occurrence should warrant a warning or an error, or perhaps just an info-level message.
However, there are events whose seriousness is not self-evident. For instance, in some environments an authentication failure may simply indicate that someone has made a typo, while in some other environment that can only happen in case there has been a security breech.
To handle events like these, MaxScale defines events whose logging facility and level can be controlled by the administrator. Given an event X, its facility and level are controlled in the following manner:
The above means that if event X occurs, then that is logged using the facility LOG_LOCAL0 and the level LOG_ERR.
The valid values of facility are the facility values reported byman syslog, e.g.LOG\_AUTH,LOG\_LOCAL0andLOG\_USER. Likewise, the valid values for levelare the ones also reported byman syslog, e.g.LOG\_WARNING,LOG\_ERRandLOG\_CRIT\.
Note that MaxScale does not act upon the level, that is, even if the level of a particular event is defined to be LOG_EMERG, MaxScale will not shut down if that event occurs.
The default facility is LOG_USER and the default level is LOG_WARNING.
Note that you may also have to configure rsyslog to ensure that the event can be logged to the intended log file. For instance, if the facility is chosen to be LOG_AUTH, then /etc/rsyslog.conf should contain a line like
for the logged events to end up in /var/log/auth.log, where the initialauth is the relevant entry.
The available events are:
This event occurs when there is an authentication failure.
This event occurs when the firewall blocks a query.
A service represents the database service that MariaDB MaxScale offers to the clients. In general a service consists of a set of backend database servers and a routing algorithm that determines how MariaDB MaxScale decides to send statements or route connections to those backend servers.
A service may be considered as a virtual database server that MariaDB MaxScale makes available to its clients.
Several different services may be defined using the same set of backend servers. For example a connection based routing service might be used by clients that already performed internal read/write splitting, whilst a different statement based router may be used by clients that are not written with this functionality in place. Both sets of applications could access the same data in the same databases.
A service is identified by a service name, which is the name of the configuration file section and a type parameter of service.
In order for MariaDB MaxScale to forward any requests it must have at least one service defined within the configuration file. The definition of a service alone is not enough to allow MariaDB MaxScale to forward requests however, the service is merely present to link together the other configuration elements.
routerType: router
Mandatory: Yes
Dynamic: No
The router parameter of a service defines the name of the router module that will be used to implement the routing algorithm between the client of MariaDB MaxScale and the backend databases. Additionally routers may also be passed a comma separated list of options that are used to control the behavior of the routing algorithm. The two parameters that control the routing choice are router and router_options. The router options are specific to a particular router and are used to modify the behavior of the router. The read connection router can be passed options of master, slave or synced, an example of configuring a service to use this router and limiting the choice of servers to those in slave state would be as follows.
To change the router to connect on to servers in the master state as well as slave servers, the router options can be modified to include the master state.
A more complete description of router options and what is available for a given router is included with the documentation of the router itself.
filtersType: filter list
Mandatory: No
Dynamic: Yes
Default: None
The filters option allow a set of filters to be defined for a service; requests from the client are passed through these filters before being sent to the router for dispatch to the backend server. The filters parameter takes one or more filter names, as defined within the filter definition section of the configuration file. Multiple filters are separated using the | character.
The requests pass through the filters from left to right in the order defined in the configuration parameter.
If a value in the filters list is not the name of any object in MaxScale but is the name of a filter which does not have any configuration settings, it is interpreted as an implicit filter. These types of filters will be automatically created whenever they're used in a service. This makes it easy to enable functionality which does not require configuration that is implemented in filters.
The created filter will have the same name as the filter module. For example, using filters=hintfilter will automatically create a filter named hintfilter using the hintfilter module and add it to the service.
Only filters that have no configuration settings can be implicitly created.
If the implicit filter fails to be created, an error is logged and no further automatic attempts are made to load that specific filter module even if it's referred to by other services.
targetsType: target list
Mandatory: No
Dynamic: Yes
Default: None
The targets parameter is a comma separated list of server and/or service names that comprise the routing targets of the service. This parameter was added in MaxScale 2.5.0.
This parameter allows nested service configurations to be defined without having to configure listeners for all services. For example, one use-case is to use multiple readwritesplit services behind a schemarouter service to have both the sharding of schemarouter with the high-availability of readwritesplit.
NOTE: The targets parameter is mutually exclusive with the cluster and servers parameters.
serversType: server list
Mandatory: No
Dynamic: Yes
Default: None
The servers parameter in a service definition provides a comma separated list of the backend servers that comprise the service. The server names are those used in the name section of a block with a type parameter of server (see below).
NOTE: The servers parameter is mutually exclusive with the cluster and targets parameters.
clusterType: monitor
Mandatory: No
Dynamic: Yes
Default: None
The servers the service uses are defined by the monitor specified as value of this configuration parameter.
NOTE: The cluster parameter is mutually exclusive with the servers andtargets parameters.
userType: string
Mandatory: Yes
Dynamic: Yes
This setting defines the user the service uses to fetch user account information from backends. A password is specified using .
See for more information (such as required grants) and troubleshooting tips regarding user account management and client authentication.
passwordType: string
Mandatory: Yes
Dynamic: Yes
This settings defines the password the service uses to fetch user account information from backends. The password may be either a plain text password or an . The user is specified using .
See for more information (such as required grants) and troubleshooting tips regarding user account management and client authentication.
From 23.08.0 onwards, MaxScale will remember the previous password when the password is changed. If the fetching of the user account information fails using the new password, it will be attempted using the previous one. The purpose of this change is to make it a smoother operation to change the password of the service user. The steps are as follows:
$ maxctrl alter service MyService password=TheNewPassword
MariaDB [(none)]> set password for TheServiceUser = password('TheNewPassword');
Since the old password is remembered and used if the new password does not work, it is no longer necessary to perform those steps simultaneously.
roleType: string
Mandatory: No
Dynamic: Yes
Default: None
the service should activate right after connecting to a server. If empty, no role is set. This setting may be useful if the same username is used for both monitors and services. As monitors and services require different privileges, these privileges can be granted to the monitor and the service roles separately instead of granting them all to the same user.
For services, this setting only affects user account fetching from MariaDB Servers. It does not affect router specific connections such as replication by the or replication management by the .
enable_root_userType:
Mandatory: No
Dynamic: Yes
Default: false
This parameter controls the ability of the root user to connect to MariaDB MaxScale and hence onwards to the backend servers via MariaDB MaxScale.
localhost_match_wildcard_hostDeprecated and ignored.
version_stringType: string
Mandatory: No
Dynamic: No
Default: None
This parameter sets a custom version string that is sent in the MySQL Handshake from MariaDB MaxScale to clients.
Example:
If not set, MaxScale will attempt to use a version string from the backend databases by selecting the version string of the database with the lowest version number. If the selected version is from the MariaDB 10 series, a 5.5.5- prefix will be added to it similarly to how the MariaDB 10 series versions added it.
If MaxScale has not been able to connect to a single database and the versions are unknown, the default value of 5.5.5-10.4.32 <MaxScale version>-maxscale is used where <MaxScale version> is the version of MaxScale.
auth_all_serversType:
Mandatory: No
Dynamic: Yes
Default: false
This parameter controls whether only a single server or all of the servers are used when loading the users from the backend servers.
By default MaxScale uses the first server labeled as Master as the source of the authentication data. When this option is enabled, the authentication data is loaded from all the servers and combined into one big data set.
Note: This parameter was deprecated in MaxScale 24.02.0 but it was then un-deprecated as there were still uses for it. Modules that required this to function correctly (e.g. schemarouter) now automatically enable it.
strip_db_escType:
Mandatory: No
Dynamic: Yes
Default: true
Note: This parameter has been deprecated in MaxScale 23.08. The stripping of escape characters is in all known cases the correct thing to do.
This setting controls whether escape characters (\) are removed from database names when loading user grants from a backend server. When enabled, a grant such as grant select on` `test\_`.* to 'user'@'%'; is read as grant select on` `test\_`.* to 'user'@'%';
This setting has no effect on database-level grants fetched from a MariaDB Server. The database names of a MariaDB Server are compared using the LIKE operator to properly handle wildcards and escaped wildcards. This setting may affect database names in table and column level grants, although these typically do not contain backlashes.
Some visual database management tools automatically escape some characters and this might cause conflicts when MaxScale tries to authenticate users.
log_auth_warningsType:
Mandatory: No
Dynamic: Yes
Default: true
Enable or disable the logging of authentication failures and warnings. If enabled, messages about failed authentication attempts will be logged with details about who tried to connect to MariaDB MaxScale and from where.
log_warningType:
Mandatory: No
Dynamic: Yes
Default: false
When enabled, this allows a service to log warning messages even if the global log level configuration disables them.
Note that disabling the service level logging does not override the global logging configuration: with log_warning=false in the service and log_warning=true globally, warnings will still be logged for all services.
log_noticeType:
Mandatory: No
Dynamic: Yes
Default: false
When enabled, this allows a service to log notice messages even if the global log level configuration disables them.
log_infoType:
Mandatory: No
Dynamic: Yes
Default: false
When enabled, this allows a service to log info messages even if the global log level configuration disables them.
log_debugType:
Mandatory: No
Dynamic: Yes
Default: false
When enabled, this allows a service to log debug messages even if the global log level configuration disables them.
Debug messages are only enabled for debug builds. Enabling log_debug in a release build does nothing.
wait_timeoutType:
Mandatory: No
Dynamic: Yes
Default: 28800s (>= MaxScale 24.02.5, 25.01.2), 0s (<= MaxScale 24.02.4, 25.01.1)
The wait_timeout parameter is used to disconnect sessions to MariaDB MaxScale that have been idle for too long. The session timeout is set to 28800 seconds by default. A value of zero is interpreted as no timeout.
This parameter used to be called connection_timeout and this name is still accepted as an alias for wait_timeout. The old name has been deprecated in MaxScale 23.08.
The default value of wait_timeout changed from 0s to 28800s in MaxScale versions 24.02.5 and 25.01.2 to match the default value of MariaDB ().
Note that since the granularity of the timeout is seconds, a timeout specified in milliseconds will be rejected, even if the duration is longer than a second.
This parameter only takes effect in top-level services. A top-level service is the service where the listener that the client connected to points (i.e. the value of service in the listener). If a service defines other services in its targets parameter, the wait_timeout for those is not used.
The value of wait_timeout in MaxScale should be lower than the lowest wait_timeout value on the backend servers. This way idle clients are disconnected by MaxScale before the backend servers have to close them. Any client-side idle timeouts (e.g. maximum lifetime for connection pools) should be lower than wait_timeout in both MaxScale and MariaDB. This way the client application will end up closing the connection itself which most of the time results in better and more helpful error messages.
Warning: If a connection is idle for longer than the configured connection timeout, it will be forcefully disconnected and a warning will be logged in the MaxScale log file.
Example:
max_connectionsType: number
Mandatory: No
Dynamic: Yes
Default: 0 in MaxScale, 15 in MaxScale Trial.
The maximum number of simultaneous connections MaxScale should permit to this service. Any attempt to make more connections after the limit is reached will result in a "Too many connections" error being returned.
A value of 0 means no limit, which is the default for MaxScale. MaxScale Trial is limited to a maximum of 15 connections per service.
Warning: In MaxScale 2.5, it is possible that the number of concurrent connections temporarily exceeds the value of max_connections. This has been fixed in MaxScale 6.
Example:
session_track_trx_stateType:
Mandatory: No
Dynamic: Yes
Default: false
Note: This parameter has been deprecated in MaxScale 23.08 as the feature is now used automatically if needed. In addition, the session tracking no longer needs to be enabled in MariaDB for the transaction state tracking to work correctly.
Enable transaction state tracking by offloading it to the backend servers. Getting the transaction state from the server will be more accurate for stored procedures or multi-statement SQL that modifies the transaction state non-atomically.
In general, it is better to avoid using this type of SQL as tracking the transaction state via the server responses is not compatible with features such as transaction_replay in readwritesplit. session_track_trx_state should only be enabled if the default transaction tracking done by MaxScale does not produce the desired outcome.
This is only supported by MariaDB versions 10.3 or newer. The following must be configured in the MariaDB server in order for this feature to work. Not configuring the MariaDB server with it can result in the transaction state being wrong in MaxScale which can result in data inconsistency.
retain_last_statementsType: number
Mandatory: No
Dynamic: Yes
Default: -1
How many statements MaxScale should store for each session of this service. This overrides the value of the global setting with the same name. If retain_last_statements has been specified in the global section of the MaxScale configuration file, then if it has not been explicitly specified for the service, the global value holds, otherwise the service specific value rules. That is, it is possible to enable the setting globally and turn it off for a specific service, or just enable it for specific services.
The value of this parameter can be changed at runtime using maxctrl and the new value will take effect for sessions created thereafter.
connection_keepaliveType:
Mandatory: No
Dynamic: Yes
Default: 300s
Keep idle connections alive by sending pings to backend servers. This feature was introduced in MaxScale 2.5.0 where it was changed from a readwritesplit-specific feature to a generic service feature. The default value for this parameter is 300 seconds. To disable this feature, set the value to 0.
The keepalive interval is specified as documented . If no explicit unit is provided, the value is interpreted as seconds in MaxScale 2.5. In subsequent versions a value without a unit may be rejected. Note that since the granularity of the keepalive is seconds, a keepalive specified in milliseconds will be rejected, even if the duration is longer than a second.
The parameter value is the interval in seconds between each keepalive ping. A keepalive ping will be sent to a backend server if the connection has been idle for longer than the configured keepalive interval.
Starting with MaxScale 2.5.21 and 6.4.0, the keepalive pings are not sent if the client has been idle for longer than the configured value of connection_keepalive. Older versions of MaxScale sent the keepalive pings regardless of the client state.
This parameter only takes effect in top-level services. A top-level service is the service where the listener that the client connected to points (i.e. the value of service in the listener). If a service defines other services in its targets parameter, the connection_keepalive for those is not used.
If the value of connection_keepalive is changed at runtime, the change in the value takes effect immediately.
As the connection keepalive pings must be done only when there's no ongoing query, all requests and responses must be tracked by MaxScale. In the case of readconnroute, this will incur a small drop in performance. For routers that rely on result tracking (e.g. readwritesplit and schemarouter), the performance will be the same with or without connection_keepalive.
If you want to avoid the performance cost and you don't need the connection keepalive feature, you can disable it with connection_keepalive=0s.
force_connection_keepaliveType:
Mandatory No
Dynamic: Yes
Default: false
By default, connection keepalive pings are only sent if the client is either executing a query or has been idle for less than the duration configured in connection_keepalive. When this parameter is enabled, keepalive pings are unconditionally sent to any backends that have been idle for longer than connection_keepalive seconds. This option was added in MaxScale 6.4.9 and can be used to emulate the pre-2.5.21 behavior if long-lived application connections rely on the old unconditional keepalive pings.
Note: if force_connection_keepalive is enabled and connection_keepalive in MaxScale is set to a lower value than the wait_timeout on the database, the client idle timeouts that wait_timeout control are no longer effective. This happens because MaxScale unconditionally sends the pings which make the client behave like it is not idle and thus the connections will never be killed due to wait_timeout.
net_write_timeoutType:
Mandatory No
Dynamic: Yes
Default: 0s
This parameter controls how long a network write can stay buffered. This feature is disabled by default.
When net_write_timeout is configured and data is buffered on a network connection, if the time since the last successful network write exceeds the configured limit, the connection will be disconnected.
In MaxScale 24.08 and older releases, this only affected the client connections. Backend connections were never disconnected even if they had writes buffered for very long times.
max_sescmd_historyType: number
Mandatory: No
Dynamic: Yes
Default: 50
max_sescmd_history sets a limit on how many distinct session commands are stored in the session command history. When the history limit is exceeded, the history is either pruned to the last max_sescmd_history command (when prune_sescmd_history is enabled) or the history is disabled and server reconnections are no longer possible.
The required history size can be estimated by counting the total number of session state modifying commands (e.g SET NAMES) that are used by a client. Note that connectors usually add some commands that aren't visible to the application developer which means a safety margin should be added. A good rule of thumb is to count the expected number of statements and double that number. The default value of 50 is a value that'll work for most applications that do not rely heavily on user variables.
Starting with MaxScale versions 21.06.18, 22.08.15, 23.02.12, 23.08.8, 24.02.4 and 24.08.1, binary protocol prepared statements do not count towards the max_sescmd_history limit. In practice this means that all binary protocol prepared statements opened by the client are also kept open by MaxScale and are restored whenever a reconnection to a server happens. The limits imposed by max_sescmd_history apply to other text protocol commands e.g. SET NAMES. Note that text protocol prepared statements count as text protocol commands and are thus potentially pruned when history pruning happens. If an application uses a lot of PREPARE stmt FROM <sql> commands, it is recommended that the value of max_sescmd_history is increased accordingly.
In older versions of MaxScale, binary protocol prepared statements were limited by max_sescmd_history and were also pruned by prune_sescmd_history but this caused problems when the binary protocol prepared statement were pruned while they were still open from the client's point of view. In older versions, the recommended value of max_sescmd_history is the number of state modifying commands plus the maximum number of open prepared statements that any application may use.
This parameter was moved into the MaxScale core in MaxScale 6.0. The parameter can be configured for all routers that support the session command history. Currently only readwritesplit and schemarouter support it.
In addition to limiting the number of commands to store, it also acts as a hard limit on the number of packets that may be queued up on a backend before it is closed. Packets are queued while the TCP socket is being opened and when prepared statements are being prepared. In certain rare cases, a slow server may fall behind and not catch up to the rest of the cluster and a backlog of packets forms. In these cases, if more than max_sescmd_history packets are queued, the connection to the server is closed.
prune_sescmd_historyType:
Mandatory: No
Dynamic: Yes
Default: true
This option enables pruning of the session command history when it exceeds the value configured in max_sescmd_history. When this option is enabled, only a set number of statements are stored in the history. This limits the per-session memory use while still allowing safe reconnections.
This parameter is intended to be used with pooled connections that remain in use for a very long time. Most connection pool implementations do not reset the session state and instead re-initialize it with new values. This causes the session command history to grow at roughly a constant rate for the lifetime of the pooled connection.
Starting with MaxScale 23.08, the session command history is also simplified before being stored. The simplification is done by removing repeated occurrences of the same command and only executing the latest one of them. The order in which the commands are executed still remains the same but inter-dependencies between commands are not preserved.
For example, the following set of commands demonstrates how the history simplification works and how inter-dependencies can be lost.
In the example, the value of @my_home has a dependency on the value of @my_planet which is lost when the same statement is executed again and the history simplification removes the earlier one.
This same problem can occur even in older versions of MaxScale that used a sliding window of the history when the window moves past the statement that later statement depended on. If inter-dependent session commands are being used, the history pruning should be disabled.
Each client-side session that uses a pooled connection only executes a finite amount of session commands. By retaining a shorter history that encompasses all session commands the individual clients execute, the session state of a pooled connection can be accurately recreated on another server.
When the session command history pruning is enabled, there is a theoretical possibility that upon server reconnection the session states of the connections are inconsistent. This can only happen if the length of the stored history is shorter than the list of relevant statements that affect the session state. In practice the default value of 50 session commands is a fairly reasonable value and the risk of inconsistent session state is relatively low.
In case the default history length is too short for safe pruning, set the value of max_sescmd_history to the total number of commands that affect the session state plus a safety margin of 10. The safety margin reserves some extra space for new commands that might be executed due to changes in the client side application.
Starting with MaxScale 24.02.1, the execution of simple session commands done with binary protocol prepared statements are also stored in the history. A simple session command in the binary protocol is one that:
Takes no parameters
Modifies the session state
Is executed while the original prepared statement is still in the history
The same limitations that apply to the text protocol session commands apply to the binary protocol session commands.
This parameter was moved into the MaxScale core in MaxScale 6.0. The parameter can be configured for all routers that support the session command history. Currently only readwritesplit and schemarouter support it.
disable_sescmd_historyType:
Mandatory: No
Dynamic: Yes
Default: false
This option disables the session command history. This way no history is stored and if a replica server fails, the router will not try to replace the failed replica. Disabling session command history will allow long-lived connections without causing a constant growth in the memory consumption.
This parameter should only be used when either the memory footprint must be as small as possible or when the pruning of the session command history is not acceptable.
This parameter was moved into the MaxScale core in MaxScale 6.0. The parameter can be configured for all routers that support the session command history. Currently only readwritesplit and schemarouter support it.
user_accounts_fileType: path
Mandatory: No
Dynamic: No
Default: ""
Defines path to a file with additional user accounts for incoming clients. Default value is empty, which disables the feature.
In addition to querying the backends, MaxScale can read users from a file. This feature is useful when backends have limitations on the type of users that can be created, or if MaxScale needs to allow users to log in even when backends are down (e.g. binlog router). The users read from the file are only present on MaxScale, so logging into backends can still fail. The format of the file is protocol-specific. The following only applies to MariaDB-protocol, which is also the only protocol supporting this feature.
The file contains json text. Three objects are read from it: user, db and roles_mapping, none of which are mandatory. These objects must be arrays which contain user information similar to the mysql.user, mysql.db and mysql.roles_mapping tables on the server. Each array element must define at least the string fields user and host, which define the user account to add or modify.
The elements in the user-array may contain the following additional fields. If a field is not defined, it is assumed either empty (string) or false (boolean).
password: String. Password hash, similar to the equivalent column on server.
plugin: String. Authentication plugin used by client, similar to server.
authentication_string: String. Additional authentication info, similar to server.
default_role: String. Default role of user, similar to server.
The elements in the db-array must contain the following additional field:
db: String. Database which the user can access. Can contain % and _ wildcards.
The elements in the roles_mapping-array must contain the following additional field:
role: String. Role the user can access.
When users are read from both servers and the file, the server takes priority. That is, if user 'joe'@'%' is defined on both, the file-version is discarded. The file can still affect the database grants and roles of 'joe'@'%', as the db and roles_mapping-arrays are read separately and added to existing grant and role lists.
An example users file is below.
user_accounts_file_usageType:
Mandatory: No
Dynamic: No
Values: add_when_load_ok, file_only_always
Defines when user_accounts_file is read. The value is an enum, either "add_when_load_ok" (default) or "file_only_always".
"add_when_load_ok" means that the file is only read when users are successfully read from a server. The file contents are then added to the server-based data. If reading from server fails (e.g. servers are down), the file is ignored.
"file_only_always" means that users are not read from the servers at all and the file contents is all that matters. The state of the servers is ignored. This mode can be useful with the binlog router, as it allows clients to log in and fetch binary logs from MaxScale even when backend servers are down.
idle_session_pool_timeType:
Mandatory: No
Dynamic: Yes
Default: -1s
Normally, MaxScale only pools backend connections when a session is closed (controlled by server settings persistpoolmax and persistmaxtime). Other sessions can use the pooled connections instead of creating new connections to backends. If connection sharing is enabled, MaxScale can pool backend connections also from running sessions, and re-attach a pooled connection when a session is doing a query. This effectively allows multiple sessions to share backend connections.
idle_session_pool_time defines the amount of time a session must be idle before its backend connections may be pooled. To enable connection sharing, set idle_session_pool_time to zero or greater. The value can be given in seconds or milliseconds.
This feature has a significant drawback: when a backend connection is reused, it needs to be restored to the correct state. This means reauthenticating and replaying session commands. This can add a significant delay before the connection is actually ready for a query. If the session command history size exceeds the value of max_sescmd_history, connection sharing is disabled for the session.
This feature should only be used when limiting the backend connection count is a priority, even at the cost of query delay and throughput. This feature only works when the following server settings are also set in MaxScale configuration:
Since reusing a backend connection is an expensive operation, MaxScale only pools connections when another session requires them. idle_session_pool_time thus effectively limits the frequency at which a connection can be moved from one session to another. Setting idle_session_pool_time=0ms causes MaxScale to move connections as soon as possible.
See below for more information on configuring connection sharing.
Details, limitations and suggestions for connection sharing
As noted above, when a connection is pooled and reused its state is lost. Although session variables and prepared statements are restored by replaying session commands, some state information cannot be transferred.
The most common such state is a transaction. When a transaction is on, connection sharing is disabled for that session until the transaction completes. Other similar situations may not be properly detected, and it's the responsibility of the user to avoid introducing such state to the session when using connection sharing. This means that the following should not be used:
Statements such as LOCK TABLES and GET LOCK or any other statement that introduces state into the connection.
Temporary tables and some problematic user or session variables such as LAST_INSERT_ID(). For LAST_INSERT_ID(), the value returned by the connector must be used instead of the variable.
Stored procedures that cause session level side-effects.
Several settings affect connection sharing and its effectiveness. Reusing a connection is an expensive operation so its frequency should be minimized. The important configuration settings in addition to idle_session_pool_time are MaxScale server settings , and . The service settings , and also have an effect. These settings should be tuned according to the use case.
persistpoolmax limits how many connections can be kept in a pool for a given server. If the pool is full, no more connections are detached from sessions even if they are idle and required. The pool size should be large enough to contain any connections being transferred between sessions, but not be greater than max_routing_connections. Using the value of max_routing_connections is a reasonable starting point.
persistmaxtime limits the time a connection may stay in the pool. This should be high enough so that pooled connections are not unnecessarily closed. Cleaning up clearly unneeded connections from the pool may be useful when max_routing_connections is restrictively tuned. Because each MaxScale routing thread has its own connection pool, one thread can monopolize access to a server. For example, if the pool of thread 1 has 100 connections to ServerA with max_routing_connections=100, other threads can no longer connect to the server. In such a situation, reducing persistmaxtime of ServerA may help as it would cause unneeded connections in the pool to be closed faster. Such connection slots then become available to other routing threads. Reducing the number of may also help, as it reduces pool fragmentation. This may reduce overall throughput, though. When using connection sharing, backend connections are only in the pool momentarily. Consequently, persistmaxtime can be set quite low, e.g. 10s.
If a client session exceeds max_sescmd_history (default 50), pooling is disabled for that session. If many sessions do this and max_routing_connections is set, other sessions will stall as they cannot find a backend connection. This can be avoided with prune_sescmd_history. However, pruning means that old session commands will not be replayed when a pooled connection is reused. If the pruned commands are important (e.g. statement preparations), the session may fail later on.
If the number of clients actively running queries is greater than max_routing_connections, query throughput will suffer as clients will need to take turns. In this situation, it's imperative to minimize the number of backend connections a single session uses. The settings to achieve this depend on the router. For ReadWriteSplit the following should be used:
The above settings mean that MaxScale can process roughly (number of replica servers X max_routing_connections) read queries simultaneously. Write queries will still need to take turns as there is only one primary server.
The following configuration snippet shows example server and service configurations for connection sharing with ReadWriteSplit.
multiplex_timeoutType:
Mandatory: No
Dynamic: Yes
Default: 60s
When connection sharing (as described above) is on, clients may have to wait for their turn to use a backend connection. If too much time passes without a connection becoming available, MaxScale returns an error to the client, usually also ending the session. multiplex_timeout sets this timeout. Increase it if queries are failing with "Timed out when waiting for a connection". Decrease it if failing early is preferable to stalling.
Filters provide a means to manipulate or process requests as they pass through MariaDB MaxScale between the client side protocol and the query router. A full explanation of each filter's functionality can be found in its documentation.
moduleType: filter
Mandatory: Yes
Dynamic: No
The module parameter defines the name of the filter module that is added to the routing chain.
Server sections define the backend database servers MaxScale uses. A server is identified by its section name in the configuration file. The only mandatory parameter of a server is type, but address and port are also usually defined. A server may be a member of one or more services. A server may only be monitored by at most one monitor.
For a complete list of server configuration parameters, see the .
Limitations:
MaxScale: No limitations.
MaxScale Trial: At most 3 servers can be created.
Monitor sections are used to define the monitoring module that watches a set of servers. Each server can only be monitored by one monitor.
Common monitor parameters .
A listener defines a port MaxScale listens on for incoming connections. Accepted connections are linked with a MaxScale service. Multiple listeners can feed the same service. Mandatory parameters are type, service and protocol. address is optional, it limits connections to a certain network interface only. socket is also optional and is used for Unix socket connections.
The network socket where the listener listens may have a backlog of connections. The size of this backlog is controlled by the net.ipv4.tcp_max_syn_backlog and net.core.somaxconn kernel parameters.
Increasing the size of the backlog by modifying the kernel parameters helps with sudden connection spikes and rejected connections. For more information see .
For a complete list of listener configuration parameters, see the .
An include section defined common parameters used in other configuration sections. Consider the following configuration.
The two monitor sections are identical except for the servers setting. If they otherwise should remain identical, a change must be made in two places. With an include section the situation can be simplified.
With an include section, all common settings can be defined in one place, and then included to any number of other sections using the @include parameter.
The @include parameter takes a list of section names, so the settings can be distributed across several include sections.
It is permissible to specify in the including section, parameters that have already been specified in the included section and they will take precedence. For instance, if Monitor2 in the example above should have a longer backend connect timeout it can be specified as follows.
Note that an included section must be an include section and that an include section cannot include another include section. For instance, both of the following sections would cause an error at startup.
Note also that if an included parameter is changed using maxctrl, it will be changed only on the actual object the change is applied on, not on the include section where the parameter is originally specified.
Protocol modules in MaxScale define what kind of clients can connect to a listener and what type of backend servers are supported. Protocol is defined in listener settings, and affects both the listener and any services the listener is linked to.
MariaDB or MariaDBClientImplements MariaDB protocol. The listener will accept MariaDB/MySQL connections from clients and route the client queries through a linked MaxScale service to backend servers. The backends used by the service should be MariaDB servers or compatible.
CDCSee for more information.
nosqlprotocolAccepts MongoDB® connections, yet stores and fetches results to/from MariaDB servers. See for more information.
This section describes TLS/SSL-related configuration parameters for both servers and listeners.
To enable TLS/SSL for a listener or server, set the ssl parameter to true. If the clients expect a specific certificate from MaxScale, set the ssl_cert and ssl_key parameters for the listener. If the certificate is not defined, MaxScale will use an auto-generated self-signed certificate. The generated certificate can pass verification when used with a recent (11.4 or greater) client version.
If the backend database server has certificate verification enabled, configure the ssl_cert and ssl_key parameters of the server.
Custom CA certificates can be defined with the ssl_ca parameter. If ssl_verify_peer_certificate is enabled yet ssl_ca is not set, MaxScale will load CA certificates from the system default location.
After this, MaxScale connections between the server and/or the client will be encrypted. Note that the database must also be configured to use TLS/SSL connections if backend connection encryption is used.
Note: MaxScale does not allow mixed use of TLS/SSL and normal connections on the same port.
If TLS encryption is enabled for a listener, any unencrypted connections to it will be rejected. MaxScale does this to improve security by preventing accidental creation of unencrypted connections.
The separation of secure and insecure connections differs from the MariaDB Server which allows both secure and insecure connections on the same port. As MaxScale is the gateway through which all connections go, MaxScale enforces a stricter security policy than MariaDB Server. Multiple listeners with different configurations can be created to enable different encryption schemes.
TLS encryption must be enabled for listeners when they are created. For servers, the TLS can be enabled after creation but it cannot be disabled or altered.
Starting with MaxScale 2.5.20, if the TLS certificate given to MaxScale has the X509v3 extended key usage information, MaxScale will check it and refuse to use a certificate with the wrong usage. This means that a certificate with only clientAuth can only be used with servers and a certificate with only serverAuth can only be used with listeners. In order to use the same certificate for both listeners and servers, it must have both the clientAuth and serverAuth usages.
sslType:
Mandatory: No
Dynamic: Yes
Default: false
This enables SSL connections when set to true. The legacy values required and disabled were removed in MaxScale 6.0.
Starting with MaxScale 21.06.18, 22.08.15, 23.02.12, 23.08.8, 24.02.4 and 24.08.1, if ssl is disabled for a listener, MariaDB user accounts that require ssl cannot log in through that listener. Any user account with a non-empty ssl_type-field in mysql.user-table is blocked. This includes users created with REQUIRE SSL or REQUIRE X509.
ssl_keyType: path
Mandatory: No
Dynamic: Yes
Default: ""
A string giving a file path that identifies an existing readable file. The file must be the SSL certificate private key MaxScale should use. This is an optional parameter for listeners but an optional parameter for servers.
ssl_passphraseType: string
Mandatory: No
Dynamic: Yes
Default: ""
If the private key specified using requires a password, it should be provided with ssl_passphrase. The setting supports 3 different ways for providing the passphrase, indicated by the used prefix:
env:string: The string is the name of an environment variable specifying the password.
file:string: The string is the path of a file containing the password.
pass:string: The string is the password.
In the case of file, the password is assumed to be the first read line, excluding a trailing line-feed. Any additional data is ignored. A failure to read the line will cause errors to be logged, but will not cause MaxScale to terminate.
It is an error, not to provide a prefix.
Examples:
ssl_certType: path
Mandatory: No
Dynamic: Yes
Default: ""
A string giving a file path that identifies an existing readable file. The file must be the SSL certificate MaxScale should use. The certificate must match the key defined in ssl_key. This is an optional parameter for listeners and servers.
ssl_ca_certDeprecated since MariaDB MaxScale 22.08. See ssl_ca.
ssl_caType: path
Mandatory: No
Dynamic: Yes
Default: ""
A string giving a file path that identifies an existing readable file. The file must be a Certificate Authority (CA) certificate. It will be used to verify that the peer certificate (sent by either client or a MariaDB Server) is valid. The CA certificate can consist of a certificate chain.
NOTE Up until MariaDB MaxScale 6, the parameter was called ssl_ca_cert, which is still accepted as an alias for ssl_ca.
ssl_versionType:
Mandatory: No
Dynamic: No
Values: MAX, TLSv1.0, TLSv1.1
This parameter controls the allowed TLS version. Accepted values are:
TLSv10
TLSv11
TLSv12
TLSv13
MaxScale versions 6.4.16, 22.08.13, 23.02.10, 23.08.6, 24.02.2 and all newer releases accept also the following alias values:
TLSv1.0
TLSv1.1
TLSv1.2
TLSv1.3
The default setting (MAX) allows all supported versions. MaxScale supports TLSv1.0, TLSv1.1, TLSv1.2 and TLSv1.3 depending on the OpenSSL library version. TLSv1.0 and TLSv1.1 are considered deprecated and should not be used, so setting ssl_version=TLSv1.2,TLSv1.3 or ssl_version=TLSv1.3 is recommended.
In MaxScale versions 6.4.13, 22.08.11, 23.02.7, 23.08.3 and earlier, this setting defined the only allowed TLS version, e.g. ssl_version=TLSv12 would only enable TLSv12. The interpretation changed in MaxScale versions 6.4.14, 22.08.12, 23.02.8, 23.08.4 to enable the user to disable old versions while allowing multiple recent TLS versions. In these versions, ssl_version=TLSv1.2 enabled both TLSv1.2 and TLSv1.3.
The interpretation changed again in MaxScale versions 6.4.16, 22.08.13, 23.02.10, 23.08.6, 24.02.2. In these versions the value of ssl_version is an enumeration of accepted TLS protocol versions. This means that admin_ssl_version=TLSv1.2 again only allows TLSv1.2. To retain the behavior from the previous releases where the newer versions were automatically enabled, the protocol versions must be explicitly listed, for example admin_ssl_version=TLSv1.2,TLSv1.3. The change was done to make the ssl_version behave identically to how the MariaDB parameter works.
ssl_cipherType: string
Mandatory: No
Dynamic: Yes
Default: ""
Set the list of TLS ciphers. By default, no explicit ciphers are defined and the system defaults are used. Note that this parameter does not modify TLSv1.3 ciphers.
ssl_cert_verify_depthType: number
Mandatory: No
Dynamic: Yes
Default: 9
The maximum length of the certificate authority chain that will be accepted. The default value is 9, same as the OpenSSL default. The configured value must be larger than 0.
ssl_verify_peer_certificateType:
Mandatory: No
Dynamic: Yes
Default: false
Peer certificate verification. This functionality is disabled by default. In versions prior to 2.3.17 the feature was enabled by default.
When this feature is enabled, the peer (client or MariaDB Server) must send a certificate. The certificate sent by the peer is verified against the configured Certificate Authority to ensure the peer is who they claim to be. For listeners, this behaves as if REQUIRE X509 was defined for all users.
If this feature is enabled for a server yet ssl_ca is not set, MaxScale will attempt to verify the backend server certificate after authentication as explained . This verification method is only supported with MariaDBAuth and Ed25519Auth and requires MariaDB Server version 11.4 or later.
ssl_verify_peer_hostType:
Mandatory No
Dynamic: Yes
Default: false
Peer host verification.
When this feature is enabled, the peer (client or MariaDB Server) hostname or IP is verified against the certificate sent by the peer. If the IP address or the hostname does not match the one in the certificate, the connection is closed.
If the peer does not provide a certificate, host verification is skipped. To require peer certificates, also enable ssl_verify_peer_certificate. For servers, the combination of
behaves like the --ssl-verify-server-cert command line option for the mysql client.
ssl_crlType: path
Mandatory: No
Dynamic: Yes
Default: ""
A string giving a file path that identifies an existing readable file. The file must be a Certificate Revocation List in the PEM format that defines the revoked certificates. This parameter is only accepted by listeners.
Example SSL enabled server configuration
This example configuration requires all connections to this server to be encrypted with SSL. The paths to the certificate files and the Certificate Authority file are also provided.
Example SSL enabled listener configuration
This example configuration requires all connections to be encrypted with SSL. The paths to the certificate files and the Certificate Authority file are also provided.
The main task of MariaDB MaxScale is to accept database connections from client applications and route the connections or the statements sent over those connections to the various services supported by MariaDB MaxScale.
Currently a number of routing modules are available, these are designed for a range of different needs.
Connection based load balancing:
Read/Write aware statement based router:
Simple sharding on database level:
Binary log server:
Monitor modules are used by MariaDB MaxScale to internally monitor the state of the backend databases in order to set the server flags for each of those servers. The router modules then use these flags to determine if the particular server is a suitable destination for routing connections for particular query classifications. The monitors are run within separate threads of MariaDB MaxScale and do not affect MariaDB MaxScale's routing performance.
The use of monitors in MaxScale is not absolutely mandatory: it is possible to run MariaDB MaxScale without a monitor module. In this case an external monitoring system must the status of each server via MaxCtrl or the REST API. Only do this if you know what you are doing.
Filters provide a means to manipulate or process requests as they pass through MariaDB MaxScale between the client side protocol and the query router. A full explanation of each filter's functionality can be found in its documentation.
The document shows how you can add a filter to a service and combine multiple filters in one service.
Passwords stored in the maxscale.cnf file may optionally be encrypted for added security. This is done by creation of an encryption key on installation of MariaDB MaxScale. Encryption keys may be created manually by executing the maxkeys utility with the argument of the filename to store the key. The default location MariaDB MaxScale stores the keys is /var/lib/maxscale. The passwords are encrypted using 256-bit AES CBC encryption.
Changing the encryption key for MariaDB MaxScale will invalidate any currently encrypted keys stored in the maxscale.cnf file.
Note: The password encryption format changed in MaxScale 2.5. All encrypted passwords created with MaxScale 2.4 or older need to be re-encrypted.
Encrypted passwords are created by executing the maxpasswd command with the location of the .secrets file and the password you require to encrypt as an argument.
The output of the maxpasswd command is a hexadecimal string, this should be inserted into the maxscale.cnf file in place of the ordinary, plain text, password. MariaDB MaxScale will determine this as an encrypted password and automatically decrypt it before sending it the database server.
The and documents provide information about making runtime changes.
All changes to the configuration done via MaxCtrl are persisted as individual configuration files in /var/lib/maxscale/maxscale.cnf.d/. The content of these files will override any configurations found in the main configuration file or any auxiliary configuration files.
Refer to the section for more details on how this mechanism works and how to disable it.
The configuration synchronization mechanism is intended for synchronizing configuration changes done on one MaxScale to all other MaxScales. This is done by propagating the changes via the database cluster used by Maxscale.
When configuring configuration synchronization for the first time, the same static configuration files should be used on all MaxScale instances that use the same cluster: the value of config_sync_cluster must be the same on all MaxScale instances and the cluster (i.e. the monitor) pointed by it and its servers must be the same in every configuration.
Whenever the MaxScale configuration is modified at runtime, the latest configuration is stored in the database cluster in the mysql.maxscale_config table. The table is created when the first modification to the configuration is done. A local copy of the configuration is stored in the data directory to allow MaxScale to function even if a connection to the cluster cannot be made. By default this file is stored at /var/lib/maxscale/maxscale-config.json.
Whenever MaxScale starts up, it checks if a local version of this configuration exists. If it does and it is a valid cached configuration, the static configuration file as well as any other generated configuration files are ignored. The exception is the [maxscale] section of the main static configuration file which is always read.
Each configuration has a version number with the initial configuration being version 0. Each time the configuration is modified, the version number is incremented. This version number is used to detect when MaxScale needs to update its configuration.
When doing a configuration change on the local MaxScale, if the configuration change completes on MaxScale but fails to be committed to the database, MaxScale will attempt to revert the local configuration change. If this attempt fails, MaxScale will discard the cached configuration and abort the process.
When synchronizing with the cluster, if MaxScale fails to apply a configuration retrieved from the cluster, it attempts to revert the configuration to the previous version. If successful, the failed configuration update is ignored. If the configuration update that fails cannot be reverted, the MaxScale configuration will be in an indeterminate state. When this happens, MaxScale will discard the cached configuration and abort the process.
When loading a locally cached configuration during startup, if any errors are found in the cached configuration, it is discarded and the MaxScale process will attempt to restart by exiting with code 75 from the main process. If MaxScale is being used as a SystemD service, this will automatically trigger a restart of MaxScale and no further actions are needed.
The most common reason for a failed configuration update is missing files. For example, if a configuration update adds encrypted connections to a server and the TLS certificates it uses were not copied over to all MaxScale nodes before the change was done, the operation will fail on all nodes that do not have these files.
If the synchronization of the configuration change fails at the step when the database transaction is being committed, the new configuration can be momentarily visible to the local MaxScale. This means the changes are not guaranteed to be atomic on the local MaxScale but are atomic from the cluster's point of view.
Starting with MaxScale 6.4.9, any passwords that are transmitted by the configuration synchronization are encrypted if password encryption has been enabled in MaxScale. This means that all MaxScale nodes in the same configuration cluster must be configured to use password encryption and they need to all use the same encryption keys that were created with maxkeys.
The output of maxctrl show maxscale contains the Config Sync field with information about the current configuration state of the local Maxscale as well as the state of any other nodes using this cluster.
The version field is the logical configuration version and the origin is the node that originates the latest configuration change. The checksum field is the checksum of the logical configuration and can be used to compare whether two Maxscale instances are in the same configuration state. The nodes field contains the status of each MaxScale instance mapped to the hostname of the server. This field is updated whenever MaxScale reads the configuration from the cluster and can thus be used to detect which MaxScales have updated their configuration.
The mysql.maxscale_config table where the configuration changes are stored must not be modified manually. The only case when the table should be modified is when resetting the configuration synchronization.
To reset the configuration synchronization:
Stop all MaxScale instances
Remove the cached configuration file stored at /var/lib/maxscale/maxscale-config.json on all MaxScale instances
Drop the mysql.maxscale_config table
Start all MaxScale instances
To disable configuration synchronization, remove config_sync_cluster from the configuration file or set it to an empty string: config_sync_cluster="". This can be done at runtime with MaxCtrl by passing an empty string to config_sync_cluster:
If MaxScale cannot create a connection to the database cluster, configuration changes are not possible until communication with the database is possible. To override this behavior and force the changes to be done, use the --skip-sync option for maxctrl or the sync=false HTTP parameter for the REST API. Any updates done with --skip-sync will overwritten by changes coming from the cluster.
Only the MaxScale configuration is synchronized. Any external files (TLS certificates, configuration files for modules or data generated by MaxScale) are not synchronized. For example, the rule files for the cache filter must be synchronized separately if the filter itself is modified.
Starting with MaxScale 22.08, the Maintenance and Draining states of servers and modifications to the administrative users will be synchronized. In older versions servers had to be put into maintenance mode and users had to be modified separately on each MaxScale.
() External files are not synchronized.
() The --export-config option will not export the cluster configuration and instead exports only the static configuration files. To start a new MaxScale based off of a clustered configuration, copy the static configuration files as well as the JSON configuration in /var/lib/maxscale/maxscale-config.json to the new MaxScale instance.
The combination of configuration files can be done either manually (e.g. rsync) or with the maxscale --export-config=FILE command line option. See maxscale --help for more information about how to use the --export-config flag.
For example, to export the current runtime configuration, run the following command.
This will create the /tmp/maxscale.cnf.combined file and write the current configuration into the it. This allows new MaxScale instances to be easily set up without requiring copying of all runtime configuration files. The user executing the command must be able to read all MaxScale configuration files as well as create and write the provided filename.
The encryption key managers are how MaxScale retrieves symmetric encryption keys from a key management system. Some parts of MaxScale require the key_manager to be configured in order to work. The key manager that is used is selected with the parameter and the key manager itself is configured by placing the parameters in the [maxscale] section.
The encryption key managers can be enabled at runtime using maxctrl alter maxscale but cannot be disabled once enabled. To disable the encryption key management, stop Maxscale, remove any persisted configuration files and remove key_manager as well as any key manager options from the static configuration files.
The encryption keys are stored in a text file stored on a local filesystem.
The file uses the same format as the MariaDB server : a file consisting of an encryption key ID number and the hex-encoded encryption key separated by a semicolon. Read for more details on how to create the file.
For example, to configure encryption for the nosqlprotocol shared credentials using the file-based encryption key:
Create the key file with (echo -n '1;' ; openssl rand -hex 32) | cat > /var/lib/maxscale/encryption.key
Give MaxScale read permissions on it with chown maxscale:maxscale /var/lib/maxscale/encryption.key
Configure MaxScale with the following:
Start MaxScale
Key versioning is not supported
file.keyfile
Type: path
Mandatory: Yes
Dynamic: Yes
Path to the file that contains the encryption keys. The user MaxScale runs as (almost always maxscale) must be able to read this file. Encryption keys are read from disk only during startup or when any global MaxScale parameter is modified at runtime.
Encryption keys are read from a KMIP server.
The KMIP key manager has been verified to work with the PyKMIP server.
Key versioning is not supported
Encryption keys are not cached locally: whenever MaxScale needs an encryption key, it retrieves it from the KMIP server.
kmip.host
Type: string
Mandatory: Yes
Dynamic: Yes
The host where the KMIP server is.
kmip.port
Type: integer
Mandatory: Yes
Dynamic: Yes
The port on which the KMIP server listens on.
kmip.cert
Type: path
Mandatory: Yes
Dynamic: Yes
The client public certificate used when connecting to the KMIP server.
kmip.key
Type: path
Mandatory: Yes
Dynamic: Yes
The client private key used when connecting to the KMIP server.
kmip.ca
Type: path
Default: ""
Dynamic: Yes
The CA certificate to use. By default the system default certificates are used.
Encryption keys are read from a local or remote Vault server using the secret engine included in the Vault. This key manager supports versioned keys. Only version 2 key-value stores are supported.
The encryption keys use the same format as the MariaDB The key-value secret for each encryption key ID must contain the field data which must contain a hex-encoded string that is either 32, 48 or 64 characters long.
An easy way to generate a correct encryption key is to use the vault and openssl command line clients. The following command creates a 256-bit encryption key using openssl and stores it using the key ID 1:
Encryption keys are not cached locally: whenever MaxScale needs an encryption key, it retrieves it from the Vault server.
vault.token
Type: password
Mandatory: Yes
Dynamic: Yes
The authentication token used to connect to the Vault server. This can be encrypted using maxpasswd, similar to how other passwords are encrypted.
vault.host
Type: string
Default: localhost
Dynamic: Yes
The host where the Vault server is.
vault.port
Type: integer
Default: 8200
Dynamic: Yes
The port on which the Vault server listens on.
vault.ca
Type: path
Default: ""
Dynamic: Yes
The CA certificate to use. By default the system default certificates are used.
vault.tls
Type:
Default: true
Dynamic: Yes
Whether to use encrypted connections (i.e. HTTPS or HTTP) when communicating with the Vault server.
vault.mount
Type: string
Default: secret
Dynamic: Yes
The Key-Value mount where the secret is stored. By default the secret mount is used which is present by default in most Vault installations.
vault.timeout
Type:
Default: 30s
Dynamic: Yes
The connection and request timeout used with the Vault server.
For routing, MaxScale uses asynchronous I/O and a fixed number of threads (aka routing workers), whose number up until 23.02 was fixed at startup. From 23.02 onwards the number of threads can be altered at runtime, which is convenient, for instance, if MaxScale is running in a container whose properties are changed during the lifetime of the container.
A thread can be in three different states:
Active: The thread is routing client traffic and is listening for new connections.
Draining: The thread is routing client traffic but is not listening for new connections.
Dormant: The thread is not routing client traffic (all sessions have ended), and is not listening for new connections, and is waiting to be terminated.
All threads start as Active and may become Draining if the number of threads is reduced. A draining thread will eventually become Dormant, unless the number of threads is increased while the thread is still Draining.
Note that it is not possible to terminate a specific thread, but it is only possible to specify the number of threads that MaxScale should use, and that the threads will be terminated from the end. This has implications if the number of threads is reduced by more than 1, as a Dormant thread will not be terminated before it is the last thread.
In the following, MaxScale has been started with threads=4.
All threads are Active. If we now decrease the number of threads
we will see that the threads 2 and 3 are now Draining. The reason is that threads 2 and 3 still handle client sessions. If some client sessions now end, the situation may become like
That is, thread 2 is Dormant and thread 3 is Draining. All client sessions that were handled by thread 2 have ended and the thread is ready to be terminated. However, as thread 3 is still Draining, thread 2 will not be terminated but stay Dormant.
If the sessions handled by thread 3 end, then it will become Dormant at which point first thread 3 will be terminated and immediately after that thread 2.
If the situation is like
that is, the number of threads was 4 but has been reduced to 2, and while thread 2 has become drained it stays as Dormant since thread 3 is still Draining, it is possible to make thread 2 Active again by increasing the number of threads to 3.
Once the sessions of thread 3 ends, we will have
MariaDB MaxScale is designed to be executed as a service, therefore all error reports, including configuration errors, are written to the MariaDB MaxScale error log file. By default, MariaDB MaxScale will log to a file in /var/log/maxscale and the system log.
The current limitations of MaxScale are listed in the document.
Tune query_classifier_cache_size to allow maximal use of the query classifier cache. Increase the value and/or system memory until the set of unique SQL patterns fits into memory. By default at most 15% of the system memory is used for this cache. To detect if the SQL statements fit into memory, monitor the QC cache evictions value in maxctrl show threads to see how many evictions take place. If it keeps increasing, increase the size of the query classifier cache. Using the query classifier cache with a CPU bound workload gives a roughly 20% improvement in performance compared to when it is turned off.
A faster CPU with more CPU cores is better. This is true for most applications but especially for MaxScale as it is mostly limited by the speed of the CPU. Using threads=auto is recommended (the default starting with MaxScale 6).
From 22.08.2 onwards, maxctrl show maxscale shows a System object with information about the system MaxScale is running on. The fields are:
In addition there is an os object that contains what the Linux command uname displays.
threads
If threads has not been specified at all in the MaxScale configuration file, or if its value is auto, then MaxScale will use as many routing threads as there are physical cores on the machine. This is the right choice, if MaxScale is running on a dedicated machine or in a container that has not been restricted in any way.
However, if the number of cores available to MaxScale have been restricted or if MaxScale is running in a container whose CPU quota and period have been limited, then it will lead to MaxScale using more routing threads than what is appropriate in the environment where it is running.
If machine.cores_virtual is less than machine.cores_physical, then threads should be specified explicitly in the MaxScale configuration file and its value should be that of machine.cores_virtual rounded up to the nearest integer. If that value is 1 it may be beneficial to check whether 2 gives better performance.
query_classifier_cache_size
If query_classifier_cache_size has not been specified in the MaxScale configuration file, then MaxScale will use at most 15% of the amount of physical memory in the machine for the cache. This is a good starting point, if MaxScale is running on a dedicated machine or in a container that has not been restricted in any way. Note that the amount specifies how much memory the cache at maximum is allowed to use, not what would immediately be allocated for the cache.
However, if the amount of memory available to MaxScale has been restricted, which may be the case if MaxScale is running in a container, this may cause the cache to grow beyond what is available, which will lead to a crash or MaxScale being killed.
If the value of machine.memory_available is less than that of machine.memory_physical, then query_classifier_cache_size should be explicitly set to 15% of maxscale.memory_available. The value can be larger, but must not be a bigger share of machine.memory_available than what is reasonable.
As can be seen, maxscale.threads is larger than machine.cores_virtual and thus, threads=4 should explicitly be specified in the MaxScale configuration file.
maxscale.query_classifier_cache_size is the default 15% of machine.memory_physical but as machine.memory_available is just half of that, something like query_classifier_cache_size=3100000000 (~15% of machine.memory_available) should be added to the configuration file.
For a list of common problems and their solutions, read the article on the MariaDB documentation.
If MaxScale is running as a systemd service, the systemd Watchdog will be enabled by default. To configure it, change the WatchdogSec option in the Service section of the maxscale systemd configuration file located in /lib/systemd/system/maxscale.service:
It is not recommended to use a watchdog timeout less than 30 seconds. When enabled MaxScale will check that all threads are running and notify systemd with a "keep-alive ping".
Systemd reference:
This page is licensed: CC BY-SA / Gnu FDL
Maintenance
The server is under maintenance. Typically this status bit is turned on manually using maxctrl, but it will also be turned on for a server that for some reason is blocking connections from MaxScale. When a server is in maintenance mode, no connections will be created to it and existing connections will be closed.
Slave of External Master
The server is a replica of a primary that is not being monitored.
Master Stickiness
The server is monitored by a galeramon with disable_master_failback=true. See for more information.
admin_pam_readonly_service
admin_pam_readwrite_service
admin_readonly_hosts
admin_readwrite_hosts
admin_port
admin_secure_gui
admin_ssl_ca
admin_ssl_version
admin_jwt_algorithm
admin_jwt_key
admin_jwt_issuer
auto_tune
connector_plugindir
core_file
datadir
debug
libdir
load_persisted_configs
persist_runtime_changes
local_address
log_augmentation
log_warn_super_user
logdir
module_configdir
persistdir
piddir
query_retries
require_secure_transport
secretsdir
sharedir
sql_mode
substitute_variables
threads_max
case: Turns on case-sensitive matching. This means that /SELECT/ will not match select.
Dynamic: No
Default: default
Default: never
TLSv1.2TLSv1.3TLSv10TLSv11TLSv12TLSv13Default: MAX
MAX
HS512RS256RS384RS512PS256PS384PS512ES256ES384ES512ED25519ED448Default: auto
HS256HS256, HS384 or HS512
HMAC with SHA-2 Functions. If admin_jwt_key is not defined, uses a random encryption key of the correct size.
RS256, RS384 or RS512
Digital Signature with RSASSA-PKCS1-v1_5. Requires at least a 2048-bit RSA key.
PS256, PS384 or PS512
Digital Signature with RSASSA-PSS. Requires at least a 2048-bit RSA key.
ES256, ES384 or ES512
Digital Signature with ECDSA. Requires an EC key with the correct curve: P-256 for ES256, P-384 for ES384 and P-512 for ES512.
ED25519 or ED448
Edwards-curve Digital Signature Algorithm (EdDSA). Requires a Ed25519 key for ED25519 or a Ed448 key for ED448.
Default: auto
PATCHDELETEHEADOPTIONSCONNECTTRACEDefault: No exclusions
Default: none
vault - HashiCorp Vault key manager. This key manager is only included on systems with GCC 9 or newer which means it cannot be used on Ubuntu 18.04.Implicitly created filters otherwise behave similarly to normal filters that are defined in the configuration file. If an implicitly created filter is destroyed, it will be created again the next time a service uses it.
Auto tune: Yes
Maximum: Unlimited in MaxScale, 15 in MaxScale Trial.
Auto tune: Yes
super_priv: Boolean. True if user has SUPER grant.
global_db_priv: Boolean. True if user can access any database on login.
proxy_priv: Boolean. True if user has a PROXY grant.
is_role: Boolean. True if user is a role.
Default: add_when_load_ok
TLSv1.2TLSv1.3TLSv10TLSv11TLSv12TLSv13Default: MAX
MAX
Network throughput between the client, MaxScale and the database nodes governs how much traffic can be handled. The client-to-MaxScale network is likely to be saturated first: having multiple MaxScales in front of the cluster is an easy way of solving this problem.
Certain MaxScale modules store data on disk. A faster disk improves their performance but depending on the module, this might not be a big enough of a problem to worry about. Filters like the qlafilter that write information to disk for every SQL query can cause performance bottlenecks.
The number of routing threads used by MaxScale.
connection routing
Connection routing is a method of handling requests in which MariaDB MaxScale will accept connections from a client and route data on that connection to a single database using a single connection. Connection based routing will not examine individual requests on a connection and it will not move that connection once it is established.
statement routing
Statement routing is a method of handling requests in which each request within a connection will be handled individually. Requests may be sent to one or more servers and connections may be dynamically added or removed from the session.
module
A module is a separate code entity that may be loaded dynamically into MariaDB MaxScale to increase the available functionality. Modules are implemented as run-time loadable shared objects.
connection failover
When a connection currently being used between MariaDB MaxScale and the database server fails a replacement will be automatically created to another server by MariaDB MaxScale without client intervention
backend database
A term used to refer to a database that sits behind MariaDB MaxScale and is accessed by applications via MariaDB MaxScale.
REST API
HTTP administrative interface
Running
The server is running.
Master
The server is the primary.
Slave
The server is a replica.
Draining
The server is being drained. Existing connections can continue to be used, but no new connections will be created to the server. Typically this status bit is turned on manually using maxctrl, but a monitor may also turn it on.
Drained
The server has been drained. The server was being drained and now the number of connections to the server has dropped to 0.
Auth Error
The monitor cannot login and query the server due to insufficient privileges.
80% of the smallest value of the servers used by the service
The smallest wait_timeout value of the servers used by the service
QC cache size
The current size of the cache (bytes).
QC cache inserts
How many entries have been inserted into the cache.
QC cache hits
How many times the classification result has been found from the cache.
QC cache misses
How many times the classification result has not been found from the cache, but the classification had to be performed.
QC cache evictions
How many times a cache entry has had to be removed from the cache, in order to make place for another.
machine.cores_physical
The number of physical CPU cores on the machine.
machine.cores_available
The number of CPU cores available to MaxScale. This number may be smaller than machine.cores_physical, if CPU affinities are used and only a subset of the physical cores are available to MaxScale.
machine.cores_virtual
The number of virtual CPU cores available to MaxScale. This number may be a decimal and smaller than machine.cores_available, if MaxScale is running in a container whose CPU quota and period has been restricted. Note that if MaxScale is not, or fails to detect it is running in a container, the value shown will be identical with machine.cores_available.
machine.memory_physical
The amount of physical memory on the machine.
machine.memory_available
The amount of memory available to MaxScale. This number may be smaller than machine.memory_physical, if MaxScale is running in a container whose memory has been restricted. Note that if MaxScale is not, or fails to detect it is running in a container, the value shown will be identical with machine.memory_physical. Note also that the amount is available to all processes running in the same container, not just to MaxScale.
maxscale.query_classifier_cache_size
The maximum size of the MaxScale query classifier cache.

maxscale.threads
# 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=20dump_last_statements=on_errorsession_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
WEBINAR
New innovations in MaxScale 25.01 and Enterprise Platform