Centralize your database proxy administration. This guide outlines tools and procedures for deploying, configuring, and maintaining MariaDB MaxScale instances.
Deployment
Access essential guides for deploying MariaDB MaxScale including installation, configuration, upgrades, and using the MaxGUI browser-based interface for management and monitoring.
Installation & Configuration
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.
MaxScale Installation Guide
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.
MariaDB MaxScale Installation Guide
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.
Install MariaDB MaxScale From MariaDB Repositories
The recommended approach is to use the MariaDB package repository 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.
Install MariaDB MaxScale From a RPM/DEB Package
Download the correct MaxScale package for your CPU architecture and operating system from the MariaDB Downloads page. 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.
Install MariaDB MaxScale Using a Tarball
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 Install MariaDB MaxScale using a Tarball.
Building MariaDB MaxScale From Source Code
Alternatively, you may download the MariaDB MaxScale source and build your own binaries. To do this, refer to the separate document Building MariaDB MaxScale from Source Code.
Assumptions
Memory allocation behavior
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 vm.overcommit_memory 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:
sysctl vm.overcommit_memory
Alternatively, use this command:
cat /proc/sys/vm/overcommit_memory
Configuring MariaDB MaxScale
The MaxScale Tutorial 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 Configuration Guide and the module specific documents found in the reference.
Encrypting Passwords
Read the Encrypting Passwords section of the configuration guide to set up password encryption for the configuration file.
Administration Of MariaDB MaxScale
There are various administration tasks that may be done with MariaDB MaxScale. A command line tools is available, maxctrl, 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 administration tutorial covers the common administration tasks that need to be done with MariaDB MaxScale.
Copying or Backing Up 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:
tar -caf maxscale-backup.tar.gz /etc/maxscale.cnf /etc/maxscale.cnf.d/ /var/lib/maxscale/
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
Building MaxScale From Source
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.
Building MariaDB MaxScale from Source Code
MariaDB MaxScale can be built on any system that meets the requirements. The main requirements are as follows:
CMake version 3.16 or later (Packaging requires CMake 3.25.1 or later)
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.
Quickstart
This installs MaxScale as if it was installed from a package. Install git before running the following commands.
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 ./postinst
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).
Argument Name
Explanation
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
Note: You can look into defaults.cmake for a list of the CMake variables.
Running unit tests
To run the MaxScale unit test suite, configure the build with -DBUILD_TESTS=Y, compile and then run the make test command.
Building MariaDB MaxScale packages
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.
make
LD_LIBRARY_PATH=$PWD/server/core/ make package
Installing optional components
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
Installing MaxScale Using a Tarball
Install MariaDB MaxScale manually using generic tarball binaries. Learn the system requirements, directory setup, and configuration steps to run MaxScale without a package manager.
Installing MariaDB MaxScale using a tarball
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
libatomic
unixODBC
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.
Installing as root in /usr/local
If 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:
$ 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
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:
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 Configuration Guide for details.
When the configuration file has been created, MariaDB MaxScale can be started.
$ sudo bin/maxscale --user=maxscale -d
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.
Installing in any Directory
Enter a directory where you have the right to create a subdirectory. Then do as follows.
$ tar -xzvf maxscale-x.y.z.OS.tar.gz
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 Configuration Guide for details.
When the configuration file has been created, MariaDB MaxScale can be started.
$ cd maxscale-x.y.z.OS
$ bin/maxscale -d --basedir=.
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
$ bin/maxscale --help
to find out the appropriate flags.
This page is licensed: CC BY-SA / Gnu FDL
MaxCtrl
Manage your MariaDB MaxScale instance using MaxCtrl, a command-line utility for the REST API. Monitor status, configure services, and handle administrative tasks efficiently.
MaxGUI
Manage MariaDB MaxScale visually with MaxGUI. This browser-based dashboard simplifies configuration, monitoring, and administration tasks for your database proxy instances.
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
Configuring MaxScale's REST API
Enable remote management by configuring the MaxScale REST API. Learn to set listening ports, bind addresses, and secure administrative traffic with TLS.
Overview
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.
Configuring MaxScale's REST API for Remote Connections
for remote connections by configuring several global parameters in maxscale.cnf.
Compare the available tools for managing MaxScale. Understand the differences between the MaxCtrl command-line utility, the MaxGUI web interface, and the REST API.
Overview
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.
Tools Supported by MaxScale
MaxScale supports different administrative interfaces for different kinds of environments and preferences:
Deleting a REST API User for MaxScale with MaxCtrl
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.
Overview
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.
Deleting a User
if the default configuration is not sufficient.
Use MaxCtrl to execute the command:
Replace admin with the actual user.
MaxScale will refuse to delete the last remaining admin user.
Setting a Server to Maintenance Mode in MaxScale with MaxCtrl
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.
Overview
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.
Setting 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.
Forcing a Server to Maintenance Mode
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 guide explains how to deploy MariaDB MaxScale using the official Docker image available via the MariaDB Enterprise Registry. MaxScale is a database proxy that offers load balancing, high availability, and security between MariaDB database servers and your applications.
MaxScale MaxGUI Guide
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.
MariaDB MaxScale MaxGUI Guide
Introduction
MaxScale 25.01 Limitations and Known Issues within MariaDB MaxScale
Review the current constraints of MariaDB MaxScale. This document lists known issues regarding transaction parsing, protocol support, and specific module limitations.
Limitations and Known Issues within MariaDB MaxScale
This document lists known issues and limitations in MariaDB MaxScale and its plugins. Since limitations are related to specific plugins, this document is divided into several sections.
Connecting to MaxScale using TLS with MaxCtrl
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.
Overview
_MaxCtrl is a command-line utility that can perform administrative tasks using . It is possible to connect to MaxScale using TLS with MaxCtrl.
Creating a REST API User for MaxScale with MaxCtrl
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.
Overview
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.
Removing a Server using MaxCtrl
When operating MariaDB MaxScale in dynamic environments—such as Kubernetes, where nodes are frequently provisioned and deleted—it is critical to cleanly remove decommissioned servers from your MaxScale configuration. To delete a server using maxctrl, one has to unlink the server from any services or monitors beforehand. This step-by-step guide walks you through the safe removal process, following the recommended teardown sequence: Listener ➔ Service ➔ Monitor ➔ Server.
Fast Track - Force Server Removal
While we may remove a server with the --force
Configuring MaxScale for MaxGUI
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.
Overview
MaxGUI is a graphical utility that can perform administrative tasks using . It is available starting in MaxScale 2.5. It supports many different operations.
MaxGUI is not available out-of-the box. MaxScale requires some configuration before MaxGUI can be used.
Setting a Server to Maintenance Mode in MaxScale with MaxGUI
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.
Overview
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
MaxGUI is a browser-based interface for MaxScale REST-API and query execution.
Enabling MaxGUI
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/
Securing the GUI
To make MaxGUI secure, set admin_secure_gui=true and configure both theadmin_ssl_key and admin_ssl_cert parameters.
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.
Pages
Dashboard
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.
Detail
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
Visualization
This page visualizes MaxScale configuration and clusters.
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.
Settings
This page shows and allows editing of MaxScale parameters.
Access this page by clicking the gear icon on the sidebar navigation.
Logs Archive
Realtime MaxScale logs can be accessed by clicking the logs icon on the sidebar navigation.
Workspace
The "Workspace" page offers a versatile set of tools for effectively managing data and database interactions. It includes the following key tasks:
1. Run Queries
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.
2. Data Migration
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.
3. Create an ERD
Generating Entity-Relationship Diagrams (ERDs) to gain insights regarding data structure, optimizing database design for both efficiency and clarity.
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.
Multiple MaxScales on same server
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.
Security limitations
MariaDB 10.2
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.
MariaDB Default Values
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.
Query Classification
Transaction Boundary Detection
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.
XA Transactions
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.
Prepared Statements
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.
Protocol limitations
Limitations with MySQL/MariaDB Protocol support (MariaDBClient)
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.
Authenticator limitations
Limitations in the MySQL authenticator (MariaDBAuth)
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.
Filter limitations
Tee filter limitations (tee)
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.
Monitor limitations
A server can only be monitored by one monitor. Two or more monitors monitoring the same server is considered an error.
Limitations with Galera Cluster Monitoring (galeramon)
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.
Router limitations
Refer to individual router documentation for a list of their limitations.
ETL 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.
ETL Limitations with PostgreSQL as the Source
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.
Limitations in Automatic SQL Generation
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.
ETL Limitations with Generic ODBC Targets
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
User Types
There are two types of users:
User Type
Description
Basic
The user has read-only access
Admin
The user can change global MaxScale parameters and reconfigure modules.
Creating a Basic User
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.
Creating an Admin User
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.
Before deploying MaxScale with Docker, ensure the following requirements are met:
Docker installed and running on your system
A MariaDB Enterprise subscription
Your MariaDB Enterprise token and account credentials
Authenticate to the MariaDB Enterprise Registry
MariaDB Docker images are stored in the private MariaDB Enterprise Docker Registry. To retrieve MaxScale Docker images, you must first authenticate with the MariaDB Enterprise Registry using the Customer Download Token.
Copy the token to use for authentication when logging in to Docker.
As a best practice, ensure that your token is stored securely.
Log in to Docker Registry
For authentication, use your Customer Download Token to the MariaDB Enterprise Registry:
Replace:
<ENTERPRISE_TOKEN> with your Customer Download Token.
<your-mariadb.id-email> with the email associated with your MariaDB account.
Available Image Tags
The following tags are available for MaxScale Docker image:
Tag
Description
latest
Latest stable MaxScale release
25.01
MaxScale 25.01.x series
25.01.1
MaxScale version 25.01.1
Select the appropriate Docker image tag from the maxscale repository.
Pull the MaxScale Image
Pull the latest MaxScale image using docker pull:
Or pull a specific version:
Run MaxScale in a Container
Basic Example
The default setup of MaxScale, which just activates the REST API, is used by this command:
Quick Start Example
For a quick start that includes database proxy port access:
Configure MaxScale
MaxScale must be configured to define backend servers, monitoring, routing services, and listeners. For production deployments, you can either use the default basic configuration or provide a custom configuration file.
Default Configuration
The REST API, which listens on port 8989, is the only feature enabled by the container's minimum default configuration. The default login credentials are:
Username: admin
Password: mariadb
Basic Container Setup
Run MaxScale with default configuration using docker run:
Parameters:
-d: Run container in detached mode
--name mxs: Container name "mxs"
-p 3306:3306: Map database proxy port
-p 8989:8989: Map REST API port
After launching the container, test the REST API using curl:
Using a Custom Configuration File
Before starting the container:
Create a directory on your system to store the configuration file.
Place your-maxscale.cnf file in this directory.
The container will mount this directory in order to enable persistent configuration.
Create a custom MaxScale configuration file and mount it into the container:
Overriding the Default Configuration
If you need to modify the maxscale section, override the main configuration file:
Access the Container
To access the running the container's shell:
Verify MaxScale is Running
After starting the container, verify that MaxScale is running correctly. Check the container status by executing the below command:
Managing the Container
Stop the Container
To stop the running container, use:
Remove the Container
Delete the container after use with the following command:
method, please use this approach with caution. If you are scripting this for Kubernetes or need to quickly remove a node, you can bypass the manual unlinking steps by using the
--force
option.
The --force option will automatically remove the server from monitors and services before destroying it.
Bypassing the manual unlinking steps may abruptly terminate active database sessions. Only use this if traffic has already been safely drained from the node at the orchestration layer.
1
Destroy the Listener (If Applicable)
If your setup utilizes a dedicated listener that must be removed alongside the server, you must destroy the listener first.
Destroying a listener closes the listening socket, opening it up for immediate reuse.
If two arguments are given and they are a service and a listener, the listener is only destroyed if it is for the given service.
2
Unlink the Server from the Service
Next, the server object for the node must be unlinked from the service.
This command unlinks targets from a service, removing them from the list of available targets for that service.
3
Unlink the Server from the Monitor
The server object for the node must now be unlinked from its health monitor.
This command unlinks servers from a monitor, removing them from the list of monitored servers.
4
Destroy the Server in MaxScale
Finally, the server object for the node must be removed from MaxScale.
The server must be unlinked from all services and monitor before it can be destroyed.
Visit MaxGUI in your web browser. For example, if you are accessing it from local host with the default port, then visit this address: 127.0.0.1:8989
Enter your username and password to log in.
On the dashboard, the "Servers" tab is shown by default.
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 wrench icon. This will open a popup window.
Click the "Set" button. If the specified server is a primary server, then MaxScale will allow open transactions to complete before closing any connections.
Visit MaxGUI in your web browser. For example, if you are accessing it from local host with the default port, then visit this address: 127.0.0.1:8989
Enter your user and password to login.
On the dashboard, the "Servers" tab is shown by default.
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 wrench icon. This will open a popup window.
Check the "Force closing" checkbox.
Click the "Set" 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.
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.
Upgrading MariaDB MaxScale from 25.01 to 25.10
Service User Grants
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:
Monitor timeouts
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.
Upgrading MariaDB MaxScale from 24.02 to 25.01
Readwritesplit
reuse_prepared_statements
The 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_trx
The 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:
Upgrading MariaDB MaxScale from 23.08 to 24.02
Downgrading to older major versions
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:
MariaDB Monitor switchover requires an additional grant on MariaDB Server 10.5 and later. See for more information.
Upgrading MariaDB MaxScale from 22.08 to 23.02
Removed Features
The csmon and auroramon monitors have been removed.
The obsolete maxctrl drain command has been removed.
The maxctrl cluster
Upgrading MariaDB MaxScale from 21.06 to 22.08
Removed Features
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.
Upgrading MariaDB MaxScale from 2.5 to 21.06
MaxScale 6.4 was renamed to 21.06 in May 2024. Thus, what would have been released as 6.4.16 in June, was released as 21.06.16. The purpose of this change is to make the versioning scheme used by all MaxScale series identical. 21.06 denotes the year and month when the first 6 release was made.
Duration Type Parameters
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.
Changed Parameters
threads
The default value of threads was changed to auto.
Removed Parameters
Core Parameters
The following deprecated core parameters have been removed:
thread_stack_size
Schemarouter
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.
mariadbmon
MariaDBMonitor 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.
Session Command History
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.
Upgrading MariaDB MaxScale from 2.4 to 2.5
MaxAdmin
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.
Authentication
The credentials used by services now require additional grants. For a full list of required grants, refer to the .
MariaDB-Monitor
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.
Password encryption
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.
Default Server State
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.
Columnstore Monitor
It is now mandatory to specify in the configuration what version the monitored Columnstore cluster is.
New binlog router
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.
Tee Filter
The tee filter parameter service has been deprecated in favor of the target parameter. All usages of service can be replaced with target.
Upgrading MariaDB MaxScale from 2.3 to 2.4
Section Names
Reserved Names
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 Names
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
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,
Improved Admin User Encryption
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.
MariaDB-Monitor
The following settings have been removed and cause a startup error if defined:
mysql51_replication
multimaster
allow_cluster_recovery.
ReadWriteSplit
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
Upgrading MariaDB MaxScale from 2.2 to 2.3
Increased Memory Use
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.
Unknown Global Parameters
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 deprecated
In 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 ignored
Authenticator options are now only used with listeners.
Upgrading MariaDB MaxScale from 2.1 to 2.2
Administrative Users
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.
Regular Expression Parameters
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
Binlog server automatically accepts GTID connection from MariaDB 10 slave servers by saving all incoming GTIDs into a SQLite map database.
MaxCtrl Included in Main Package
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.
Upgrading MariaDB MaxScale from 2.0 to 2.1
IPv6 Support
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.
Persisted Configuration Files
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/.
MaxScale Log Files
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.
ReadWriteSplit
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.
Persistent Connections
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.
User Data Cache
The location of the MariaDB user data cache was moved from/var/cache/maxscale/<Service> to /var/cache/maxscale/<Service>/<Listener>.
Galeramon Monitoring Algorithm
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.
MaxAdmin Editing Mode
The default editing mode was changed from vim to emacs mode. To start maxadmin in the legacy mode, use the -i option.
Upgrading MariaDB MaxScale from 1.4 to 2.0
MaxAdmin
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.
MySQL Monitor
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.
Upgrading MaxScale from 1.3 to 1.4
Service user permissions
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.
Password encryption
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.
SSL
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.
Upgrading MaxScale from 1.2 to 1.3
Binlog Router
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.
Upgrading MaxScale from 1.1 to 1.2
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.
Installation
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/.
File location changes
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/
Running MaxScale without root permissions
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.
Upgrading MaxScale from 1.0 to 1.1
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.
Installation
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.
MaxAdmin changes
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
Upgrade to MaxScale 25.01
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.
Term Definitions
Term
Definition
Backing Up Configuration
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:
Upgrade
MariaDB Corporation provides package repositories for YUM (RHEL, CentOS, Rocky Linux), APT (Debian, Ubuntu), and ZYpp (SLES).
Stop the MaxScale Process
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
Upgrade MaxScale following the instructions for your Linux distribution:
Upgrade via DNF (RHEL)
1
Customer Download Token
Retrieve your Customer Download Token at and substitute for CUSTOMER_DOWNLOAD_TOKEN in the following directions.
2
Configure YUM / DNF package repository
Configuration
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 Versions
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.
Starting the MaxScale Instance
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:
Operation
Command
Testing
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.
Checking MaxScale Status
Check that MaxScale is running properly by using the utility:
MaxScale Troubleshooting
Diagnose and resolve common MaxScale issues. Find solutions for systemd watchdog kills, high memory usage, authentication failures, and connectivity errors.
SystemD Watchdog Kills MaxScale
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.
High Memory Usage
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 Memory Usage
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.
Profiling Release Mode Binaries
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/
Valgrind
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.
Authentication Errors
Access Denied
If 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.
Verifying that a user is allowed to connect
MaxScale connection
SSH to the server where MaxScale is installed
Connect to MariaDB
Check output of
Checking MaxScale has correct grants
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
Other Errors
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.
Access denied errors for user root!
If you want to connect as root, you'll need to add to the service.
Access denied on databases/tables containing underscores
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.
System Errors
Failed to write message: 11, Resource temporarily unavailable
MaxScale 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.
Error 23: Too many open files
This is a common error when system limits for open files is too low. The fix to this is to increase the limits.
Systemd
Edit or add LimitNOFILE=<number of files> under the [Service] section in /usr/lib/systemd/system/maxscale.service.
MaxCtrl
Error: ENOENT: no such file or directory, uv_cwd
If 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.
Binlogrouter
Commands not Working
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.
MaxScale CDC: Avrorouter
For most problems, resetting the conversion state is the solution. If the conversion repeatedly stops at a certain point, please .
Resetting conversion state
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
Binlog files are not found
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.
Access denied to CDC interface
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>.
Coredumps Are Not Being Generated
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
MaxScale Configuration Guide
Complete MariaDB MaxScale configuration guide. Complete reference for listeners, servers, monitors, routers, and SSL settings with comprehensive examples and.
Introduction
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.
. It also reduces the overall load on the system when connections are rapidly opened and closed.
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.
. If you are using custom modules, please make sure they are in this directory before starting MaxScale.
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/
WEBINAR
New innovations in MaxScale 25.01 and Enterprise Platform
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:
3
Upgrade MariaDB MaxScale and package dependencies
4
Configure MaxScale
The upgrade process only loads MaxScale onto the system. MaxScale requires configuration before MaxScale is ready for use.
The auroramon monitor has been removed after previously being deprecated in MaxScale 22.08.2.
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:
Command-line Option
Replaced by Parameter
--authenticator
authenticator
--authenticator-options
authenticator_options
--interface
interface
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:
Command-line Option
Replaced by 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]
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
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.
sudo systemctl enable maxscale
Disable during startup
sudo systemctl disable maxscale
Status
sudo systemctl status maxscale
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.
ERROR 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'@'%' <-- good
sudo sysctl -w fs.pipe-max-size=8388608
pkg/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
}
$ 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=
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.
Objects
Server
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.
Status
Description
Running
The server is running.
Master
The server is the primary.
Slave
The server is a replica.
For more information on how to manually set these states via MaxCtrl, read the Administration Tutorial.
Monitor
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.
Filter
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.
Router
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.
Service
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.
Listener
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.
Include
An include section defines common parameters used in other configuration sections.
Administration
The administration of MaxScale can be divided in two parts:
Writing the MaxScale configuration file, which is described in the following section.
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 Dynamic Configuration 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.
Administration audit file
The REST API calls to MaxScale can be logged by enabling admin_audit.
For more detail see the admin audit configuration values admin_audit, admin_audit_file and admin_audit_exclude_methods below and Administration Tutorial.
Static Configuration Parameters
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
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
All other parameters that relate to objects can be altered at runtime or can be changed by destroying and recreating the object in question.
Configuration
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.
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 INI, 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.
Names
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.
Dynamic Configuration
By default all changes done at runtime via the MaxScale GUI, MaxCtrl or the REST API will be saved on disk, inside the persistdir 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 persist_runtime_changes=false and load_persisted_configs=false 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.
Special Parameter Types
Booleans
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.
Sizes
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
Durations
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.
Percent
A number denoting a percent must be suffixed with %.
For instance
Regular Expressions
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 PCRE2-library 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 syntax. 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.
case: Turns on case-sensitive matching. This means that /SELECT/ will not match select.
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 PCRE2 syntax documentation 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.
Enumerations
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:
Path Lists
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:
Global Settings
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.
Note: MariaDB MaxScale providess multiple global diagnostic and debugging options (including gdb-stacktrace and dump-network-traffic), which can be used to diagnose and troubleshoot core behavior.
For convenience, here is a quick overview of available diagnostic and debugging settings:
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_tune
Type: string list
Values: all or list of auto tunable parameters, separated by ,
Default: No
Mandatory: No
Dynamic: 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:
MaxScale Parameter
Server Variable Dependency
80% of the smallest value of the servers used by the service
The smallest value of the servers used by the service
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.
threads
Type: 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 threads_max.
From 23.02 onwards it is possible to change the number threads at runtime. Please see Threads 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_max
Type: positive integer
Default: 256
Dynamic: No
This parameter specifies the hard limit for the number of worker threads, which is specified using threads.
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.
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_threshold
Type: 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_window
Type: 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.
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_size
Type: 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.
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 a duration. 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_timeout
Deprecated and ignored as of MaxScale 2.5.0. See auth_connect_timeout above.
auth_write_timeout
Deprecated and ignored as of MaxScale 2.5.0. See auth_connect_timeout above.
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.
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.
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.
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.