Only this pageAll pages
Powered by GitBook
Couldn't generate the PDF for 528 pages, generation stopped at 100.
Extend with 50 more pages.
1 of 100

MaxScale

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Quickstart Guides

Get started with MariaDB MaxScale, the advanced database proxy. These guides provide concise instructions for installation, configuration, and understanding core concepts for new deployments.

MaxScale Architecture

Understand the architecture of MariaDB MaxScale. This section details the core components, including routers, monitors, and filters, that power the database proxy.

MaxScale Management

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.

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.

MaxScale Security

Overview of security features in MariaDB MaxScale, including hardening guides, authentication configuration, and encryption settings for protecting database traffic and administrative access.

MaxScale Use Cases

Discover common deployment scenarios for MariaDB MaxScale. Learn how to leverage its features for high availability, read-write splitting, and load balancing to optimize your database.

Tutorials

Explore hands-on guides for MariaDB MaxScale. These tutorials cover essential configurations including automatic failover, read-write splitting, security setup, and database sharding.

MariaDB MaxScale

Complete MariaDB MaxScale guide. Complete resource for intelligent query routing, load balancing, connection pooling, and high availability.

📄 Read offline: (~5,800 pages, 50 MB). The PDF is a point-in-time snapshot; this site is always current.

Quickstart GuidesMaxScale ArchitectureMaxScale ManagementMaxScale SecurityMaxScale Use CasesTutorialsReference

This page is licensed: CC BY-SA / Gnu FDL

mariadb-maxscale.pdf

MaxScale Overview

Explore the core capabilities of MariaDB MaxScale. This overview covers intelligent routing automated failover security filters and Kafka integration for scalable database architectures.

MariaDB MaxScale is a database proxy that extends the high availability, scalability, and security of MariaDB Server while at the same time simplifying application development by decoupling it from underlying database infrastructure.

MariaDB MaxScale is engineered with an extensible architecture to support plugins, extending its functionality beyond transparent load balancing to become, for example, a database firewall. With built-in plugins for multiple routers, filters and protocols, MariaDB MaxScale can be configured to forward database requests and modify database responses based on business and technical requirements — for example, to mask sensitive data or scale reads.

This page is: Copyright © 2026 MariaDB. All rights reserved.

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.

MaxGUI

Manage MariaDB MaxScale visually with MaxGUI. This browser-based dashboard simplifies configuration, monitoring, and administration tasks for your database proxy instances.

Reference

Access the complete reference for MariaDB MaxScale. Find detailed documentation on configuration parameters, MaxCtrl commands, routers, monitors,

MaxScale Filters

Filters in MariaDB MaxScale intercept and modify database traffic. Use them to transform, block, or log queries, enabling fine-grained control over your database workload and security.

About MariaDB MaxScale

Learn the fundamental concepts of MariaDB MaxScale. This guide explains its role as a database proxy, its plugin-based architecture, and how it manages database connections.

About MariaDB MaxScale

MariaDB MaxScale is a database proxy that forwards database statements to one or more database servers.

The forwarding is performed using rules based on the semantic understanding of the database statements and on the roles of the servers within the backend cluster of databases.

MariaDB MaxScale is designed to provide transparent to applications, load balancing and high availability functionality. MariaDB MaxScale has a scalable and flexible architecture, with plugin components to support different protocols and routing approaches.

MariaDB MaxScale makes extensive use of the asynchronous I/O capabilities of the Linux operating system, combined with a fixed number of worker threads. epoll is used to provide an event-driven framework for the input and output via sockets.

Many of the services provided by MariaDB MaxScale are implemented as external shared object modules loaded at runtime. These modules support a fixed interface, communicating the entry points via a structure consisting of a set of function pointers. This structure is called the "module object". Additional modules can be created to work with MariaDB MaxScale.

Commonly used module types are protocol, router, and filter. Protocol modules implement the communication between clients and MariaDB MaxScale, and between MariaDB MaxScale and backend servers. Routers inspect the queries from clients and decide the target backend. The decisions are usually based on routing rules and backend server status. Filters work on data as it passes through MariaDB MaxScale. Filters are often used for logging queries or modifying server responses.

A Google Group exists for MariaDB MaxScale. The Group is used to discuss ideas, issues, and communicate with the MariaDB MaxScale community. Send an email to or use the interface.

Bugs can be reported in the MariaDB Jira

Information about installing MariaDB MaxScale is included in the .

The same guide also provides basic information on running MariaDB MaxScale. More detailed information about configuring MariaDB MaxScale can be found in the .

This page is licensed: CC BY-SA / Gnu FDL

MaxScale Authentication

Explore the supported authentication methods in MariaDB MaxScale. Learn how authenticators validate clients and backend servers using plugins like Native, PAM, GSSAPI, etc.

Overview

In MariaDB MaxScale, authenticators perform the following tasks:

  • Authenticating clients that connect to MaxScale

  • Authenticating connections to back-end MariaDB Enterprise Server nodes

  • Deciding how authentication should be performed

This page is: Copyright © 2026 MariaDB. All rights reserved.

Native Authenticator

Authenticate clients using the default Native Authenticator. This guide explains how MaxScale validates passwords against backend servers using the standard MariaDB authentication plugin.

Overview

MaxScale's Native Authenticator is compatible with MariaDB Enterprise Server. It authenticates database users with the mysql_native_password authentication plugin.

This page is: Copyright © 2026 MariaDB. All rights reserved.

Security Vulnerabilities Fixed in MariaDB MaxScale

This page contains a full list of fixed security vulnerabilities in all versions and series of MariaDB MaxScale.

The list is updated continuously. CVEs may be added retroactively to already-released versions, as vulnerabilities can be reported to and assigned by CVE Numbering Authorities (CNAs) after the corresponding fix has been released. As a result, a release may receive additional CVE entries over time even after it has been published.

List of Fixed Security Vulnerabilities

CVE ID (with cve.org link)
MXS Issue
MariaDB MaxScale Releases

This page is: Copyright © 2026 MariaDB. All rights reserved.

Configuring Servers

Define your database backend servers in MaxScale. Learn to configure server objects set addresses and ports and enable TLS encryption for secure connections.

The first step is to define the servers that make up the cluster. These servers will be used by the services and are monitored by the monitor.

[dbserv1]
type=server
address=192.168.2.1
port=3306

[dbserv2]
type=server
address=192.168.2.2
port=3306

[dbserv3]
type=server
address=192.168.2.3
port=3306

The address and port parameters tell where the server is located.

Enabling TLS

To enable encryption for the MaxScale-to-MariaDB communication, add ssl=true to the server section. To enable server certificate verification, addssl_verify_peer_certificate=true.

The ssl and ssl_verify_peer_certificate parameters are similar to the--ssl and --ssl-verify-server-cert options of the mysql command line client.

For more information about TLS, refer to the .

This page is licensed: CC BY-SA / Gnu FDL

MariaDB MaxScale Guide

Discover the capabilities of MariaDB MaxScale. This overview explains how the proxy manages high availability, load balancing, and security for your database infrastructure.

MariaDB MaxScale is an advanced, database proxy, router, and load balancer designed to enhance the scalability, high availability, and security of your MariaDB deployments. It acts as an intelligent intermediary between your applications and your MariaDB servers, abstracting the underlying database topology.

MaxScale is not a database itself, but a sophisticated gateway that understands the MariaDB protocol. It intercepts client connections and routes them to the appropriate backend MariaDB servers based on configured rules, health checks, and workload types. This allows for flexible and dynamic management of database traffic without requiring changes to the application code.

MariaDB MaxScale provides several key functionalities that contribute to optimizing MariaDB environments:

  • Intelligent Routing and Load Balancing:

MariaDB MaxScale Overview

Get a high-level view of MariaDB MaxScale features. Explore how it handles load balancing, high availability, and security to optimize your database infrastructure.

MariaDB MaxScale is an advanced proxy, router, and load balancer:

  • MaxScale performs automated failover for MariaDB replication. When the primary server fails, MaxScale promotes a replica to be the new primary and redirects the remaining replicas to it.

  • MaxScale's ReadWriteSplit router performs query-based load balancing. ReadWriteSplit routes each write statement to the current primary server and load balances read statements by routing them to the replica servers.

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.

MaxScale's MaxScale's REST API is used by both and .

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.

Operating MaxScale

Perform day-to-day operations on MaxScale. This section covers managing REST API users, rotating logs, and enabling TLS for secure client connections.

  • REST API

Understanding MaxScale's Administrative Interfaces

Compare the available tools for managing MaxScale. Understand the differences between the MaxCtrl command-line utility, the MaxGUI web interface, and the REST API.

MariaDB MaxScale provides various administrative interfaces can be used to perform the following tasks:

  • Setting a server to maintenance mode.

  • Reconfiguring monitors.

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.

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.

There are two types of users:

User Type
Description

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.

MaxScale has a , 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.

is a command-line utility that can perform administrative tasks using MaxScale's . It can be used to delete a user for the REST API.

  1. if the default configuration is not sufficient.

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.

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.

  1. Configure the REST API if the default configuration is not sufficient.

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.

1

If your setup utilizes a dedicated listener that must be removed alongside the server, you must destroy the listener first.

Analyzing MaxCtrl Create Report Output

Learn to inspect MaxScale's runtime state using the JSON report from maxctrl. Use jq to query servers services and monitors for detailed debugging and analysis.

The output of the maxctrl create report command produces a JSON payload that contains the current state of MaxScale. This includes the runtime configuration and the status all objects in MaxScale.

The report can be created with:

After the command completes, the data is in maxctrl-report.json.

The file in which the output is stored is the only argument to this command. Recent versions of maxctrl pipe the output to the standard output if no filename is given. This can be useful for environments where copying files may be difficult (e.g. docker).

The easiest way to inspect the JSON output is to use the jq program:

MaxScale Authenticators

Secure client connections with MaxScale authentication modules. This reference details configuration for Native, PAM, GSSAPI, and Ed25519 plugins to validate user credentials.

MaxScale Protocols

Explore the protocol modules available in MariaDB MaxScale. This reference covers configuration for the standard MariaDB protocol, the NoSQL listener, and legacy CDC integration.

  • ReadWriteSplit Router: This is a primary feature that automatically distinguishes between read (SELECT) and write (INSERT, UPDATE, DELETE, DDL) statements. It intelligently routes all write statements to the designated primary server and distributes read statements across multiple replica servers, significantly improving read scalability and reducing the load on the primary.

  • Other Routers: MaxScale offers various routers for different use cases, such as routing to specific databases, connection-based routing, or custom routing logic.

  • High Availability and Automated Failover:

    • MaxScale constantly monitors the health of your MariaDB servers. In a replication setup (e.g., primary-replica or Galera Cluster), if the primary server fails, MaxScale can automatically detect the failure, promote a healthy replica to become the new primary, and seamlessly redirect client connections to the newly promoted server. This minimizes downtime and ensures continuous operation.

  • Seamless Server Maintenance:

    • MaxScale provides built-in mechanisms to place backend servers into maintenance mode without interrupting connected applications or clients. This allows administrators to perform tasks like patching, upgrades, or reconfigurations on individual servers while MaxScale intelligently redirects traffic away from them. Management can be done via the maxctrl command-line interface, MaxGUI (web interface), or REST API.

  • Security and Traffic Control:

    • MaxScale can implement granular security policies and traffic controls for database connections and queries. This includes features like firewalling, query filtering, and authentication proxying.

    • QLAfilter (Query Log Anonymizer Filter): This filter can be used to create an audit trail by logging all queries, with options to anonymize sensitive data, aiding in security audits and performance analysis.

  • Protocol Compatibility: MaxScale is designed to be compatible with standard MariaDB and MySQL client protocols, making it transparent to most applications.

  • By abstracting the database topology and intelligently managing connections, MariaDB MaxScale helps organizations achieve higher availability, better performance, and enhanced security for their MariaDB deployments.

    • MariaDB MaxScale Documentation

    • MariaDB MaxScale GitHub Repository

    This page is licensed: CC BY-SA / Gnu FDL

    Quickstart Guide: MariaDB MaxScale Overview

    1. What is MariaDB MaxScale?

    2. Core Functionalities and Benefits

    Further Resources:

  • ed25519 Authenticator

  • Authenticators Supported by MaxScale

    GSSAPI Authenticator
    Native Authenticator
    PAM Authenticator
    PARSEC Authenticator

    MaxScale Monitors

    Ensure high availability with MaxScale Monitors. This reference details monitoring modules for MariaDB replication and Galera clusters, covering failover, role detection, and health checks.

    MaxScale's ReadConnRoute router performs connection-based load balancing. ReadConnRoute routes each connection to a single primary or replica node, depending on configuration.

  • MaxScale can import data from Kafka and export data into Kafka. MaxScale's KafkaCDC router streams data from MariaDB database products to a Kafka broker. MaxScale's KafkaImporter router streams data from Kafka to MariaDB database products.

  • MaxScale provides built-in mechanisms to perform server maintenance without disrupting applications or clients. Servers can be set to maintenance mode using the command-line interface with MaxCtrl, a web browser with MaxGUI, or REST API.

  • MaxScale's Cache filter can improve SELECT performance by caching and reusing results.

  • Security and traffic controls for database connections and queries can be implemented with MaxScale. MaxScale's QLAfilter can be used to create an audit trail by logging all queries. MaxScale's RegexFilter can also perform audit logging or protect against SQL injection by matching queries against a regular expression and performing various actions on the query, such as logging it, modifying it, or routing it to a specific server.

  • MariaDB MaxScale can be deployed in the cloud or on-premises.

    MariaDB MaxScale follows the MariaDB Enterprise release schedule, which can be found here.

    The supported MaxScale versions can be found in the latest MariaDB Engineering Policy.

    This page is: Copyright © 2026 MariaDB. All rights reserved.

    Overview

    Scheduled Releases

    Software Releases

    It used a hard-coded user (admin) and password (mariadb) by default.

    1. Configure MaxScale's REST API for remote connections by configuring several global parameters in maxscale.cnf.

    Parameter
    Description

    • This parameter defines the network address that the REST API listens on.• The default value is 127.0.0.1.

    • This parameter defines the network port that the REST API listens on.• The default value is 8989.

    For example:

    1. Restart the MaxScale instance.

    This page is: Copyright © 2026 MariaDB. All rights reserved.

    Overview

    MaxCtrl
    MaxGUI
    [maxscale]
    ...
    admin_host            = 0.0.0.0
    admin_port            = 8443
    $ sudo systemctl restart maxscale

    Configuring MaxScale's REST API for Remote Connections

    Deleting a REST API User

  • TLS

    • Enabling TLS on MaxScale

    • Enabling TLS for MaxScale's REST API

  • MaxGUI

    • Configuring MaxScale for MaxGUI

  • Operations

    • Setting a Server to Maintenance Mode with MaxGUI

  • This page is: Copyright © 2026 MariaDB. All rights reserved.

    Configuring the REST-API
    Creating a REST API User
    Reconfiguring routers.
  • And much more.

  • MaxScale supports different administrative interfaces for different kinds of environments and preferences:

    Interface
    Description

    Command-line administrative utility.

    Graphical administrative utility.

    REST API for programmatic administration.

    This page is: Copyright © 2026 MariaDB. All rights reserved.

    Overview

    Tools Supported by MaxScale

    Basic

    The user has read-only access

    Admin

    The user can change global MaxScale parameters and reconfigure modules.

    1. Configure the REST API if the default configuration is not sufficient.

    2. Use MaxCtrl to execute the create user command:

    Replace maxscale_rest and maxscale_rest_password with the desired user and password.

    1. Configure the REST API if the default configuration is not sufficient.

    2. Use MaxCtrl to execute the create user command with the --type=admin option:

    Replace maxscale_rest_admin and maxscale_rest_admin_password with the desired user and password.

    This page is: Copyright © 2026 MariaDB. All rights reserved.

    Overview

    User Types

    REST API
    REST API
    $ maxctrl --secure
       --user=admin
       --password=mariadb
       --hosts=192.0.2.100:8443
       --tls-key=/certs/client-key.pem
       --tls-cert=/certs/client-cert.pem
       --tls-ca-cert=/certs/ca.pem
       create user "maxscale_rest" "maxscale_rest_password"
    $ maxctrl --secure
       --user=admin
       --password=mariadb
       --hosts=192.0.2.100:8443
       --tls-key=/certs/client-key.pem
       --tls-cert=/certs/client-cert.pem
       --tls-ca-cert=/certs/ca.pem
       create user "maxscale_rest_admin" "maxscale_rest_admin_password" --type=admin

    Creating a Basic User

    Creating an Admin User

    Use MaxCtrl to execute the destroy user command:

    Replace admin with the actual user.

    This page is: Copyright © 2026 MariaDB. All rights reserved.

    Overview

    Deleting a User

    REST API
    MaxCtrl
    REST API
    Configure the REST API
    $ maxctrl --secure
       --user=maxscale_rest_admin
       --password=maxscale_rest_admin_password
       --hosts=192.0.2.100:8443
       --tls-key=/certs/client-key.pem
       --tls-cert=/certs/client-cert.pem
       --tls-ca-cert=/certs/ca.pem
       destroy user "admin"

    MaxScale will refuse to delete the last remaining admin user.

    Use MaxCtrl to execute the set server command with the maintenance option:

    Replace server1 with the name of the specific server.

    1. If the specified server is a primary server, then MaxScale will allow open transactions to complete before closing any connections.

    1. Use MaxCtrl to execute the set server command with the maintenance --force option:

    1. Replace server1 with the specific server name. When --force is used, MaxScale immediately closes all connections, even if the server is a primary server with open transactions.

    This page is: Copyright © 2026 MariaDB. All rights reserved.

    Overview

    Setting a Server to Maintenance Mode

    $ maxctrl --secure 
       --user=maxscale_rest_admin 
       --password=maxscale_rest_admin_password 
       --hosts=192.0.2.100:8443
       --tls-key=/certs/client-key.pem 
       --tls-cert=/certs/client-cert.pem 
       --tls-ca-cert=/certs/ca.pem 
       set server server1 maintenance
    $ maxctrl --secure 
       --user=maxscale_rest_admin 
       --password=maxscale_rest_admin_password 
       --hosts=192.0.2.100:8443
       --tls-key=/certs/client-key.pem 
       --tls-cert=/certs/client-cert.pem 
       --tls-ca-cert=/certs/ca.pem 

    Forcing a Server to Maintenance Mode

    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.

    • Unlink the server object from the service using the unlink service command.

    maxctrl unlink service \
       Round-Robin-Service \
       mariadbgalera3
    • Confirm that the server object was properly unlinked from the 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.

    • Unlink a server object from the monitor using the unlink monitor command.

    maxctrl unlink monitor \
       MariaDB-Monitor \
       mariadbgalera3
    • Confirm that the server object was properly unlinked from the monitor

    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.

    • Remove the server object using the destroy server command.

    maxctrl destroy server \
       mariadbgalera3
    • Confirm that the server object was properly removed

    This page is: Copyright © 2026 MariaDB. All rights reserved.

    Fast Track - Force Server Removal

    While we may remove a server with the --force 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.

    Destroy the Listener (If Applicable)

    maxctrl destroy listener \
       Round-Robin-Service \
       Round-Robin-Listener
    It is usually available as a package in most operating systems.

    This can be combined with the object field access to list the fields of sub-objects. The following lists the keys in the first server object.

    Change the RW-Split-Router to the name of the service you're looking for.

    Change the MariaDB-Monitor to the name of the monitor you're looking for.

    Change the DB-1 to the name of the server you're looking for.

    Change DB-1 to the name of the server you're looking for.

    This page is licensed: CC BY-SA / Gnu FDL

    maxctrl create report maxctrl-report.json

    Creating a MaxCtrl Report

    Using jq

    jq '.servers.data[].id' < maxctrl-report.json
    jq '.services.data[].id' <  maxctrl-report.json
    jq '.monitors.data[].id' < maxctrl-report.json
    jq '.listeners.data[].id' <  maxctrl-report.json
    jq '.filters.data[].id' <  maxctrl-report.json
    jq 'keys' < maxctrl-report.json
    jq '.servers.data[0]|keys' < maxctrl-report.json
    jq '.services.data|map(select(.id == "RW-Split-Router"))' < maxctrl-report.json
    jq '.monitors.data|map(select(.id == "MariaDB-Monitor"))' < maxctrl-report.json
    jq '.servers.data|map(select(.id == "DB-1"))' < maxctrl-report.json
    jq '.servers.data|map(select(.id == "DB-1"))|.[].relationships.monitors.data' < maxctrl-report.json
    jq '[.threads.data[].attributes.stats.query_classifier_cache.size]|add' < maxctrl-report.json

    List servers

    List services

    List monitors

    List listeners

    List filters

    List keys of objects

    Get a specific service

    Get a specific monitor

    Get a specific server

    Find the monitor for a server

    Memory used by the query classifier cache

    MXS-4681

    2.5.28, 6.4.9, 22.08.8, 23.02.3

    CVE-2023-40354

    Installing MariaDB MaxScale

    maxscale@googlegroups.com
    forum
    jira.mariadb.org
    MariaDB MaxScale Installation Guide
    Configuration Guide
    Configuration Guide

    MariaDB MaxScale Limitations Guide

    Review known limitations and constraints of MariaDB MaxScale. Understand supported features, configuration boundaries, and protocol specifics to plan your deployment effectively.

    Quickstart Guide: MariaDB MaxScale Limitations

    While MariaDB MaxScale is a powerful tool for managing MariaDB deployments, it's essential to be aware of its limitations to ensure proper configuration and avoid unexpected behavior. This guide highlights key considerations when deploying and using MaxScale.

    1. Configuration File Line Length

    • Limitation: Older versions of MaxScale (2.1.2 and earlier) had a strict line length limit of 1024 characters in the configuration file (maxscale.cnf).

    • Consideration: Ensure your MaxScale configuration lines do not exceed this limit for older versions. Modern versions (e.g., 2.3.0 and later) have significantly increased this limit (to 16,777,216 characters), making it less of a concern for current deployments. Always check the documentation for your specific MaxScale version.

    • Limitation: MaxScale operates under the assumption that certain MariaDB Server configuration parameters are set to their default values. A critical example is the assumption that autocommit is enabled for new connections.

    • Consideration: If your backend MariaDB servers deviate from default autocommit settings or other assumed defaults, it could lead to unexpected behavior in how MaxScale manages connections and routes queries, particularly with transaction handling. Always verify that your MariaDB server configurations align with MaxScale's expectations as outlined in its documentation.

    • Limitation: MaxScale uses a custom SQL parser to deduce transaction boundaries. This parser may not fully comprehend or correctly classify highly complex SQL statements or certain edge cases. This can lead to a mismatch between MaxScale's understanding of a connection's transaction state and the actual state on the backend database.

    • Specific Issue with XA Transactions: If a START TRANSACTION command fails internally on the backend due to an already open XA transaction (e.g., using XA START), MaxScale's parser might not correctly detect this failure. It could mistakenly assume a new transaction has started, leading to discrepancies in transaction state awareness, especially with the readwritesplit router.

    • Limitation: The ETL (Extract, Transform, Load) feature within MaxScale relies on the MariaDB Connector/ODBC driver for its functionality.

    • Consideration: To ensure stability and avoid potential crashes or memory leaks when using MaxScale's ETL capabilities, it is highly recommended to use MariaDB Connector/ODBC driver version 3.1.18 or later. Always ensure all components are compatible.

    • Query Classification: MaxScale's ability to route queries correctly relies on its query classification. If queries are ambiguous or use non-standard SQL, they might be misrouted.

    • Prepared Statements: While supported, complex interactions with prepared statements can sometimes expose nuances in parsing or routing.

    • Protocol Specifics: MaxScale aims for broad compatibility, but subtle differences in client or server protocol implementations might arise.

    Understanding these limitations helps in designing a robust MaxScale deployment and troubleshooting potential issues effectively.

    This page is licensed: CC BY-SA / Gnu FDL

    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

    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.

    See and for instructions on how to harden your MaxScale installation for production use.

    MaxGUI uses the same credentials as maxctrl. The default username is admin with mariadb as the password.

    Internally, MaxGUI uses as the authentication method for persisting the user's session. If the Remember me checkbox is ticked, the session will persist for 24 hours. Otherwise, the session will expire as soon as MaxGUI is closed.

    To log out, simply click the username section in the top right corner of the page header to access the logout menu.

    This page provides an overview of MaxScale configuration which includes Monitors, Servers, Services, Sessions, Listeners, and Filters.

    By default, the refresh interval is 10 seconds.

    This page shows information on each and allow to edit its parameter, relationships and perform other manipulation operations.

    Access this page by clicking on the MaxScale object name on the

    This page visualizes MaxScale configuration and clusters.

    • Configuration: Visualizing MaxScale configuration.

    • Cluster: Visualizing a replication cluster into a tree graph and provides manual cluster manipulation operations such asswitchover, reset-replication, release-locks, failover, rejoin . At the moment, it supports only servers monitored by Monitor using module.

    Access this page by clicking the graph icon on the sidebar navigation.

    This page shows and allows editing of MaxScale parameters.

    Access this page by clicking the gear icon on the sidebar navigation.

    Realtime MaxScale logs can be accessed by clicking the logs icon on the sidebar navigation.

    The "Workspace" page offers a versatile set of tools for effectively managing data and database interactions. It includes the following key tasks:

    Execute queries on various servers, services, or listeners to retrieve data and perform database operations. Visualize query results using different graph types such as line, bar, or scatter graphs. Export query results in formats like CSV or JSON for further analysis and sharing.

    The "Data Migration" feature facilitates seamless transitions from PostgreSQL to MariaDB. Transfer data and database structures between the two systems while ensuring data integrity and consistency throughout the process.

    Generating Entity-Relationship Diagrams (ERDs) to gain insights regarding data structure, optimizing database design for both efficiency and clarity.

    This page is licensed: CC BY-SA / Gnu FDL

    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 MaxScale's REST API. It can be used to set a server to maintenance mode.

    Setting a Server to Maintenance Mode

    1. Configure MaxScale for MaxGUI.

    2. Visit MaxGUI in your web browser. For example, if you are accessing it from local host with the default port, then visit this address:

    3. Enter your username and password to log in.

    4. On the dashboard, the "Servers" tab is shown by default.

    5. Click the server that you want to set to maintenance mode. This will bring up a page for the specific server.

    6. 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.

    7. Click the wrench icon. This will open a popup window.

    8. Click the "Set" button. If the specified server is a primary server, then MaxScale will allow open transactions to complete before closing any connections.

    1. Visit MaxGUI in your web browser. For example, if you are accessing it from local host with the default port, then visit this address:

    2. Enter your user and password to login.

    This page is: Copyright © 2026 MariaDB. All rights reserved.

    Configuring the Galera Monitor

    Set up monitoring for Galera Clusters. Configure the galeramon module to automatically detect the primary node and manage cluster membership within MaxScale.

    This document describes how to configure a Galera cluster monitor.

    Configuring the Monitor

    Define the monitor that monitors the servers.

    [Galera-Monitor]
    type=monitor
    module=galeramon
    servers=dbserv1, dbserv2, dbserv3
    user=monitor_user
    password=my_password
    monitor_interval=2000ms

    The mandatory parameters are the object type, the monitor module to use, the list of servers to monitor and the username and password to use when connecting to the servers. The monitor_interval parameter controls for how long the monitor waits between each monitoring loop.

    This monitor module will assign one node within the Galera Cluster as the current primary and other nodes as replica. Only those nodes that are active members of the cluster are considered when making the choice of primary node. The primary node will be the node with the lowest value of wsrep_local_index.

    Monitor User

    The monitor user does not require any special grants to monitor a Galera cluster. To create a user for the monitor, execute the following SQL.

    This page is licensed: CC BY-SA / Gnu FDL

    Configuring the MariaDB Monitor

    Configure the mariadbmon module to monitor primary-replica clusters. Learn to set monitoring intervals and define user credentials for health checks.

    This document describes how to configure a MariaDB primary-replica cluster monitor to be used with MaxScale.

    Configuring the Monitor

    Define the monitor that monitors the servers.

    [Replication-Monitor]
    type=monitor
    module=mariadbmon
    servers=dbserv1,dbserv2,dbserv3
    user=monitor_user
    password=my_password
    monitor_interval=2000ms

    The mandatory parameters are the object type, the monitor module to use, the list of servers to monitor, and the username and password to use when connecting to the servers. The monitor_interval parameter controls how long the monitor waits between each monitor tick.

    Monitor User

    The monitor user requires the REPLICA MONITOR privilege to do basic monitoring. To create a user with the proper grants, run:

    CREATE USER 'monitor_user'@'%' IDENTIFIED BY 'my_password';
    GRANT REPLICA MONITOR ON *.* TO 'monitor_user'@'%';

    If the automatic failover feature is used, the monitor user needs additional grants. See monitor documentation for more information.

    This page is licensed: CC BY-SA / Gnu FDL

    MaxScale Optimistic Transaction Execution Filter

    Improve performance for read-heavy transactions. This filter attempts to execute transactions on replicas first falling back to the primary only if a write occurs.

    Overview

    The optimistictrx filter implements optimistic transaction execution. The filter is designed for a use-case where most of the transactions are read-only and writes happen rarely but each set of read-only statements is still grouped into a read-write transaction (i.e. START TRANSACTION, BEGIN orSET autocommit=0).

    This filter will replace the BEGIN and START TRANSACTION SQL commands withSTART TRANSACTION READ ONLY. If the transaction is fully read-only, the transaction completes normally. However, if a write happens in the middle of a transaction, the filter issues a ROLLBACK command and then replays the read-only part of the transaction, including the original BEGIN statement. If the results of the replayed read-only part of the transaction is identical to the one that was returned to the client, the transaction proceeds normally. If the result checksum does not match, the connection is closed to prevent a write with the wrong transaction state from happening.

    To add the filter to a service, define an instance of the filter and then add it to a service's filters list:

    This can also be done at runtime with:

    This page is licensed: CC BY-SA / Gnu FDL

    MariaDB MaxScale Authenticators Guide

    Configure secure access to your database. This guide explains how to set up authenticators in MaxScale to manage client credentials and validate connections to backend servers.

    MariaDB MaxScale incorporates robust authentication modules to manage client access and ensure secure communication with your backend MariaDB servers. Understanding these modules is crucial for securing your database deployments when using MaxScale.

    MaxScale's authentication modules (often referred to as "authenticator plugins") are components that handle client authentication. They determine how incoming clients verify their identity to MaxScale and, in turn, how MaxScale authenticates itself to the backend MariaDB servers. This process is similar to how authentication works directly with MariaDB Server using the MySQL protocol.

    MaxScale employs a User Account Manager (UAM) for services that use a MariaDB protocol listener.

    • The UAM is responsible for storing and managing user account information.

    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.

    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:

    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.

    _MaxCtrl is a command-line utility that can perform administrative tasks using . It is possible to connect to MaxScale using TLS with MaxCtrl.

    1. or , depending on what kind of user you need:

    Replace maxscale\_rest\_admin and maxscale\_rest\_admin\_password with the desired user and password.

    MaxScale MariaDB/MySQL Authenticator

    Configure standard native password authentication. This guide covers the MariaDBAuth module, which handles the default mysql_native_password plugin used by MariaDB and MySQL.

    The MariaDBAuth module implements the client and backend authentication for the server plugin mysql_native_password. This is the default authentication plugin used by both MariaDB and MySQL.

    The following settings may be given in the authenticator_options of the listener.

    Boolean, default value is false. Activates passthrough mode. In this mode, MaxScale does not check client credentials at all and defers authentication to the backend server. It may be useful in any situation where MaxScale cannot check the existence of client user account nor authenticate the client.

    When a client connects to a listener with this setting enabled, MaxScale changes the authentication method to mysql_clear_password

    Encrypting Passwords

    Secure your MaxScale configuration by encrypting passwords. Learn to generate encryption keys with maxkeys and obscure credentials using the maxpasswd utility.

    There are two options for representing the password, either plain text or encrypted passwords may be used. In order to use encrypted passwords a set of keys must be generated that will be used by the encryption and decryption process. To generate the keys, use the maxkeys command.

    By default the key file will be generated in /var/lib/maxscale. If a different directory is required, it can be given as the first argument to the program. For more information, see maxkeys --help.

    Once the keys have been created the maxpasswd command can be used to generate the encrypted password.

    Read-Write Splitting

    Configure the readwritesplit router for query-based load balancing. Route writes to the primary and distribute reads across replicas to optimize performance.

    The goal of this tutorial is to configure a system that appears to the client as a single database. MariaDB MaxScale will split the statements such that write statements are sent to the primary server and read statements are balanced across the replica servers.

    This tutorial is a part of . Please read it and follow the instructions. Return here once basic setup is complete.

    After configuring the servers and the monitor, we create a read-write-splitter service configuration. Create the following section in your configuration file. The section name is also the name of the service and should be meaningful. For this tutorial, we use the name Splitter-Service.

    router defines the routing module used. Here we use readwritesplit for query-level read-write-splitting.

    A service needs a list of servers where queries will be routed to. The server names must match the names of server sections in the configuration file and not the hostnames or addresses of the servers.

    MaxScale Module Commands

    Learn about special module-specific commands in MaxScale. This guide explains how to list and execute commands using MaxCtrl for modules like authenticators, filters, and monitors.

    Introduced in MaxScale 2.1, the module commands are special, module-specific commands. They allow the modules to expand beyond the capabilities of the module API. Currently, only MaxCtrl implements an interface to the module commands.

    All registered module commands can be shown with maxctrl list commands and they can be executed with maxctrl call command <module> <name> ARGS... whereis the name of the module and is the name of the command.ARGS is a command specific list of arguments.

    The module command API is defined in the modulecmd.h header. It consists of various functions to register and call module commands. Read the function documentation in the header for more details.

    The following example registers the module command my_command for module_my_module_.

    MaxScale Comment Filter

    Inject custom comments into SQL statements. This filter allows administrators to tag queries with metadata for tracking, auditing, or debugging purposes.

    With the comment filter it is possible to define comments that are injected before the actual statements. These comments appear as sql comments when they are received by the server.

    The Comment filter requires one mandatory parameter to be defined.

    • Type: string

    • Mandatory: Yes

    MaxScale GSSAPI Client Authenticator

    Integrate MaxScale with Kerberos or Active Directory using GSSAPI. Learn to configure the GSSAPIAuth module, manage keytab files, and set up service principals for secure login.

    GSSAPI is an authentication protocol that is commonly implemented with Kerberos on Unix or Active Directory on Windows. This document describes GSSAPI authentication in MaxScale. The authentication module name in MaxScale SSAPIAuth.

    For Unix systems, the usual GSSAPI implementation is Kerberos. This is a short guide on how to set up Kerberos for MaxScale.

    The first step is to configure MariaDB to use GSSAPI authentication. The MariaDB documentation for the is a good example on how to set it up.

    The next step is to copy the keytab file from the server where MariaDB is installed to the server where MaxScale is located. The keytab file must be placed in the configured default location which almost always is /etc/krb5.keytab. Alternatively, the keytab filepath can be given as an authenticator option.

    MaxScale Psreuse Filter

    Optimize prepared statement execution. This filter caches prepared statements on the proxy layer reducing the overhead of re-preparing statements on backend servers.

    The psreuse filter reuses identical prepared statements inside the same client connection. This filter only works with binary protocol prepared statements and not with text protocol prepared statements executed with the PREPARE SQL command.

    When this filter is enabled and the connection prepares an identical prepared statement multiple times, instead of preparing it on the server the existing prepared statement handle is reused. This also means that whenever prepared statements are closed by the client, they will be left open by readwritesplit.

    Enabling this feature will increase memory usage of a session. The amount of memory stored per prepared statement is proportional to the length of the prepared SQL statement and the number of parameters the statement has.

    To add the filter to a service, define an instance of the filter and then add it to a service's filters

    MaxScale Readonly

    Enforce read-only access at the proxy level. This filter rejects modification statements like INSERT or UPDATE protecting the database from accidental writes.

    This filter prevents writes from being done and returns a read-only error if one is attempted. The error that is returned is ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION, error number 1792 with SQLSTATE 25006 and the message Cannot execute statement in a READ ONLY transaction.

    This filter is an implicit filter and has no configuration parameters and does not need its own configuration section. To enable it, simply add it to the service using the module name.

    The filter prevents writes in two ways: by parsing the SQL and detecting writes and by setting the default mode of transactions to read-only. The parsing will prevent any writes that are detected from reaching the database and the read-only mode of transactions will prevent writes in stored procedures and user functions as well as act as a backup method in case the parsing is ineffective in detecting a write.

    MaxScale PARSEC Authenticator

    Enable modern, secure authentication with PARSEC. This guide explains the parsecauth module, which uses elliptic curve signatures and salted passwords to prevent replay attacks.

    The (Password Authentication using Response Signed with Elliptic Curve) authentication plugin uses salted passwords, key derivation, extensible password storage format, and both server-side and client-side scrambles.

    Similarly to the ed25519 authentication plugin, it signs the response with a ed25519 digital signature, but unlike the ed25519 authentication plugin, it uses the stock unmodified ed25519 as provided by OpenSSL.

    This authentication plugin is intended to be used with MariaDB version 12 or later and requires that the service user has the SET USER grant.

    MariaDB versions 11.6 or later that include the PARSEC authentication plugin are supported but the passwords for the users must be provided via the . The documentation for the contains an example of how to configure the user mapping.

    Consideration: Be cautious with overly complex SQL or when using XA transactions in conjunction with MaxScale's transaction-aware routers. Thoroughly test your application's transaction logic through MaxScale to identify and mitigate any potential inconsistencies.

    Monitoring and Filters: Be aware that specific monitor or filter modules might have their own inherent limitations or performance impacts.

    2. Assumptions about MariaDB Server Configuration

    3. Transaction Boundary Detection and XA Transactions

    4. ETL Feature Dependency

    Important General Considerations:

    Further Resources:

    MariaDB MaxScale Limitations Documentation
    MariaDB MaxScale Documentation (General)
  • It typically queries the mysql database on your backend MariaDB servers (usually the primary) to retrieve user account details.

  • Using this information, the UAM authenticates connecting clients, verifies their passwords, and checks their database access rights.

  • The user and password settings within your MaxScale service configuration define the credentials MaxScale uses to fetch these user accounts from the backend databases.

  • MaxScale supports various authentication schemes through different plugins:

    • Standard MySQL Password: This is the most common authentication method, verifying user credentials against those stored in the backend MariaDB server's mysql.user table (or similar).

    • GSSAPI (Generic Security Service Application Programming Interface): Provides secure authentication methods, often used in enterprise environments with Kerberos or similar systems.

    • PAM (Pluggable Authentication Modules): Allows MaxScale to integrate with PAM, enabling authentication against external systems like Unix system users, LDAP, or Active Directory.

    Authentication options are primarily defined within the listener configuration of your MaxScale service in the maxscale.cnf file.

    a. Specifying the Authenticator:

    The authenticator parameter specifies which authentication plugin to use for a particular listener.

    Example maxscale.cnf snippet (simplified):

    b. Authenticator Options (authenticator_options):

    Additional settings can be passed to the authenticator plugin using authenticator_options. These are comma-separated key-value pairs.

    Common authenticator_options:

    • skip_authentication=true: (Use with extreme caution, typically only for development/testing). This option bypasses password checks for connecting clients. Clients will still need a valid username in the backend database, but their password will not be verified.

    • match_host=false: Disables host matching for user accounts. By default, MariaDB (and thus MaxScale's UAM) matches user accounts based on both username and host (e.g., 'user'@'localhost'). Setting this to false means only the username needs to match.

    • lower_case_table_names=true/false: Controls how database names are matched during authentication, similar to the lower_case_table_names system variable in MariaDB Server.

    Example with options:

    By configuring these authentication modules, you can control how clients connect to your MariaDB through MaxScale, enforce security policies, and integrate with existing authentication infrastructure.

    • MariaDB MaxScale Authentication Modules Documentation

    • MariaDB MaxScale Documentation

    This page is licensed: CC BY-SA / Gnu FDL

    Quickstart Guide: MariaDB MaxScale Authentication Modules

    1. What are MaxScale Authentication Modules?

    2. How Authentication Works in MaxScale

    3. Available Authentication Plugins

    4. Basic Configuration Concepts

    Further Resources:

    maxctrl show services
    maxctrl show monitors
    maxctrl show servers
    maxctrl destroy server mariadbgalera3 --force
    [my_service]
    type=service
    router=readwritesplit
    servers=server1,server2
    user=maxscale_user # User MaxScale uses to connect to backend MariaDB for UAM
    password=maxscale_password
    
    [my_listener]
    type=listener
    service=my_service
    port=3306
    authenticator=MariaDBAuth # Example: Use the standard MariaDB password authentication
    # authenticator=GSSAPIAuth # Or GSSAPI authentication
    # authenticator=PAMAuth    # Or PAM authentication
    [my_listener]
    # ... other settings ...
    authenticator=MariaDBAuth
    authenticator_options=skip_authentication=true,match_host=false
    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.

  • Forcing a Server to Maintenance Mode

    127.0.0.1:8989
    Configure MaxScale for MaxGUI
    127.0.0.1:8989
    libcurl
  • libaio

  • OpenSSL

  • gnutls

  • libatomic

  • unixODBC

  • In addition, in order to use the maxctrl command line client, you'll need to install Node.js. The minimum required version is Node.js 10 but we recommend using the latest LTS release of Node.js if the one in the operating system repositories is old.

    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.

    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:

    Creating the symbolic link is necessary, since MariaDB MaxScale has been built with the assumption that the plugin directory is /usr/local/maxscale/lib/maxscale.

    The symbolic link also makes it easy to switch between different versions of MariaDB MaxScale that have been installed side by side in /usr/local; just make the symbolic link point to another installation.

    In addition, the first time you install MariaDB MaxScale from a tarball you need to create the following directories:

    and make maxscale the owner of them:

    The following step is to create the MariaDB MaxScale configuration file /etc/maxscale.cnf. The file etc/maxscale.cnf.template can be used as a base. Please refer to Configuration Guide for details.

    When the configuration file has been created, MariaDB MaxScale can be started.

    The -d flag causes maxscale not to turn itself into a daemon, which is advisable the first time MariaDB MaxScale is started, as it makes it easier to spot problems.

    If you want to place the configuration file somewhere else but in /etc you can invoke MariaDB MaxScale with the --config flag, for instance, --config=/usr/local/maxscale/etc/maxscale.cnf.

    Note also that if you want to keep everything under /usr/local/maxscale you can invoke MariaDB MaxScale using the flag --basedir.

    That will cause MariaDB MaxScale to look for its configuration file in/usr/local/maxscale/etc and to store all runtime files under /usr/local/maxscale/var.

    Enter a directory where you have the right to create a subdirectory. Then do as follows.

    The next step is to create the MaxScale configuration file maxscale-x.y.z/etc/maxscale.cnf. The file maxscale-x.y.z/etc/maxscale.cnf.template can be used as a base. Please refer to Configuration Guide for details.

    When the configuration file has been created, MariaDB MaxScale can be started.

    With the flag --basedir, MariaDB MaxScale is told where the lib, etc and var directories are found. Unless it is specified, MariaDB MaxScale assumes the lib directory is found in /usr/local/maxscale, and the var and etc directories in /.

    It is also possible to specify the directories and the location of the configuration file individually. Invoke MaxScale like

    to find out the appropriate flags.

    This page is licensed: CC BY-SA / Gnu FDL

    Installing MariaDB MaxScale using a tarball

    $ sudo groupadd maxscale
    $ sudo useradd -g maxscale maxscale
    $ cd /usr/local
    $ sudo tar -xzvf maxscale-x.y.z.OS.tar.gz
    $ sudo ln -s maxscale-x.y.z.OS maxscale
    $ cd maxscale
    $ sudo chown -R maxscale var
    $ sudo mkdir /var/log/maxscale
    $ sudo mkdir /var/lib/maxscale
    $ sudo mkdir /run/maxscale
    $ sudo mkdir /var/cache/maxscale
    $ sudo chown maxscale /var/log/maxscale
    $ sudo chown maxscale /var/lib/maxscale
    $ sudo chown maxscale /run/maxscale
    $ sudo chown maxscale /var/cache/maxscale
    $ sudo bin/maxscale --user=maxscale -d
    $ sudo bin/maxscale --user=maxscale --basedir=/usr/local/maxscale -d
    $ tar -xzvf maxscale-x.y.z.OS.tar.gz
    $ cd maxscale-x.y.z.OS
    $ bin/maxscale -d --basedir=.
    $ bin/maxscale --help

    Installing as root in /usr/local

    Installing in any Directory

    If you want to use MaxCtrl remotely, configure the REST API for remote connections. Several global parameters must be configured in maxscale.cnf.

    Parameter
    Description

    This parameter defines the network address that the REST API listens on. The default value is 127.0.0.1.

    This parameter defines the network port that the REST API listens on. The default value is 8989.

    For example:

    1. Enable TLS for MaxScale's REST API Several global parameters must be configured in maxscale.cnf.

    Parameter
    Description

    * This parameter defines the private key used by the REST API.

    * This parameter defines the certificate used by the REST API.

    *This parameter defines the CA certificate that signed the REST API's certificate.

    For example:

    1. Ensure that the client also has a TLS certificate, a private key, and the CA certificate.

    2. Use MaxCtrl to connect with TLS:

    Replace maxscale_rest_admin and maxscale_rest_admin_password with the actual user and password.

    This page is: Copyright © 2026 MariaDB. All rights reserved.

    $ maxctrl create user "maxscale_rest_admin" "maxscale_rest_admin_password" --type=admin

    Overview

    Connecting to MaxScale using TLS

    MaxScale's REST API
    Create a basic
    admin user
    [maxscale]
    ...
    admin_host            = 0.0.0.0
    admin_port            = 8443
    [maxscale]
    ...
    admin_ssl_key=/certs/server-key.pem
    admin_ssl_cert=/certs/server-cert.pem
    admin_ssl_ca_cert=/certs/ca-cert.pem
    $ maxctrl --secure
       --user=maxscale_rest_admin
       --password=maxscale_rest_admin_password
       --hosts=192.0.2.100:8443
       --tls-key=/certs/client-key.pem
       --tls-cert=/certs/client-cert.pem
       --tls-ca-cert=/certs/ca.pem
    , causing the client to send their cleartext password to MaxScale. MaxScale will then attempt to use the password to authenticate to backends. The authentication result of the first backend to respond is sent to the client. The backend may ask MaxScale for either cleartext password or standard (
    mysql_native_password
    ) authentication token. MaxScale can work with both backend plugins since it has the original password.

    This feature is incompatible with service setting lazy_connect. Either leave it unspecified or set lazy_connect=false in the linked service. Also, multiple client authenticators are not allowed on the listener when passthrough-mode is on.

    Because passwords are sent in cleartext, the listener should be configured for ssl.

    • Type: boolean

    • Mandatory: No

    • Dynamic: No

    • Default: false

    The service setting log_auth_warnings must also be enabled for this setting to have effect. When both settings are enabled, password hashes are logged if a client gives a wrong password. This feature may be useful when diagnosing authentication issues. It should only be enabled on a secure system as the logging of password hashes may be a security risk.

    Deprecated and ignored.

    Deprecated and ignored.

    This page is licensed: CC BY-SA / Gnu FDL

    Overview

    Settings

    clear_pw_passthrough

    [MyListener]
    type=listener
    authenticator=mariadbauth
    authenticator_options=clear_pw_passthrough=true
    ssl=true
    <other options>

    log_password_mismatch

    cache_dir

    inject_service_user

    The username and password, either encrypted or plain text, are stored in the service section using the user and password parameters.

    If a custom location was used for the key file, give it as the first argument tomaxpasswd and pass the password to be encrypted as the second argument. For more information, see maxkeys --help.

    Here is an example configuration that uses an encrypted password.

    If the key file is not in the default location, the datadir parameter must be set to the directory that contains it.

    This page is licensed: CC BY-SA / Gnu FDL

    maxkeys
    maxpasswd plainpassword
    96F99AA1315BDC3604B006F427DD9484

    Encrypting Passwords

    [My-Service]
    type=service
    router=readconnroute
    router_options=master
    servers=dbserv1, dbserv2, dbserv3
    user=maxscale
    password=96F99AA1315BDC3604B006F427DD9484

    The user and password parameters define the credentials the service uses to populate user authentication data. These users were created at the start of the MaxScale Tutorial.

    For increased security, see password encryption.

    To allow network connections to a service, a network ports must be associated with it. This is done by creating a separate listener section in the configuration file. A service may have multiple listeners but for this tutorial one is enough.

    The service parameter tells which service the listener connects to. For the_Splitter-Listener_ we set it to Splitter-Service.

    A listener must define the network port to listen on.

    The optional address-parameter defines the local address the listener should bind to. This may be required when the host machine has multiple network interfaces. The default behavior is to listen on all network interfaces (the IPv6 address ::).

    For the last steps, please return to MaxScale Tutorial.

    This page is licensed: CC BY-SA / Gnu FDL

    [Splitter-Service]
    type=service
    router=readwritesplit
    servers=dbserv1, dbserv2, dbserv3
    user=maxscale
    password=maxscale_pw

    Setting up MariaDB MaxScale

    Configuring the service

    MariaDB MaxScale Tutorial
    [Splitter-Listener]
    type=listener
    service=Splitter-Service
    port=3306

    Configuring the Listener

    Starting MariaDB MaxScale

    The array my_args of type modulecmd_arg_type_t is used to tell what kinds of arguments the command expects. The first argument is a boolean and the second argument is an optional string.

    Arguments are passed to the parsing function as an array of void pointers. They are interpreted as the types the command expects.

    When the module command is executed, the argv parameter for the_my_simple_cmd_ contains the parsed arguments received from the caller of the command.

    This page is licensed: CC BY-SA / Gnu FDL

    Module commands

    Developer reference

    #include <maxscale/modulecmd.hh>
    
    bool my_simple_cmd(const MODULECMD_ARG *argv)
    {
        printf("%d arguments given\n", argv->argc);
    }
    
    int main(int argc, char **argv)
    {
        modulecmd_arg_type_t my_args[] =
        {
            {MODULECMD_ARG_BOOLEAN, "This is a boolean parameter"},
            {MODULECMD_ARG_STRING | MODULECMD_ARG_OPTIONAL, "This is an optional string parameter"}
        };
    
        // Register the command
        modulecmd_register_command("my_module", "my_command", my_simple_cmd, 2, my_args);
    
        // Find the registered command
        const MODULECMD *cmd = modulecmd_find_command("my_module", "my_command");
    
        // Parse the arguments for the command
        const void *arglist[] = {"true", "optional string"};
        MODULECMD_ARG *arg = modulecmd_arg_parse(cmd, arglist, 2);
    
        // Call the module command
        modulecmd_call_command(cmd, arg);
    
        // Free the parsed arguments
        modulecmd_arg_free(arg);
        return 0;
    }

    Dynamic: Yes

    A parameter that contains the comment injected before the statements. There is also defined variable $IP that can be used to comment the IP address of the client in the injected comment. Variables must be written in all caps.

    as comment.

    The following configuration adds the IP address of the client to the comment.

    In this example when MaxScale receives statement like:

    It would look like

    when received by server.

    This page is licensed: CC BY-SA / Gnu FDL

    [MyComment]
    type=filter
    module=comment
    inject="Comment to be injected"
    
    [MyService]
    type=service
    router=readwritesplit
    servers=server1
    user=myuser
    password=mypasswd
    filters=MyComment

    Overview

    Settings

    inject

    [IPComment]
    type=filter
    module=comment
    inject="IP=$IP"
    
    [MyService]
    type=service
    router=readwritesplit
    servers=server1
    user=myuser
    password=mypasswd
    filters=IPComment
    SELECT user FROM people;
    /* IP=::ffff:127.0.0.1 */SELECT user FROM people;

    Examples

    Example 1 - Inject IP address of the connected client into statements

    The location of the keytab file can be changed with the KRB5_KTNAME environment variable: keytab_def.html

    To take GSSAPI authentication into use, add the following to the listener.

    The principal name should be the same as on the MariaDB servers.

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: mariadb/localhost.localdomain

    The service principal name to send to the client. This parameter is a string parameter which is used by the client to request the token.

    This parameter must be the same as the principal name that the backend MariaDB server uses.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: Kerberos Default

    Keytab file location. This should be an absolute path to the file containing the keytab. If not defined, Kerberos will search from a default location, usually /etc/krb5.keytab. This path is set to an environment variable. This means that multiple listeners with GSSAPIAuth overrides each other. If using multiple GSSAPI authenticators, either do not set this option or use the same value for all listeners.

    Read the Authentication Modules document for more details on how authentication modules work in MaxScale.

    The GSSAPI plugin authentication starts when the database server sends the service principal name in the AuthSwitchRequest packet. The principal name will usually be in the form service@REALM.COM.

    The client searches its local cache for a token for the service or may request it from the GSSAPI server. If found, the client sends the token to the database server. The database server verifies the authenticity of the token using its keytab file and sends the final OK packet to the client.

    The GSSAPI authenticator modules require the GSSAPI development libraries (krb5-devel on CentOS 7).

    This page is licensed: CC BY-SA / Gnu FDL

    Overview

    Preparing the GSSAPI system

    GSSAPI Authentication Plugin
    authenticator=GSSAPIAuth
    authenticator_options=principal_name=mariadb/localhost.localdomain@EXAMPLE.COM
    authenticator_options=principal_name=mymariadb@EXAMPLE.COM,gssapi_keytab_path=/home/user/mymariadb.keytab

    Settings

    principal_name

    gssapi_keytab_path

    Implementation Details

    GSSAPI authentication

    Building the module

    list:
    • If the SQL in the prepared statement is larger than 1677723 bytes, the prepared statement will not be cached.

    • If the same SQL is prepared more than once at the same time, only one of them will succeed. This happens as the prepared statement reuse uses the SQL string in the comparison to detect if a statement is already prepared.

    This page is licensed: CC BY-SA / Gnu FDL

    Overview

    Configuration

    [PsReuse]
    type=filter
    module=psreuse
    
    [MyService]
    ...
    filters=PsReuse

    Limitations

    The SET TRANSACTION READ WRITE and START TRANSACTION READ WRITE statements are blocked by this filter. This is done as a safeguard against accidental removal of the read-only transaction mode. However, if the client disables the read-only mode directly via SET tx_read_only=0, the change is not detected by the filter and writes are possible.

    Given that the detection of writes is based on parsing and that parsing is not 100% effective in detecting all possible permutations of this statement (e.g. PREPARE and EXECUTE from user variables is not detected), this cannot be used to prevent a mischievous user from being able to turn off the read-only mode.

    This page is licensed: CC BY-SA / Gnu FDL

    [Read-Service]
    type=service
    router=readconnroute
    cluster=MyCluster
    filters=readonly

    Overview

    Configuration

    Limitations

    To enable PARSEC authentication on a listener, the authenticator list must include parsecauth.

    To only allow PARSEC authentication, use authenticator=parsecauth.

    This page is licensed: CC BY-SA / Gnu FDL

    This functionality is available from MaxScale 25.10.0.

    PARSEC Authenticator

    Configuration

    PARSEC
    user mapping file
    Ed25519 authenticator
    [Listener]
    type=listener
    address=127.0.0.1
    port=3306
    service=Service
    authenticator=mariadbauth,parsecauth
    CREATE USER 'monitor_user'@'%' IDENTIFIED BY 'my_password';
    [OptimisticTrx]
    type=filter
    module=optimistictrx
    
    [MyService]
    ...
    filters=OptimisticTrx
    maxctrl create filter OptimisticTrx optimistictrx
    maxctrl alter service-filter MyService OptimisticTrx

    Configuration

    Authentication

    Pages

    Dashboard

    Detail

    Visualization

    Settings

    Logs Archive

    Workspace

    1. Run Queries

    2. Data Migration

    3. Create an ERD

    Configuration Guide
    Configuration and Hardening
    JSON Web Tokens
    MaxScale object
    dashboard page
    mariadbmon
    Connecting to MaxScale using TLS with MaxCtrl
    admin_host
    admin_port
    MaxCtrl
    MaxGUI
    REST API

    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.

    By default this also installs the maxscale-maxctrl package, if available, which is the command line client for administering MaxScale. If you do not want it to be installed, use the following:

    • For RHEL/Rocky Linux/Alma Linux, use dnf install --setopt install_weak_deps=False maxscale.

    • For Debian and Ubuntu, run apt update followed by apt install --no-install-recommends maxscale.

    In order to use the maxctrl command line client, you'll need to install Node.js. The minimum required version is Node.js 10 but we recommend using the latest LTS release of Node.js.

    Download the correct MaxScale package for your CPU architecture and operating system from the . MaxScale can be installed with the following commands.

    • For RHEL/Rocky Linux/Alma Linux, use dnf install /path/to/maxscale-*.rpm

    • For Debian and Ubuntu, use apt install /path/to/maxscale-*.deb.

    • For SLES, use zypper install /path/to/maxscale-*.rpm.

    MaxScale can also be installed using a tarball. This may be required if you are using a Linux distribution for which there exist no installation package or if you want to install many different MaxScale versions side by side. For instructions on how to do that, please refer to .

    MaxScale assumes that memory allocations always succeed and in general does not check for memory allocation failures. This assumption is compatible with the Linux kernel parameter having the value 0, which is also the default on most systems.

    With vm.overcommit_memory being 0, memory allocations made by an application never fail, but instead the application may be killed by the so-called OOM (out-of-memory) killer if, by the time the application actually attempts to use the allocated memory, there is not available free memory on the system.

    If the value is 2, then a memory allocation made by an application may fail and unless the application is prepared for that possibility, it will likely crash with a SIGSEGV. As MaxScale is not prepared to handle memory allocation failures, it will crash in this situation.

    The current value of vm.overcommit_memory can be checked with this command:

    Alternatively, use this command:

    covers the first steps in configuring your MariaDB MaxScale installation. Follow this tutorial to learn how to configure and start using MaxScale.

    For a detailed list of all configuration parameters, refer to the and the module specific documents found in the .

    Read the section of the configuration guide to set up password encryption for the configuration file.

    There are various administration tasks that may be done with MariaDB MaxScale. A command line tools is available, , that interacts with a running MariaDB MaxScale and allows the status of MariaDB MaxScale to be monitored and give some control of the MariaDB MaxScale functionality.

    The covers the common administration tasks that need to be done with MariaDB MaxScale.

    The main configuration file for MaxScale is in /etc/maxscale.cnf and additional user-created configuration files are in /etc/maxscale.cnf.d/. Objects created or modified at runtime are stored in /var/lib/maxscale/maxscale.cnf.d/. Some modules also store internal data in /var/lib/maxscale/ named after the module or the configuration object.

    The simplest way to back up the configuration and runtime data of a MaxScale installation is to create an archive from the following files and directories:

    • /etc/maxscale.cnf

    • /etc/maxscale.cnf.d/

    • /var/lib/maxscale/

    This can be done with the following command:

    If MaxScale is configured to store data in custom locations, these should be included in the backup as well.

    This page is licensed: CC BY-SA / Gnu FDL

    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 MaxScale's REST API. 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.

    Enabling MaxGUI

    1. If you want to use MaxGUI remotely, configure the REST API for remote connections.

    Several global parameters must be configured in maxscale.cnf.

    Parameter
    Description

    For example:

    1. MaxGUI requires TLS, so you must Several global parameters must be configured in maxscale.cnf.

    Parameter
    Description

    For example:

    1. Ensure that the admin_gui global parameter is enable. It is enabled by default, so it will only be disabled if it was previously disabled manually.

    2. Restart the MaxScale instance.

    1. user with MaxCtrl:

    Replace maxscale_rest_admin and maxscale_rest_admin_password with the desired user and password.

    1. named admin with MaxCtrl:

    1. Visit MaxGUI in your web browser.

    For example:

    • If you were accessing it from local host with the default port, then you would visit this address:

    • If you were accessing it with the above example configuration, then you would visit this address:

    1. Enter your user and password to login.

    This page is: Copyright © 2026 MariaDB. All rights reserved.

    MaxScale Dependencies

    How to obtain the complete list of MariaDB MaxScale runtime dependencies on Debian, Ubuntu, RHEL, Rocky Linux, Alma Linux, SLES, and container images.

    MariaDB MaxScale does not require any external software at version-pinned ranges that you must track separately from the package itself. The platform packages (RPM, DEB) and the container image declare their runtime requirements through the standard packaging metadata, and your package manager resolves and installs the right versions for your operating system release.

    This page describes how to enumerate those dependencies on each supported platform, so you can answer questions such as "Which exact libraries does MaxScale link against on this host?" or "What needs to be available before I can install or upgrade?" without guessing.

    If you need a CycloneDX Software Bill of Materials (SBOM) for compliance purposes such as SOC 2, FedRAMP, or the EU Cyber Resilience Act, .

    Debian and Ubuntu

    Before installation, query the package's declared dependencies from the repository or a downloaded .deb file.

    # From the configured MariaDB repository
    apt-cache depends maxscale
    
    # Recursive (the full transitive dependency tree)
    apt-rdepends maxscale
    
    # From a downloaded .deb file
    dpkg-deb --info maxscale_*.deb | grep -E '^ (Depends|Recommends|Suggests):'

    After installation, inspect the installed package metadata:

    dpkg -s maxscale
    dpkg -s maxscale-common

    The Depends: and Recommends: lines list both the package-internal dependencies (for example, maxscale-common) and the system libraries pulled in by dpkg-shlibdeps at build time.

    Before installation:

    After installation:

    The Requires: entries cover both the internal maxscale-common dependency and the system libraries that rpmbuild detected as needed at link time.

    The commands match RHEL because SLES also uses RPM. The repository query uses zypper:

    For MariaDB-published MaxScale container images, the dependencies are baked into the image layers. Use either the standard Docker tooling or a scanner that understands image layers:

    syft and trivy produce CycloneDX 1.6 output covering all OS packages plus any bundled language-level dependencies (for example, the maxctrl and MaxGUI Node.js trees).

    To see exactly which shared libraries the running MaxScale binary and its loaded modules link against on a given host, use ldd:

    This is the most reliable way to answer "Does my host have everything MaxScale needs?" — ldd reports any unresolved symbols as not found.

    This page is licensed: CC BY-SA / Gnu FDL

    Connection Routing with MariaDB MaxScale

    Implement simple connection-based routing. This tutorial shows how to dedicate specific ports for write and read traffic using the readconnroute router.

    The goal of this tutorial is to configure a system that has two ports available, one for write connections and another for read connections. The read connections are load- balanced across replica servers.

    Setting up MariaDB MaxScale

    This tutorial is a part of the MariaDB MaxScale Tutorial. Please read it and follow the instructions. Return here once basic setup is complete.

    Configuring services

    We want two services and ports to which the client application can connect. One service routes client connections to the primary server, the other load balances between replica servers. To achieve this, we need to define two services in the configuration file.

    Create the following two sections in your configuration file. The section names are the names of the services and should be meaningful. For this tutorial, we use the names_Write-Service_ and Read-Service.

    [Write-Service]
    type=service
    router=readconnroute
    router_options=master
    servers=dbserv1, dbserv2, dbserv3
    user=maxscale
    password=maxscale_pw
    
    [Read-Service]
    type=service
    router=readconnroute
    router_options=slave
    servers=dbserv1, dbserv2, dbserv3
    user=maxscale
    password=maxscale_pw

    router defines the routing module used. Here we use readconnroute for connection-level routing.

    A service needs a list of servers to route queries to. The server names must match the names of server sections in the configuration file and not the hostnames or addresses of the servers.

    The router_options-parameter tells the readconnroute-module which servers it should route a client connection to. For the write service we use the master-type and for the read service the slave-type.

    The user and password parameters define the credentials the service uses to populate user authentication data. These users were created at the start of the .

    For increased security, see .

    To allow network connections to a service, a network ports must be associated with it. This is done by creating a separate listener section in the configuration file. A service may have multiple listeners but for this tutorial one per service is enough.

    The service parameter tells which service the listener connects to. For the_Write-Listener_ we set it to Write-Service and for the Read-Listener we set it to Read-Service.

    A listener must define the network port to listen on.

    The optional address-parameter defines the local address the listener should bind to. This may be required when the host machine has multiple network interfaces. The default behavior is to listen on all network interfaces (the IPv6 address ::).

    For the last steps, please return to .

    This page is licensed: CC BY-SA / Gnu FDL

    MaxScale Throttle Filter

    Regulate the rate of incoming queries. This filter prevents database overload by limiting the number of queries processed per second based on defined thresholds.

    Overview

    The throttle filter is used to limit the maximum query frequency (QPS - queries per second) of a database session to a configurable value. The main use cases are to prevent a rogue session (client side error) and a DoS attack from overloading the system.

    The throttling is dynamic. The query frequency is not limited to an absolute value. Depending on the configuration the throttle will allow some amount of high frequency queries, or especially short bursts with no frequency limitation.

    Configuration

    Basic Configuration

    [Throttle]
    type = filter
    module = throttlefilter
    max_qps = 500
    throttling_duration = 60000
    ...
    
    [Routing-Service]
    type = service
    filters = Throttle

    This configuration states that the query frequency will be throttled to around 500 qps, and that the time limit a query is allowed to stay at the maximum frequency is 60 seconds. All values involving time are configured in milliseconds. With the basic configuration the throttling will be nearly immediate, i.e. a session will only be allowed very short bursts of high frequency querying.

    When a session has been continuously throttled for throttling_duration milliseconds, or 60 seconds in this example, MaxScale will disconnect the session.

    Allowing high frequency bursts

    The two parameters max_qps and sampling_duration together define how a session is throttled.

    Suppose max qps is 400 qps and sampling duration is 10 seconds. Since QPS is not an instantaneous measure, but one could say it has a granularity of 10 seconds, we see that over the 10 seconds 10*400 = 4000 queries are allowed before throttling kicks in.

    With these values, a fresh session can start off with a speed of 2000 qps, and maintain that speed for 2 seconds before throttling starts.

    If the client continues to query at high speed and throttling duration is set to 10 seconds, Maxscale will disconnect the session 12 seconds after it started.

    • Type: number

    • Mandatory: Yes

    • Dynamic: Yes

    Maximum queries per second.

    This is the frequency to which a session will be limited over a given time period. QPS is not measured as an instantaneous value but over a configurable sampling duration (see sampling_duration).

    • Type:

    • Mandatory: Yes

    • Dynamic: Yes

    This defines how long a session is allowed to be throttled before MaxScale disconnects the session.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 250ms

    Sampling duration defines the window of time over which QPS is measured. This parameter directly affects the amount of time that high frequency queries are allowed before throttling kicks in.

    The lower this value is, the more strict throttling becomes. Conversely, the longer this time is, the longer bursts of high frequency querying is allowed.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 2s

    This value defines what continuous throttling means. Continuous throttling starts as soon as the filter throttles the frequency. Continuous throttling ends when no throttling has been performed in the past continuous_duration time.

    This page is licensed: CC BY-SA / Gnu FDL

    MaxScale Change Data Capture (CDC) users

    Manage user authentication for the legacy CDC protocol. This reference explains how to create, store, and manage user credentials for clients connecting to the CDC listener.

    Overview

    Change Data Capture (CDC) is a new MaxScale protocol that allows compatible clients to authenticate and register for Change Data Capture events. The new protocol must be use in conjunction with AVRO router which currently converts MariaDB binlog events into AVRO records. Clients connect to CDC listener and authenticate using credentials provided in a format described in the CDC Protocol documentation.

    Note: If no users are found in that file or if it doesn't exist, the only available user will be the service user:

    [avro-service]
    type=service
    router=avrorouter
    source=replication-service
    user=cdc_user
    password=cdc_password

    Creating new CDC users

    Starting with MaxScale 2.1, users can also be created through maxctrl:

    maxctrl call command cdc add_user <service> <name> <password>

    The should be the service name where the user is created. Older versions of MaxScale should use the cdc_users.py script.

    bash$ cdc_users.py [-h] USER PASSWORD

    The output of this command should be appended to the cdcusers file at/var/lib/maxscale/<service name>/.

    Users can be deleted by removing the related rows in 'cdcusers' file. For more details on the format of the cdcusers file, read the .

    This page is licensed: CC BY-SA / Gnu FDL

    Deploy MaxScale with Docker

    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.

    Before deploying MaxScale with Docker, ensure the following requirements are met:

    • Docker installed and running on your system

    • A MariaDB Enterprise subscription

    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.

    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.

    In versions 2.1.2 and earlier, the configuration files are limited to 1024 characters per line. This limitation was increased to 16384 characters in MaxScale 2.1.3. MaxScale 2.3.0 increased this limit to 16777216 characters.

    In versions 2.2.12 and earlier, the section names in the configuration files were limited to 49 characters. This limitation was increased to 1023 characters in MaxScale 2.2.13.

    Starting with MaxScale 2.4.0, on systems with Linux kernels 3.9 or newer due to the addition of SO_REUSEPORT support, it is possible for multiple MaxScale instances to listen on the same network port if the directories used by both instances are completely separate and there are no conflicts which can cause unexpected splitting of connections. This will only happen if users explicitly tell MaxScale to ignore the default directories and will not happen in normal use.

    The parser of MaxScale correctly parses

    Filters

    Explore the power of MaxScale filters. Learn to implement query logging statement rewriting and other processing steps in your request pipeline with practical examples.

    The filter mechanism in MariaDB MaxScale is a means by which processing can be inserted into the flow of requests and responses between the client connection to MariaDB MaxScale and the MariaDB MaxScale connection to the backend database servers. The path from the client side of MariaDB MaxScale out to the actual database servers can be considered a pipeline, filters can then be placed in that pipeline to monitor, modify, copy or block the content that flows through that pipeline.

    Filters can be divided into a number of categories

    Logging filters do not in any way alter the statement or results of the statements that are passed through MariaDB MaxScale. They merely log some information about some or all of the statements and/or result sets.

    Two examples of logging filters are contained within the MariaDB MaxScale, a filter that will log all statements and another that will log only a number of statements, based on the duration of the execution of the query.

    Statement rewriting filters modify the statements that are passed through the filter. This allows a filter to be used as a mechanism to alter the statements that are seen by the database, an example of the use of this might be to allow an application to remain unchanged when the underlying database changes or to compensate for the migration from one database schema to another.

    MaxScale Maxrows Filter

    Limit the size of result sets returned to clients. This filter prevents excessive resource consumption by truncating results that exceed a configured row count.

    The Maxrows filter is capable of restricting the amount of rows that a SELECT, a prepared statement or stored procedure could return to the client application.

    If a resultset from a backend server has more rows than the configured limit or the resultset size exceeds the configured size, an empty result will be sent to the client.

    The Maxrows filter is easy to configure and to add to any existing service.

    The Maxrows filter has no mandatory parameters. Optional parameters are:

    • Type: number

    spinner
    spinner
    spinner
    spinner
    spinner
    spinner
    spinner
    spinner
    spinner
    spinner
    spinner
    spinner
    spinner
    spinner
    spinner
    spinner
    spinner
    spinner
    admin_host
    admin_port
    admin_ssl_key
    admin_ssl_cert
    admin_ssl_ca_cert
    spinner
    spinner
    spinner
    spinner
    spinner
    spinner
    spinner
    spinner
    spinner
    spinner

    Settings

    max_qps

    throttling_duration

    sampling_duration

    continuous_duration

    duration
    duration
    duration
    spinner
    For SLES, use
    zypper install --no-recommends maxscale
    .

    Install MariaDB MaxScale From a RPM/DEB Package

    Install MariaDB MaxScale Using a Tarball

    Assumptions

    Memory allocation behavior

    Configuring MariaDB MaxScale

    Encrypting Passwords

    Administration Of MariaDB MaxScale

    Copying or Backing Up MaxScale

    MariaDB Downloads page
    Install MariaDB MaxScale using a Tarball
    vm.overcommit_memory
    The MaxScale Tutorial
    Configuration Guide
    reference
    Encrypting Passwords
    maxctrl
    administration tutorial
    spinner

    admin_host

    • This parameter defines the network address that the REST API listens on.• The default value is 127.0.0.1.

    admin_port

    • This parameter defines the network port that the REST API listens on.• The default value is 8989.

    admin_ssl_key

    * This parameter defines the private key used by the REST API.

    admin_ssl_cert

    * This parameter defines the certificate used by the REST API.

    admin_ssl_ca_cert

    *This parameter defines the CA certificate that signed the REST API's certificate.

    enable TLS for MaxScale's REST API
    Create a new admin REST API
    Delete the default REST API
    127.0.0.1:8989
    192.168.2.100:8443
    spinner

    RHEL, Rocky Linux, and Alma Linux

    SLES

    Container images

    Shared library dependencies

    contact MariaDB Support

    Configuring the Listener

    Starting MariaDB MaxScale

    MaxScale Tutorial
    password encryption
    MaxScale Tutorial
    spinner
    CDC Protocol documentation
    spinner
    WITH
    statements, but fails to collect columns, functions and tables used in the
    SELECT
    defining the
    WITH
    clause.

    Consequently, the database firewall will not block WITH statements where the SELECT of the WITH clause refers to forbidden columns.

    MaxScale assumes that certain configuration parameters in MariaDB are set to their default values. These include but are not limited to:

    • autocommit: Autocommit is enabled for all new connections.

    • tx_read_only: Transactions use READ WRITE permissions by default.

    If a module in MaxScale requires tracking of transaction boundaries but does not require query classification, a custom parser is used to detect them. Currently the only situation in which this parser is used is when a readconnroute service uses the cache filter.

    The custom parser detects a subset of the full SQL syntax used to start transactions. This means that more complex statements will not be fully parsed and will cause the transaction state to not match the real state on the database. For example, SET @my_var = (SELECT 1), autocommit = 0 is not parsed by the custom parser and causes the autocommit modification to not be noticed.

    MaxScale will treat statements executed after XA START and before XA END as if they were executed in a normal read-write transaction started with START TRANSACTION. This means that only XA transactions in the ACTIVE state will be routed as transactions and all statements after XA END are routed normally.

    XA transactions and normal transactions are mutually exclusive in MariaDB. This means that a START TRANSACTION command will fail if the connection already has an open XA transaction. MaxScale currently only inspects the SQL and deduces the transaction state from that. If a transaction fails to start due to an open XA transaction, the state in MaxScale and in MariaDB can be different and MaxScale will keep routing statements as if they were inside of a transaction. However, as this is an unlikely scenario, usually no action needs to be taken.

    For its proper functioning, MaxScale needs in general to be aware of the transaction state and autocommit mode. In order to be that, MaxScale parses statements going through it.

    However, if a transaction is committed or rolled back, or the autocommit mode is changed using a prepared statement, MaxScale will miss that and its internal state will be incorrect, until the transaction state or autocommit mode is changed using an explicit statement.

    For instance, after the following sequence of commands, MaxScale will still think autocommit is on:

    To ensure that MaxScale functions properly, do not commit or rollback a transaction or change the autocommit mode using a prepared statement.

    • 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. Killing a connection with COM_PROCESS_KILL is supported and is recommended as it's more efficient.

    • A KILL on one service can cause a connection from another service to be closed even if it uses a different protocol. This is because session IDs are allocated from one global pool across all protocols and services.

    • If a COM_CHANGE_USER succeeds on MaxScale yet fails on the server the session ends up in an inconsistent state. This can happen if the password of the target user is changed and MaxScale uses old user account data when processing the change user. In such a situation, MaxScale and server will disagree on the current user. This can affect e.g. reconnections.

    • MySQL old style passwords are not supported. MySQL versions 4.1 and newer use a new authentication protocol which does not support pre-4.1 style passwords.

    • When users have different passwords based on the host from which they connect MariaDB MaxScale is unable to determine which password it should use to connect to the backend database. This results in failed connections and unusable usernames in MariaDB MaxScale.

    The Tee filter does not support binary protocol prepared statements. The execution of a prepared statements through a service that uses the tee filter is not guaranteed to succeed on the service where the filter branches to as it does on the original service.

    This possibility exists due to the fact that the binary protocol prepared statements are identified by a server-generated ID. The ID sent to the client from the main service is not guaranteed to be the same that is sent by the branch service.

    A server can only be monitored by one monitor. Two or more monitors monitoring the same server is considered an error.

    The default master selection is based only on MIN(wsrep_local_index). This can be influenced with the server priority mechanic described in the Galera Monitor manual.

    Refer to individual router documentation for a list of their limitations.

    The ETL feature in MaxScale always uses the MariaDB Connector/ODBC driver to perform the data loading into MariaDB. The recommended minimum version of the connector is 3.1.18. Older versions of the driver suffer from problems that may manifest as crashes or memory leaks. The driver must be installed on the system in order for the ETL feature to work.

    The data loading into MariaDB is done with autocommit, unique_checks and foreign_key_checks disabled inside of a single transaction. This is done to leverage the optimizations done for InnoDB that allows faster insertions into empty tables. When loading data into MariaDB versions 10.5 or older, this can translate into long rollback times in case the ETL operation fails.

    For ETL operations that migrate data from PostgreSQL, we recommend using the official PostgreSQL ODBC driver. Use of other PostgreSQL ODBC drivers is possible but not recommended: correct configuration of the driver is necessary to prevent the driver from consuming too much memory.

    • Triggers on tables are not migrated automatically.

    • Check constraints are defined using the native PostgreSQL syntax. Incompatibilities must be manually fixed.

    • All indexes specific to PostgreSQL will be converted into normal indexes in MariaDB.

    • The GEOMETRY type is assumed to be the type provided by PostGIS. It is converted into a MariaDB GEOMETRY type and is extracted using ST_AsText.

    It is the responsibility of the end-user to correctly configure the ODBC driver. Some drivers read the whole resultset into memory by default which will result in MaxScale running out of memory

    • ETL operations that operate on more than one catalog are not supported.

    This page is licensed: CC BY-SA / Gnu FDL

    Limitations and Known Issues within MariaDB MaxScale

    Configuration limitations

    Multiple MaxScales on same server

    Security limitations

    MariaDB 10.2

    MariaDB Default Values

    Query Classification

    Transaction Boundary Detection

    XA Transactions

    Prepared Statements

    Protocol limitations

    Limitations with MySQL/MariaDB Protocol support (MariaDBClient)

    Authenticator limitations

    Limitations in the MySQL authenticator (MariaDBAuth)

    Filter limitations

    Tee filter limitations (tee)

    Monitor limitations

    Limitations with Galera Cluster Monitoring (galeramon)

    Router limitations

    ETL Limitations

    ETL Limitations with PostgreSQL as the Source

    Limitations in Automatic SQL Generation

    ETL Limitations with Generic ODBC Targets

    spinner

    A result set manipulation filter is very similar to a statement rewriting but applies to the result set returned rather than the statement executed. An example of this may be obfuscating the values in a column.

    Routing hint filters are filters that embed hints in the request that can be used by the router onto which the query is passed. These hints include suggested destinations as well as metric that may be used by the routing process.

    A firewall filter is a mechanism that allows queries to be blocked within MariaDB MaxScale before they are sent on to the database server for execution. They allow constructs or individual queries to be intercepted and give a level of access control that is more flexible than the traditional database grant mechanism.

    A pipeline filter is one that has an affect on how the requests are routed within the internal MariaDB MaxScale components. The most obvious version of this is the ability to add a "tee" connector in the pipeline, duplicating the request and sending it to a second MariaDB MaxScale service for processing.

    Filters are defined in the configuration file, typically maxscale.cnf, using a section for each filter instance. The content of the filter sections in the configuration file various from filter to filter, however there are always to entries present for every filter, the type and module.

    The type is used by the configuration manager within MariaDB MaxScale to determine what this section is defining and the module is the name of the plugin that implements the filter.

    When a filter is used within a service in MariaDB MaxScale the entry filters= is added to the service definition in the ini file section for the service. Multiple filters can be defined using a syntax akin to the Linux shell pipe syntax.

    The names used in the filters= parameter are the names of the filter definition sections in the ini file. The same filter definition can be used in multiple services and the same filter module can have multiple instances, each with its own section in the ini file.

    The filters that are bundled with the MariaDB MaxScale are documented separately, in this section a short overview of how these might be used for some simple tasks will be discussed. These are just examples of how these filters might be used, other filters may also be easily added that will enhance the MariaDB MaxScale functionality still further.

    The top filter can be used to measure the execution time of every statement within a connection and log the details of the longest running statements.

    The first thing to do is to define a filter entry in the ini file for the top filter. In this case we will call it "top30". The type is filter and the module that implements the filter is called topfilter.

    In the definition above we have defined two filter specific parameters, the count of the number of statement to be logged and a filebase that is used to define where to log the information. This filename is a stem to which a session id is added for each new connection that uses the filter.

    The filter keeps track of every statement that is executed, monitors the time it takes for a response to come back and uses this as the measure of execution time for the statement. If the time is longer than the other statements that have been recorded, then this is added to the ordered list within the filter. Once 30 statements have been recorded those statements that have been recorded with the least time are discarded from the list. The result is that at any time the filter has a list of the 30 longest running statements in each session.

    When the session ends a report will be written for the session into the logfile defined. That report will include the top 30 longest running statements, plus summary data for the session;

    • The time the connection was opened.

    • The host the connection was from.

    • The username used in the connection.

    • The duration of the connection.

    • The total number of statements executed in the connection.

    • The average execution time for a statement in this connection.

    This page is licensed: CC BY-SA / Gnu FDL

    What Are Filters?

    Types Of Filter

    Logging filters

    Statement rewriting filters

    Result set manipulation filters

    Routing hint filters

    Firewall filters

    Pipeline control filters

    Filter Definition

    Filter Examples

    Log The 30 Longest Running Queries

    spinner

    Mandatory: No

  • Dynamic: Yes

  • Default: (no limit)

  • Specifies the maximum number of rows a resultset can have in order to be returned to the user.

    If a resultset is larger than this an empty result will be sent instead.

    • Type: size

    • Mandatory: No

    • Dynamic: Yes

    • Default: 64Ki

    Specifies the maximum size a resultset can have in order to be sent to the client. A resultset larger than this, will not be sent: an empty resultset will be sent instead.

    • Type: enum

    • Mandatory: No

    • Dynamic: Yes

    • Values: empty, error, ok

    • Default: empty

    Specifies what the filter sends to the client when the rows or size limit is hit, possible values:

    • an empty result set

    • an error packet with input SQL

    • an OK packet

    Example output with ERR packet:

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0

    An integer value, using which the level of debug logging made by the Maxrows filter can be controlled. The value is actually a bitfield with different bits denoting different logging.

    • 0 (0b00000) No logging is made.

    • 1 (0b00001) A decision to handle data form server is logged.

    • 2 (0b00010) Reached max_resultset_rows or max_resultset_size is logged.

    To log everything, give debug a value of 3.

    Here is an example of filter configuration where the maximum number of returned rows is 10000 and maximum allowed resultset size is 256KB

    This page is licensed: CC BY-SA / Gnu FDL

    Overview

    Configuration

    Settings

    max_resultset_rows

    max_resultset_size

    max_resultset_return

    debug

    Example Configuration

    spinner
    sysctl vm.overcommit_memory
    cat /proc/sys/vm/overcommit_memory
    tar -caf maxscale-backup.tar.gz /etc/maxscale.cnf /etc/maxscale.cnf.d/ /var/lib/maxscale/
    [maxscale]
    ...
    admin_host            = 0.0.0.0
    admin_port            = 8443
    [maxscale]
    ...
    admin_ssl_key=/certs/server-key.pem
    admin_ssl_cert=/certs/server-cert.pem
    admin_ssl_ca_cert=/certs/ca-cert.pem
    $ sudo systemctl restart maxscale
    $ maxctrl --secure 
       --user=admin 
       --password=mariadb 
       --hosts=192.0.2.100:8443
       --tls-key=/certs/client-key.pem 
       --tls-cert=/certs/client-cert.pem 
       --tls-ca-cert=/certs/ca.pem 
       create user "maxscale_rest_admin" "maxscale_rest_admin_password" --type=admin
    $ maxctrl --secure 
       --user=maxscale_rest_admin 
       --password=maxscale_rest_admin_password 
       --hosts=192.0.2.100:8443
       --tls-key=/certs/client-key.pem 
       --tls-cert=/certs/client-cert.pem 
       --tls-ca-cert=/certs/ca.pem 
       destroy user "admin"
    # From the configured MariaDB repository
    dnf repoquery --requires maxscale
    dnf repoquery --requires --resolve maxscale       # show concrete package versions
    
    # From a downloaded .rpm file
    rpm -qpR /path/to/maxscale-*.rpm
    rpm -qi maxscale
    rpm -qR maxscale
    rpm -qR maxscale-common
    zypper info --requires maxscale
    rpm -qR maxscale
    # Inspect image labels and history
    docker image inspect mariadb/maxscale:latest
    docker image history mariadb/maxscale:latest
    
    # Generate an SBOM from the running image (no MariaDB tooling required)
    syft mariadb/maxscale:latest -o cyclonedx-json
    trivy image --format cyclonedx mariadb/maxscale:latest
    ldd /usr/bin/maxscale
    ldd /usr/lib/*/maxscale/*.so       # adjust path for your distribution layout
    [Write-Listener]
    type=listener
    service=Write-Service
    port=3306
    
    [Read-Listener]
    type=listener
    service=Read-Service
    port=3307
    bash$ cdc_users.py user1 pass1 >> /var/lib/maxscale/avro-service/cdcusers
    SET autocommit=1
    PREPARE hide_autocommit FROM "SET autocommit=0"
    EXECUTE hide_autocommit
    [MyFilter]
    type=filter
    module=xxxfilter
    [Split-Service]
    type=service
    router=readwritesplit
    servers=dbserver1,dbserver2,dbserver3,dbserver4
    user=massi
    password=6628C50E07CCE1F0392EDEEB9D1203F3
    filters=hints | top10
    [top30]
    type=filter
    module=topfilter
    count=30
    filebase=/var/log/DBSessions/top30
    [MaxRows]
    type=filter
    module=maxrows
    
    [MaxRows-Routing-Service]
    type=service
    ...
    filters=MaxRows
    max_resultset_rows=1000
    max_resultset_size=128Ki
    MariaDB [(test)]> select * from test.t4;
    ERROR 1415 (0A000): Row limit/size exceeded for query: select * from test.t4
    debug=2
    [MaxRows]
    type=filter
    module=maxrows
    max_resultset_rows=10000
    max_resultset_size=256000

    Your MariaDB Enterprise token and account credentials

    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.

    1. Log in to the MariaDB Customer Portal.

    2. Locate your Customer Download Token.

    3. Copy the token to use for authentication when logging in to Docker.

    As a best practice, ensure that your token is stored securely.

    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.

    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 latest MaxScale image using docker pull:

    Or pull a specific version:

    The default setup of MaxScale, which just activates the REST API, is used by this command:

    For a quick start that includes database proxy port access:

    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.

    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

    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:

    Before starting the container:

    1. Create a directory on your system to store the configuration file.

    2. Place your-maxscale.cnf file in this directory.

    3. The container will mount this directory in order to enable persistent configuration.

    Create a custom MaxScale configuration file and mount it into the container:

    If you need to modify the maxscale section, override the main configuration file:

    To access the running the container's shell:

    After starting the container, verify that MaxScale is running correctly. Check the container status by executing the below command:

    To stop the running container, use:

    Delete the container after use with the following command:

    This page is licensed: CC BY-SA / Gnu FDL

    Overview

    Prerequisites

    echo "<ENTERPRISE_TOKEN>" | docker login docker.mariadb.com -u <your-mariadb.id-email> --password-stdin
    docker pull docker.mariadb.com/maxscale:latest
    docker pull docker.mariadb.com/maxscale:25.01.1
    docker run -d -p 8989:8989 --name mxs docker.mariadb.com/maxscale:latest
    ## Authenticate, pull, and run in one sequence
    echo "<ENTERPRISE_TOKEN>" | docker login docker.mariadb.com -u <your-mariadb.id-email> --password-stdin
    docker pull docker.mariadb.com/maxscale:latest
    docker run -d -p 3306:3306 -p 8989:8989 --name mxs docker.mariadb.com/maxscale:latest
    docker run -d -p 3306:3306 -p 8989:8989 --name mxs docker.mariadb.com/maxscale:latest
    curl -u admin:mariadb http://localhost:8989/v1/maxscale
    docker run -d -p 8989:8989 --name mxs -v /path/to/your-maxscale.cnf:/etc/maxscale.cnf.d/custom.cnf docker.mariadb.com/maxscale:latest
    docker run -d -p 8989:8989 --name mxs -v /path/to/your-maxscale.cnf:/etc/maxscale.cnf.d docker.mariadb.com/maxscale:latest
    docker exec -it mxs bash
    docker ps --filter "name=mxs"
    docker stop mxs
    docker rm mxs

    Authenticate to the MariaDB Enterprise Registry

    Obtain Customer Download Token

    Log in to Docker Registry

    Available Image Tags

    Pull the MaxScale Image

    Run MaxScale in a Container

    Basic Example

    Quick Start Example

    Configure MaxScale

    Default Configuration

    Basic Container Setup

    Using a Custom Configuration File

    Overriding the Default Configuration

    Access the Container

    Verify MaxScale is Running

    Managing the Container

    Stop the Container

    Remove the Container

    MaxScale Trial

    Evaluate MariaDB MaxScale with the free Trial version. Learn about its features and installation steps, limited only by a license key.

    MariaDB MaxScale offers a free Trial version with a flexible, license-key based evaluation period. This free version allows users to explore the latest GA features of MaxScale under a proprietary license.

    Unlike previous versions, access to this trial is now managed via a specific license key. This key determines the duration of your evaluation period, providing a hands-on way to test MaxScale’s capabilities and performance within your environment before committing to an enterprise subscription.

    The next section explains how to obtain your license key.

    Getting the License Key

    To use MaxScale 25.10.3 Trial mode, you must first obtain a trial license key from the MariaDB Customer Portal. This key validates your trial and determines the duration of your evaluation period.

    1. Log in to MariaDB ID: Navigate to the . You will be prompted to sign in with your MariaDB ID. If you do not have an account, you can create one using your email, Google, GitHub, or LinkedIn credentials.

    2. Generate the Key: Once logged in, follow the on-screen instructions to generate your unique MaxScale Trial license key.

    3. Save the Key: Copy or download the generated key. You will need to provide this key during the MaxScale configuration process.

    MaxScale Trial can be downloaded from the page. Choose the correct version for your OS.

    The downloaded file is a tar-package that must be extracted. Create a directory and extract the package into that.

    The filename will be different for different OSs.

    The extracted tar contains 6 packages.

    • maxscale-common_25.10.3~noble-1_amd64.deb

    • maxscale-trial_25.10.3~noble-1_amd64.deb

    • maxscale-maxctrl_25.10.3~noble-1_amd64.deb

    Also these filenames will be different depending on the OS.

    • maxscale-common contains common components used by the other packages, except for maxscale-maxctrl.

    • maxscale-trial contains MaxScale itself.

    NOTE If you have an earlier MaxScale Trial version, please uninstall it first.

    Enter the directory where the tar-package was extracted and execute on a Debian based system

    and on a RedHat based system

    When the MaxScale Trial package has been installed, a template MaxScale configuration file will be copied to /etc/maxscale.cnf.template and /etc/maxscale.cnf; the former for reference and the latter for actual use. The configuration file has been written with the assumption that a MariaDB server is running on the same machine where MaxScale is installed.

    Before starting MaxScale, the license key must be specified and the database users needed by MaxScale must be created.

    Open /etc/maxscale.cnf and add a license_key entry to the [maxscale] section.

    The value of license_key can either be the license key itself or the absolute path to a file containing the license.

    NOTE If the license is read from a file, it must be readable by the user maxscale.

    MaxScale needs two database users for its own use; one user used by a MaxScale for fetching user account information and another user used by the MaxScale for monitoring the health of the MariaDB server and for performing operations on it. The same user can be used for both purposes, provided the user has all the grants needed by services and monitors.

    In the following, the host is specified using '%', which means that MaxScale can access the server from anywhere. In a non-trial context, it is advisable to use the specific IP where MaxScale is running.

    If you use the same user names and passwords - that is, service_user/service_pw and monitor_user/monitor_pw - you do not need to modify /etc/maxscale.cnf. Otherwise the user names and passwords must be updated accordingly.

    Service User

    The service user can be created with the following commands, executed using the mariadb command line utility.

    Monitor User

    Creating the monitor user is more complicated, because the required GRANTs depend both on what monitor is used and on the exact server version. The GRANTs needed by the MariaDB Monitor, used for monitoring a regular MariaDB primary/replica cluster can be found , but for initial testing the user can be given blanket rights:

    In a non-trial context, the monitor user should be granted only the GRANTs it really needs.

    The command line utility maxctrl and the web UI MaxGUI communicate with MaxScale using a REST-API. By default, MaxGUI requires that TLS is enabled and it is configured as explained .

    Alternatively, the requirement of TLS can be turned off by adding the entry

    to the [maxscale] section in the MaxScale configuration file.

    Please note that unless TLS is configured, your administrative credentials will be exposed in plain text over the network. Not using TLS should only be in a trial context in a controlled environment.

    Once the database users have been created, MaxScale Trial can be started.

    If no errors are shown by the command, which indicates that MaxScale started, the error log of MaxScale should be checked.

    If there are no error entries, MaxScale is running and can be used.

    Smoketests

    With the following command it can be checked that MaxScale can connect to the server

    and with the following command that the service is running

    If TLS has been configured, the secure mode must be enabled with the flag --secure and the relevant parameters provided using the --tls... flags. Invoke maxctrl with the flag --help for the details.

    After that the web-browser can be pointed to . Logging in is done using the username admin and the password mariadb. If TLS has not been disabled by the setting admin_secure_gui=false, https must be used.

    Note that by default MaxScale listens only on the interface 127.0.0.1, which means that you must access MaxScale from the same machine on which MaxScale is running. If you want to access MaxScale over the network, you need to add

    to the [maxscale] section in /etc/maxscale.cnf.

    The configuration file of MaxScale Trial is 100% compatible with MaxScale. To replace MaxScale Trial with MaxScale, the following steps are needed:

    • Uninstall MaxScale Trial.

    • Install MaxScale 25.10.3 or higher.

    Although the uninstallation of MaxScale Trial will not cause the configuration file to be erased, it is recommended to make a backup of it before the operation.

    It is not possible to have MaxScale Trial and MaxScale installed simultaneously on the same machine.\

    This page is: Copyright © 2026 MariaDB. All rights reserved.

    MaxScale Binlog Filter

    Selectively replicate binary log events to replica servers. This filter uses regex matching to include or exclude specific events from the replication stream.

    Overview

    The binlogfilter can be combined with a binlogrouter service to selectively replicate the binary log events to replica servers.

    The filter uses two settings, match and exclude, to determine which events are replicated. If a binlog event does not match or is excluded, the event is replaced with an empty data event. The empty event is always 35 bytes which translates to a space reduction in most cases.

    When statement-based replication is used, any query events that are filtered out are replaced with a SQL comment. This causes the query event to do nothing and thus the event will not modify the contents of the database. The GTID position of the replicating database will still advance which means that downstream servers replicating from it keep functioning correctly.

    The filter works with both row based and statement based replication but we recommend using row based replication with the binlogfilter. This guarantees that there are no ambiguities in the event filtering.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    Include queries that match the regex. See next entry, exclude, for more information.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    Exclude queries that match the regex.

    If neither match nor exclude are defined, the filter does nothing and all events are replicated. This filter does not accept regular expression options as a separate setting, such settings must be defined in the patterns themselves. See the for more information.

    The two settings are matched against the database and table name concatenated with a period. For example, the string the patterns are matched against for the database test and table t1 is test.t1.

    For statement based replication, the pattern is matched against all the tables in the statements. If any of the tables matches the match pattern, the event is replicated. If any of the tables matches the exclude pattern, the event is not replicated.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    See the next entry, rewrite_dest, for more information.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    rewrite_src and rewrite_dest control the statement rewriting of the binlogfilter. The rewrite_src setting is a PCRE2 regular expression that is matched against the default database and the SQL of statement based replication events (query events). rewrite_dest is the replacement string which supports the normal PCRE2 backreferences (e.g the first capture group is $1, the second is $2, etc.).

    Both rewrite_src and rewrite_dest must be defined to enable statement rewriting.

    When statement rewriting is enabled must be used. The filter will disallow replication for all replicas that attempt to replicate with traditional file-and-position based replication.

    The replacement is done both on the default database as well as the SQL statement in the query event. This means that great care must be taken when defining the rewriting rules. To prevent accidental modification of the SQL into a form that is no longer valid, use database and table names that never occur in the inserted data and is never used as a constant value.

    With the following configuration, only events belonging to database customers are replicated. In addition to this, events for the table orders are excluded and thus are not replicated.

    For more information about the binlogrouter and how to use it, refer to the .

    This page is licensed: CC BY-SA / Gnu FDL

    MaxScale Ed25519 Authenticator

    Implement high-security authentication using Ed25519 signatures. This guide explains how to configure the ed25519auth module and handle backend authentication via user mapping.

    Overview

    Ed25519 is a highly secure authentication method based on public key cryptography. It is used with the auth_ed25519 plugin of MariaDB Server.

    When a client authenticates via ed25519, MaxScale first sends them a random message. The client signs the message using their password as private key and sends the signature back. MaxScale then checks the signature using the public key fetched from the mysql.user table. The client password or an equivalent token is never exposed. For more information, see the documentation.

    The security of this authentication scheme presents a problem for a proxy such as MaxScale since MaxScale needs to log in to backend servers on behalf of the client. Since each server generates their own random messages, MaxScale cannot simply forward the original signature. Either the real password is required, or a different authentication scheme must be used between MaxScale and backends. The MaxScale ed25519auth plugin supports both alternatives.

    To begin, add ed25519auth to the list of authenticators for a listener.

    MaxScale now authenticates incoming clients with ed25519 if their user account has plugin set to ed25519 in the mysql.user table. However, routing queries will fail since MaxScale cannot authenticate to backends. To continue, either use a mapping file or enable sha256 mode. Sha256 mode is enabled with the following settings.

    This setting defines the authentication mode used. Two values are supported:

    • ed25519 (default) Digital signature based authentication. Requires mapping for backend support.

    • sha256 Authenticate client with caching_sha2_password plugin instead. Requires either SSL or configured RSA keys.

    Defines the RSA keys used for encrypting the client password if SSL is not in use. Should point to files with the private and public keys.

    To enable MaxScale to authenticate to backends, can be used. The mapping and backend passwords are given in a JSON file. The client can map to an identical username or to another user, and the backend authentication scheme can be something else than ed25519.

    The following example maps user "alpha" to "beta" and MaxScale then uses standard authentication to log into backends as "beta". User "alpha" authenticates to MaxScale using whatever method configured in the server. User "gamma" does not map to another user, just the password is given.

    MaxScale configuration:

    /home/joe/mapping.json:

    The mapping-based solution requires the DBA to maintain a file with user passwords, which has security and upkeep implications. To avoid this, MaxScale can instead use the caching_sha2_password plugin to authenticate the client. This authentication scheme transmits the client password to MaxScale in full, allowing MaxScale to log into backends using ed25519. MaxScale effectively lies to the client about its authentication plugin and then uses the correct plugin with the backends. Enable sha256 authentication by setting authentication option ed_mode to sha256.

    Sha256 authentication is best used with encrypted connections. The example below shows a listener configured for sha256 mode and SSL.

    If SSL is not in use, caching_sha2_password transmits the password using RSA-encryption. In this case, MaxScale needs the public and private RSA-keys. MaxScale sends the public key to the client if they don't already have it and the client uses it to encrypt the password. MaxScale then uses the private key to decrypt the password. The example below shows a listener configured for sha256 mode without SSL.

    The key files can be generated with OpenSSL using the following commands.

    This page is licensed: CC BY-SA / Gnu FDL

    MaxScale Consistent Critical Read Filter

    Ensure data consistency by routing reads to the primary server after a write. This filter guarantees that a client sees its own modifications immediately.

    Overview

    The Consistent Critical Read (CCR) filter allows consistent critical reads to be done through MaxScale while still allowing scaleout of non-critical reads.

    When the filter detects a statement that would modify the database, it attaches a routing hint to all following statements done by that connection. This routing hint guides the routing module to route the statement to the primary server where data is guaranteed to be in an up-to-date state. Writes from one session do not, by default, propagate to other sessions.

    Note: This filter does not work with prepared statements. Only text protocol queries are handled by this filter.

    Controlling the Filter with SQL Comments

    The triggering of the filter can be limited further by adding MaxScale supported comments to queries and/or by using regular expressions. The query comments take precedence: if a comment is found it is obeyed even if a regular expression parameter might give a different result. Even a comment cannot cause a SELECT-query to trigger the filter. Such a comment is considered an error and ignored.

    The comments must follow the and the HintFilter needs to be in the filter chain before the CCR-filter. If a query has a MaxScale supported comment line which defines the parameter ccr, that comment is caught by the CCR-filter. Parameter values match and ignore are supported, causing the filter to trigger (match) or not trigger (ignore) on receiving the write query. For example, the query

    would normally cause the filter to trigger, but does not because of the comment. The match-comment typically has no effect, since write queries by default trigger the filter anyway. It can be used to override an ignore-type regular expression that would otherwise prevent triggering.

    The CCR filter has no mandatory parameters.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 60s

    The time window during which queries are routed to the primary. The duration value will always be rounded to the nearest second. If no explicit unit has been specified, the value is interpreted as seconds in MaxScale 2.4. In subsequent versions a value without a unit may be rejected. The default value for this parameter is 60 seconds.

    When a data modifying SQL statement is processed, a timer is set to the value time. Once the timer has elapsed, all statements are routed normally. If a new data modifying SQL statement is processed within the time window, the timer is reset to the value of time.

    Enabling this parameter in combination with the count parameter causes both the time window and number of queries to be inspected. If either of the two conditions are met, the query is re-routed to the primary.

    • Type: count

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0

    The number of SQL statements to route to primary after detecting a data modifying SQL statement. This feature is disabled by default.

    After processing a data modifying SQL statement, a counter is set to the value of count and all statements are routed to the primary. Each executed statement after a data modifying SQL statement cause the counter to be decremented. Once the counter reaches zero, the statements are routed normally. If a new data modifying SQL statement is processed, the counter is reset to the value of count.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    These control which statements trigger statement re-routing. Only non-SELECT statements are inspected. For CCRFilter, the exclude-parameter is instead named ignore, yet works similarly.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    See documentation for .

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: ignorecase

    Regular expression options for match and ignore.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    global is a boolean parameter that when enabled causes writes from one connection to propagate to all other connections. This can be used to work around cases where one connection writes data and another reads it, expecting the write done by the other connection to be visible.

    This parameter only works with the time parameter. The use of global andcount at the same time is not allowed and will be treated as an error.

    Here is a minimal filter configuration for the CCRFilter which should solve most problems with critical reads after writes.

    With this configuration, whenever a connection does a write, all subsequent reads done by that connection will be forced to the primary for 5 seconds.

    This prevents read scaling until the modifications have been replicated to the replicas. For best performance, the value of time should be slightly greater than the actual replication lag between the primary and its replicas. If the number of critical read statements is known, the count parameter could be used to control the number reads that are sent to the primary.

    This page is licensed: CC BY-SA / Gnu FDL

    MaxScale Hintfilter

    Control query routing using SQL comments. This filter interprets hints embedded in queries to direct traffic to specific servers, primaries, or replicas.

    Overview

    Hint Syntax

    Note: If a query has more than one comment only the first comment is processed. Always place any MaxScale related comments first before any other comments that might appear in the query.

    Comments and comment types

    The client connection will need to have comments enabled. For example the mariadb and mysql command line clients have comments disabled by default and they need to be enabled by passing the --comments or -c option to it. Most, if not all, connectors keep all comments intact in executed queries.

    # The --comments flag is needed for the command line client
    mariadb --comments -u my-user -psecret -e "SELECT @@hostname -- maxscale route to server db1"

    For comment types, use either -- (notice the whitespace after the double hyphen) or # after the semicolon or /* ... */ before the semicolon.

    Inline comment blocks, i.e. /* .. */, do not require a whitespace character after the start tag or before the end tag but adding the whitespace is advised.

    All hints must start with the maxscale tag.

    The hints have two types, ones that define a server type and others that contain name-value pairs.

    These hints will instruct the router to route a query to a certain type of a server.

    Route to primary

    A master value in a routing hint will route the query to a primary server. This can be used to direct read queries to a primary server for a up-to-date result with no replication lag.

    Route to replica

    A slave value will route the query to a replica server. Please note that the hints will override any decisions taken by the routers which means that it is possible to force writes to a replica server.

    Route to named server

    A server value will route the query to a named server. The value of<server name> needs to be the same as the server section name in maxscale.cnf. If the server is not used by the service, the hint is ignored.

    Route to last used server

    A last value will route the query to the server that processed the last query. This hint can be used to force certain queries to be grouped to the same server.

    Name-value hints

    These control the behavior and affect the routing decisions made by the router. Currently the only accepted parameter is the readwritesplit parametermax_slave_replication_lag. This will route the query to a server with a lower replication lag than this parameter's value.

    Hints can be either single-use hints, which makes them affect only one query, or named hints, which can be pushed on and off a stack of active hints.

    Defining named hints:

    Pushing a hint onto the stack:

    Popping the topmost hint off the stack:

    You can define and activate a hint in a single command using the following:

    You can also push anonymous hints onto the stack which are only used as long as they are on the stack:

    The hintfilter supports routing hints in prepared statements for both thePREPARE and EXECUTE SQL commands as well as the binary protocol prepared statements.

    With binary protocol prepared statements, a routing hint in the prepared statement is applied to the execution of the statement but not the preparation of it. The preparation of the statement is routed normally and is sent to all servers.

    For example, when the following prepared statement is prepared with the MariaDB Connector-C function mariadb_stmt_prepare and then executed withmariadb_stmt_execute the result is always returned from the primary:

    Support for binary protocol prepared statements was added in MaxScale 6.0 ().

    The protocol commands that the routing hints are applied to are:

    • COM_STMT_EXECUTE

    • COM_STMT_BULK_EXECUTE

    • COM_STMT_SEND_LONG_DATA

    • COM_STMT_FETCH

    Support for direct execution of prepared statements was added in MaxScale 6.2.0. For example the MariaDB Connector-C uses direct execution whenmariadb_stmt_execute_direct is used.

    Text protocol prepared statements (i.e. the PREPARE and EXECUTE SQL commands) behave differently. If a PREPARE command has a routing hint, it will be routed according to the routing hint. Any subsequent EXECUTE command will not be affected by the routing hint in the PREPARE statement. This means they must have their own routing hints.

    The following example is the recommended method of executing text protocol prepared statements with hints:

    The PREPARE is routed normally and will be routed to all servers. TheEXECUTE will be routed to the primary as a result of it having the route to master hint.

    In this example, MariaDB MaxScale is configured with the readwritesplit router and the hint filter.

    Behind MariaDB MaxScale is a primary server and a replica server. If there is replication lag between the primary and the replica, read queries sent to the replica might return old data. To guarantee up-to-date data, we can add a routing hint to the query.

    The first INSERT query will be routed to the primary. The following SELECT query would normally be routed to the replica but with the added routing hint it will be routed to the primary. This way we can do an INSERT and a SELECT right after it and still get up-to-date data.

    This page is licensed: CC BY-SA / Gnu FDL

    MaxScale LDI Filter

    Manage LOAD DATA INFILE operations. This filter splits large data loads into smaller chunks to prevent blocking and improve stability during bulk data ingestion.

    Overview

    The ldi (LOAD DATA INFILE) filter was introduced in MaxScale 23.08.0 and it extends the MariaDB LOAD DATA INFILE syntax to support loading data from any object storage that supports the S3 API. This includes cloud offerings like AWS S3 and Google Cloud Storage as well as locally run services like Minio.

    If the filename starts with either S3:// or gs://, the path is interpreted as a S3 object file. The prefix is case-insensitive. For example, the following command would load the file my-data.csv from the bucket my-bucket into the table t1.

    Here is a minimal configuration for the filter that can be used to load data from AWS S3:

    The first step is to move the file to be loaded into the same region that MaxScale and the MariaDB servers are in. One factor in the speed of the upload is the network latency and minimizing it by moving the source and the destination closer improves the data loading speed.

    The next step is to connect to MaxScale and prepare the session for an upload by providing the service account access and secret keys.

    Once the credentials are configured, the data loading can be started:

    If you are using self-hosted object storage programs like Minio, a common problem is that they do not necessarily support the newer virtual-hosted-style requests that is used by AWS. This usually manifests as an error either about a missing file or a missing bucket.

    If the host parameter is set to a hostname, it's assumed that the object storage supports the newer virtual-hosted-style requests. If this not the case, the filter must be configured with protocol_version=1.

    Conversely, if the host parameter is set to a plain IP address, it is assumed that it does not support the newer virtual-hosted-style request. If the host does support it, the filter must be configured with protocol_version=2.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    The S3 access key used to perform all requests to it.

    This must be either configured in the MaxScale configuration file or set withSET @maxscale.ldi.s3_key='<key>' before starting the data load.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    The S3 secret key used to perform all requests to it.

    This must be either configured in the MaxScale configuration file or set withSET @maxscale.ldi.s3_secret='<secret>' before starting the data load.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: us-east-1

    The S3 region where the data is located.

    The value can be overridden with SET @maxscale.ldi.s3_region='<region>' before starting the data load.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: s3.amazonaws.com

    The location of the S3 object storage. By default the original AWS S3 host is used. The corresponding value for Google Cloud Storage isstorage.googleapis.com.

    The value can be overridden with SET @maxscale.ldi.s3_host='<host>' before starting the data load.

    • Type: integer

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0

    The port on which the S3 object storage is listening. If unset or set to the value of 0, the default S3 port is used.

    The value can be overridden with SET @maxscale.ldi.s3_port=<port> before starting the data load. Note that unlike the other values, the value for this variable must be an SQL integer and not an SQL string.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    If set to true, TLS certificate verification for the object storage is skipped.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    If set to true, communication with the object storage is done unencrypted using HTTP instead of HTTPS.

    • Type: integer

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0

    Which protocol version to use. By default the protocol version is derived from the value of host but this automatic protocol version deduction will not always produce the correct result. For the legacy path-style requests used by older S3 storage buckets, the value must be set to 1. All new buckets use the protocol version 2.

    For object storage programs like Minio, the value must be set to 1 as the bucket name cannot be resolved via the subdomain like it is done for object stores in the cloud.

    This parameter has been removed in MaxScale 24.02.

    This parameter has been removed in MaxScale 24.02.

    This page is licensed: CC BY-SA / Gnu FDL

    MaxScale Regex Filter

    Rewrite or block queries using regular expressions. This versatile filter modifies SQL statements on the fly or rejects them based on pattern matching rules.

    Overview

    The Regex filter is a filter module for MariaDB MaxScale that is able to rewrite query content using regular expression matches and text substitution. The regular expressions use the PCRE2 syntax.

    PCRE2 library uses a different syntax than POSIX to refer to capture groups in the replacement string. The main difference is the usage of the dollar character instead of the backslash character for references e.g. $1 instead of\1. For more details about the replacement string differences, please read the Creating a new string with substitutions chapter in the PCRE2 manual.

    Configuration

    The following demonstrates a minimal configuration.

    [MyRegexFilter]
    type=filter
    module=regexfilter
    match=some string
    replace=replacement string
    
    [MyService]
    type=service
    router=readconnroute
    servers=server1
    user=myuser
    password=mypasswd
    filters=MyRegexfilter

    Settings

    The Regex filter has two mandatory parameters: match and replace.

    match

    • Type:

    • Mandatory: Yes

    • Dynamic: Yes

    Defines the text in the SQL statements that is replaced.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: ignorecase

    The options-parameter affects how the patterns are compiled as .

    • Type: string

    • Mandatory: Yes

    • Dynamic: Yes

    This is the text that should replace the part of the SQL-query matching the pattern defined in match.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    The optional source parameter defines an address that is used to match against the address from which the client connection to MariaDB MaxScale originates. Only sessions that originate from this address will have the match and replacement applied to them.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    The optional user parameter defines a username that is used to match against the user from which the client connection to MariaDB MaxScale originates. Only sessions that are connected using this username will have the match and replacement applied to them.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    The optional log_file parameter defines a log file in which the filter writes all queries that are not matched and matching queries with their replacement queries. All sessions will log to this file so this should only be used for diagnostic purposes.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    The optional log_trace parameter toggles the logging of non-matching and matching queries with their replacements into the log file on the info level. This is the preferred method of diagnosing the matching of queries since the log level can be changed at runtime. For more details about logging levels and session specific logging, please read the .

    MySQL 5.1 used the parameter TYPE = to set the storage engine that should be used for a table. In later versions this changed to be ENGINE =. Imagine you have an application that you cannot change for some reason, but you wish to migrate to a newer version of MySQL. The regexfilter can be used to transform the create table statements into the form that could be used by MySQL 5.5

    This page is licensed: CC BY-SA / Gnu FDL

    MaxScale Change Data Capture (CDC) Protocol

    Learn about the legacy CDC protocol in MaxScale. This guide covers the authentication and registration phases for clients consuming AVRO-formatted replication events.

    Overview

    The CDC protocol was deprecated in MaxScale 24.08 and will be removed in the next major release. KafkaCDC can be used instead.

    CDC is a new protocol that allows compatible clients to authenticate and register for Change Data Capture events. The new protocol must be use in conjunction with AVRO router which currently converts MariaDB binlog events into AVRO records. Change Data Capture protocol is used by clients in order to interact with stored AVRO file and also allows registered clients to be notified with the new events coming from MariaDB 10.0/10.1 database.

    Creating Users

    The users and their hashed passwords are stored in /var/cache/maxscale/<service name>/cdcusers where <service name> is the name of the service.

    For example, the following service entry will look into /var/cache/maxscale/CDC-Service/ for a file called cdcusers. If that file is found, the users in that file will be used for authentication.

    If the cdcusers file cannot be found, the service user (maxuser:maxpwd in the example) can be used to connect through the CDC protocol.

    For more details, refer to the .

    • Client connects to MaxScale CDC protocol listener.

    • Send the authentication message which includes the user and the SHA1 of the password

    In the future, optional flags could be implemented.

    • Sending UUID

    • Specify the output format (AVRO or JSON) for data retrieval.

    • Send CDC commands to retrieve router statistics or to query for data events

    The authentication starts when the client sends the hexadecimal representation of the username concatenated with a colon (:) and the SHA1 of the password.

    bin2hex(username + ':' + SHA1(password))

    For example the user foobar with a password of foopasswd should send the following hexadecimal string

    Server returns OK on success and ERR on failure.

    REGISTER

    REGISTER UUID=UUID, TYPE={JSON | AVRO}

    Register as a client to the service.

    Example:

    Server returns OK on success and ERR on failure.

    REQUEST-DATA

    REQUEST-DATA DATABASE.TABLE[.VERSION] [GTID]

    This command fetches data from specified table in a database and returns the output in the requested format (AVRO or JSON). Data records are sent to clients and if new AVRO versions are found (e.g. mydb.mytable.0000002.avro) the new schema and data will be sent as well.

    The data will be streamed until the client closes the connection.

    Clients should continue reading from network in order to automatically gets new events.

    Example:

    MaxScale includes an example CDC client application written in Python 3. You can find the source code for it .

    This page is licensed: CC BY-SA / Gnu FDL

    MariaDB MaxScale Installation Guide

    Follow step-by-step instructions to install MariaDB MaxScale on major Linux distributions. This guide covers repository configuration and package installation.

    MariaDB MaxScale is an advanced, open-source database proxy that provides intelligent routing, load balancing, high availability, and security features for your MariaDB and MySQL deployments. It acts as an intermediary, forwarding database statements to one or more backend database servers based on configured rules and server roles, all transparently to your applications.

    1

    Key concepts

    To understand MaxScale, familiarize yourself with these core components:

    Securing Your MaxScale Deployment

    Essential hardening steps for production MaxScale environments. Learn to encrypt passwords, secure the REST API with TLS, enable audit logging, and configure encrypted database connections.

    The following hardening steps are recommended before going into production:

    • Encrypt plaintext passwords

    • Secure GUI & Admin Interface Connections

    Setting up MariaDB MaxScale

    Follow this guide to prepare your environment for MaxScale. Learn to create necessary database users configure the server and set up basic monitoring permissions.

    This document is designed as a quick introduction to setting up MariaDB MaxScale.

    The installation and configuration of the MariaDB Server is not covered in this document. See the following MariaDB articles for more information on setting up a primary-replica-cluster or a Galera-cluster: and

    This tutorial assumes that one of the standard MaxScale binary distributions is used and that MaxScale is installed using default options.

    The precise installation process varies from one distribution to another. Details on package installation can be found in the .

    MaxScale checks that incoming clients are valid. To do this, MaxScale needs to retrieve user authentication information from the backend databases. Create a special user account for this purpose by executing the following SQL commands on the primary server of your database cluster. The following tutorials will use these credentials.

    25.01.2

    MaxScale version 25.01.2

    maxscale-maxctrl2_25.10.3~noble-1_amd64.deb

  • maxscale-exasol_25.10.3~noble-1_amd64.deb

  • maxscale-maxctrl
    contains
    maxctrl
    , a
    based command line tool for managing MaxScale.
  • maxscale-maxctrl2 contains maxctrl2, which provides the same functionality as maxctrl, but is a native application.

  • maxscale-exasol contains exasolrouter, a router capable of routing to Exasol.

  • Obtaining MaxScale Trial

    Installing MaxScale Trial

    Configuring the License Key

    Database Users used by MaxScale

    Configuring the REST-API

    Starting MaxScale Trial

    Upgrading to MaxScale

    MaxScale Trial License page
    MariaDB Download
    service
    monitor
    here
    here
    http://127.0.0.1:8989
    spinner
    MaxScale Trial login dialog, containing two form fields to input user name and password, a Remember me checkbox, and a Sign In button.
    MaxScale Trial Login Dialog
    Node.js

    Settings

    match

    exclude

    rewrite_src

    rewrite_dest

    Example Configuration

    regex
    regex
    PCRE2 api documentation
    regex
    regex
    GTID-based replication
    binlogrouter documentation
    spinner
    ,
    case
    ,
    extended
  • Default: ignorecase

  • Settings

    time

    count

    match

    ignore

    options

    global

    Example Configuration

    MaxScale hint syntax
    duration
    regex
    regular expression settings
    regex
    match
    enum
    boolean
    spinner

    COM_STMT_RESET

    Hint body

    Routing destination hints

    Hint stack

    Prepared Statements

    Binary Protocol

    Text Protocol

    Examples

    Routing SELECT queries to primary

    MXS-2838
    spinner

    Values: 0, 1, 2

    How to Upload Data

    Common Problems With Data Loading

    Missing Files

    Settings

    key

    secret

    region

    host

    port

    no_verify

    use_http

    protocol_version

    import_user

    import_password

    boolean
    boolean
    spinner
    ,
    case
    ,
    extended
  • Default: ignorecase

  • options

    replace

    source

    user

    log_file

    log_trace

    Examples

    Example 1 - Replace MySQL 5.1 create table syntax with that for later versions

    regex
    enum
    usual
    Configuration Guide
    spinner

    Protocol Phases

    Connection and Authentication

    Registration

    Data Request

    Protocol Details

    Authentication

    Registration

    Change Data Capture Commands

    Example Client

    CDC users documentation
    in the MaxScale repository
    spinner
    mkdir maxscale
    cd maxscale
    tar -xf path/to/maxscale-25.10.3-trial-release.ubuntu.noble.x86_64.tar
    sudo apt install ./*.deb
    sudo dnf install ./*.rpm
    [maxscale]
    ...
    license_key=...
    CREATE USER 'service_user'@'%' IDENTIFIED BY 'service_pw';
    GRANT SELECT ON mysql.user TO 'service_user'@'%';
    GRANT SELECT ON mysql.db TO 'service_user'@'%';
    GRANT SELECT ON mysql.tables_priv TO 'service_user'@'%';
    GRANT SELECT ON mysql.columns_priv TO 'service_user'@'%';
    GRANT SELECT ON mysql.procs_priv TO 'service_user'@'%';
    GRANT SELECT ON mysql.proxies_priv TO 'service_user'@'%';
    GRANT SELECT ON mysql.roles_mapping TO 'service_user'@'%';
    GRANT SELECT ON mysql.global_priv TO 'service_user'@'%';
    GRANT SHOW DATABASES ON *.* TO 'service_user'@'%';
    CREATE USER 'monitor_user'@'%' IDENTIFIED BY 'monitor_pw';
    GRANT ALL ON *.* TO 'monitor_user'@'%';
    admin_secure_gui=false
    sudo systemctl start maxscale.service
    sudo cat /var/log/maxscale/maxscale.log
    maxctrl list servers
    maxctrl list services
    admin_host=0.0.0.0
    [BinlogFilter]
    type=filter
    module=binlogfilter
    match=/customers[.]/
    exclude=/[.]orders/
    
    [BinlogServer]
    type=service
    router=binlogrouter
    server_id=33
    filters=BinlogFilter
    
    [BinlogListener]
    type=listener
    service=BinlogServer
    port=4000
    INSERT INTO departments VALUES ('d1234', 'NewDepartment'); -- maxscale ccr=ignore
    match=.*INSERT.*
    ignore=.*UPDATE.*
    options=case,extended
    [CCRFilter]
    type=filter
    module=ccrfilter
    time=5
    -- maxscale <hint body>
    -- maxscale route to [master | slave | server <server name>]
    -- maxscale route to master
    -- maxscale route to slave
    -- maxscale route to server <server name>
    -- maxscale route to last
    -- maxscale <param>=<value>
    -- maxscale <hint name> prepare <hint content>
    -- maxscale <hint name> begin
    -- maxscale end
    -- maxscale <hint name> begin <hint content>
    -- maxscale begin <hint content>
    SELECT user FROM accounts WHERE id = ? -- maxscale route to master
    PREPARE my_ps FROM 'SELECT user FROM accounts WHERE id = ?';
    EXECUTE my_ps USING 123; -- maxscale route to master
    [ReadWriteService]
    type=service
    router=readwritesplit
    servers=server1,server2
    user=maxuser
    password=maxpwd
    filters=Hint
    
    [Hint]
    type=filter
    module=hintfilter
    INSERT INTO table1 VALUES ("John","Doe",1);
    SELECT * FROM table1; -- maxscale route to master
    LOAD DATA INFILE 'S3://my-bucket/my-data.csv' INTO TABLE t1
        FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
    [LDI-Filter]
    type=filter
    module=ldi
    host=s3.amazonaws.com
    region=us-east-1
    SET @maxscale.ldi.s3_key='<my-access-key>', @maxscale.ldi.s3_secret='<my-secret-key>';
    LOAD DATA INFILE 'S3://my-bucket/my-data.csv' INTO TABLE t1;
    match=TYPE[ ]*=
    options=case
    replace=ENGINE =
    source=127.0.0.1
    user=john
    log_file=/tmp/regexfilter.log
    log_trace=true
    [CreateTableFilter]
    type=filter
    module=regexfilter
    options=ignorecase
    match=TYPE\s*=
    replace=ENGINE=
    
    [MyService]
    type=service
    router=readconnroute
    servers=server1
    user=myuser
    password=mypasswd
    filters=CreateTableFilter
    [CDC-Service]
    type=service
    router=avrorouter
    user=maxuser
    password=maxpwd
    foobar:SHA1(foopasswd) ->  666f6f6261723a3137336363643535253331
    REGISTER UUID=11ec2300-2e23-11e6-8308-0002a5d5c51b, TYPE=AVRO
    REQUEST-DATA db1.table1
    REQUEST-DATA dbi1.table1.000003
    REQUEST-DATA db2.table4 0-11-345
    Servers: These are your backend MariaDB or MySQL instances that MaxScale will manage traffic to.
  • Monitors: Plugins that observe the health and state of your backend servers (e.g., primary, replica, down).

  • Routers: Plugins that determine how client queries are directed to backend servers (e.g., readwritesplit router for directing writes to a primary and reads to replicas).

  • Services: Define a combination of a router and a set of servers, along with any filters.

  • Listeners: Define how clients connect to MaxScale (port, protocol) and which service they connect to.

  • Filters: Optional components that can inspect, modify, or log queries as they pass through MaxScale (e.g., qlafilter for auditing).

  • 2

    Installation

    MariaDB MaxScale is typically installed from the official MariaDB repositories.

    Add MariaDB Repository:

    Use the MariaDB Repository Configuration Tool (search "MariaDB Repository Generator") to get specific instructions for your OS and MaxScale version.

    Installation for Debian/Ubuntu:

    sudo apt update
    sudo apt install -y curl
    curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash
    sudo apt install -y maxscale

    Installation for RHEL/Rocky Linux/Alma Linux:

    curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash
    sudo dnf install -y maxscale
    3

    Basic configuration

    MaxScale's configuration is primarily done in its main configuration file in /etc/maxscale.cnf.

    Define Servers:

    Add a section for each of your backend MariaDB servers.

    [server1]
    type=server
    # IP address or hostname of your first MariaDB server
    address=192.168.1.101
    
    [server2]
    type=server
    # IP address or hostname of your second MariaDB server
    address=192.168.1.102
    # Set the port if MariaDB is listening on a non-default port
    port=3307

    Define a Monitor:

    This section tells MaxScale how to monitor your backend servers' health and roles and groups them into a cluster of servers.

    [MariaDB-Cluster]
    type=monitor
    # The  MariaDB asynchronous replication monitoring module
    module=mariadbmon
    # List of servers to monitor
    servers=server1,server2
    # The user used for monitoring
    user=maxscale_monitor
    password=monitor_password
    # Check every 5 seconds
    monitor_interval=5s

    Important: Create the maxscale_monitor user on your backend MariaDB servers with appropriate privileges:

    Define a Service (e.g., Read-Write Split):

    This configures how MaxScale routes queries. The readwritesplit router is very common for replication setups as it load balances read while routing writes to the primary node.

    Important: Create the maxscale_user on your backend MariaDB servers with the following privileges:

    Define a Listener:

    This specifies the port and protocol MaxScale will listen on for incoming client connections and which service to direct them to.

    Global MaxScale Configuration (usually at the top of maxscale.cnf):

    4

    Complete configuration

    Your /etc/maxscale.cnf should now look like this:

    [maxscale]
    threads=auto
    
    [server1]
    type=server
    address=192.168.1.101
    
    [server2]
    type=server
    address=192.168.1.102
    port=3307
    
    [MariaDB-Cluster]
    type=monitor
    module=mariadbmon
    servers=server1,server2
    user=maxscale_monitor
    password=monitor_password
    monitor_interval=5s
    
    [Read-Write-Service]
    type=service
    router=readwritesplit
    cluster=MariaDB-Cluster
    user=maxscale_user
    password=maxscale_password
    
    [Read-Write-Listener]
    type=listener
    service=Read-Write-Service
    port=3306
    5

    Start and enable MaxScale

    After configuring maxscale.cnf, start and enable the MaxScale service.

    sudo systemctl start maxscale
    sudo systemctl enable maxscale
    sudo systemctl status maxscale # Check status
    6

    Basic usage and verification

    Once MaxScale is running, configure your applications to connect to MaxScale's listener port instead of directly to a MariaDB server.

    Example (Connect with mariadb client from the MaxScale server):

    mariadb -h 127.0.0.1 -P 3306 -u my-user -p

    Verify Read-Write Split (if configured):

    1. Connect to MaxScale (127.0.0.1:3306).

    2. Execute a WRITE query (e.g., INSERT INTO your_table ...). This should be routed to the primary server.

    3. Execute a READ query (e.g., SELECT * FROM your_table). This should be load-balanced across your replica servers.

    4. You can use maxctrl list servers and maxctrl show servers to observe routing in action.

    • MariaDB MaxScale Installation Guide

    • MariaDB MaxScale Configuration Guide

    • MariaDB MaxScale GitHub Repository

    This page is licensed: CC BY-SA / Gnu FDL

    Quickstart Guide: MariaDB MaxScale

    Further Resources:

    Change Admin User & Password
  • Enable Audit Logging

  • Encrypt Incoming Database Connections

  • Encrypt Outgoing Database Connections

  • MaxScale configuration includes credentials MaxScale uses to e.g. monitor database servers. By default, the passwords are written in plaintext in the configuration file, which exposes them to being accidentally shared. Reduce this risk by encrypting the passwords. Generate an encryption key with the maxkeys-command and then convert plaintext passwords to encrypted form with the maxpasswd-command.

    Run maxkeys to generate a key file in /var/lib/maxscale. File ownership is given to the maxscale user and only the owner has read-permissions to the file.

    Once generated, the key file can be relocated to a secure location. This key file serves a dual purpose: it enables the encryption of passwords and decrypting those encrypted passwords. Typically, the MaxScale administrator encrypts passwords and MaxScale itself decrypts them when required.

    The key file must remain secure to maintain the security of the encrypted passwords. If an attacker can read the contents of the key file, they can also decrypt any passwords read from the configuration file. Use chown and chmod to restrict access.

    Encrypt plaintext passwords used in MaxScale configuration with maxpasswd.

    Replace the plaintext passwords in your MaxScale configuration (CNF) files with the encrypted versions. This enhances overall security by reducing the risk that passwords are accidentally shared.

    See encrypting-passwords for more information regarding password encryption.

    MaxScale is managed during runtime through the REST-API admin interface. This interface is used by the GUI and the MaxCtrl utility. It can even be accessed using curl. By default, the admin interface only accepts local connections. If you need to allow external access, modify the admin_host setting to change the network the admin interface listens on. To mitigate the security risk of external access, you can change the listening port to a non-default value.

    If you need to allow external access, ensure that the network is adequately secured and that only authorized users can access the MaxScale interface. Consult with your network administrator to determine the most appropriate and secure configuration.

    To properly secure the MaxScale REST-API, enable TLS encryption for data in transit. Follow these steps to configure SSL:

    1. Generate SSL key and certificate:

    • See for information on certificate creation.

    • Move the generated files to a secure location MaxScale can access.

    2. Update MaxScale configuration:

    • Enable secure connections by setting admin_secure_gui to true.

    • Specify the paths to the SSL certificate and key files in your CNF file:

    3. Verify Encryption:

    • Use maxctrl to verify that TLS encryption is functioning correctly:

    The REST-API is initially configured to be accessed with username admin and password mariadb. Any attacker would try these credentials first, so create a new user account and delete the default one.

    To create or delete REST-API users, use the maxctrl-command. To create a user with administrative privileges, run:

    The password must be in cleartext.

    To remove an existing user, such as the default admin user, use the following command:

    After these commands, MaxCtrl will no longer work unless you define credentials either on the command line or in a config file. See MaxCtrl documentation for more information.

    REST-API user accounts have one of two roles: admin and basic. admin allows full read and write access, basic only allows reading.

    REST-API user accounts can also be managed through the GUI.

    Admin auditing in MaxScale provides comprehensive tracking of all administrative activities, including logins, connections, and modifications. These activities are recorded in an audit file for enhanced security and traceability.

    To enable admin auditing, add the following configuration to your MaxScale configuration file:

    This configuration activates auditing and specifies the location of the audit file. Ensure that the specified directory exists before restarting MaxScale.

    Implement log rotation to manage the size and number of audit files. This can be achieved using standard Linux log rotation tools. See

    For manual log rotation, use the following MaxCtrl command:

    Incoming database connections are the connections clients make to MaxScale. Without encryption, an eavesdropper can listen to the client queries and server responses. To enable encryption, MaxScale listeners need to be configured for TLS.

    Add ssl=true to the listener section in your MaxScale configuration file. This enforces encrypted connections from incoming clients. The listener also requires a certificate and its private key, configured with settings ssl_cert and ssl_key. If using a X509v3 certificate with extendedKeyUsage extension settings, the serverAuth flag should be set in the certificate.

    The listener section should look like:

    In MaxScale 25.10, the ssl_cert and ssl_key settings can be omitted, which causes MaxScale to generate a self-signed certificate during startup. Recent client versions (11.4 and later) can even verify this auto-generated certificate.

    For more information on SSL settings, see here

    If you want MaxScale to verify client certificates against a CA-certificate, set ssl_verify_peer_certificate=true and define the CA-certificate with ssl_ca.

    Outgoing database connections are the connections MaxScale makes to MariaDB Servers on behalf of incoming clients. If MaxScale and the servers are running in the same network, and you consider the network already secure, then encrypting these connections may not be necessary. If this is not the case, both MaxScale and the servers need to be configured to use TLS. To configure MariaDB Server for encryption, see .

    To enable MaxScale to connect securely to MariaDB Servers:

    Add ssl=true to each server section in your MaxScale configuration file. This enforces encrypted connections to the server.

    If you want MaxScale to verify the server certificate (to ensure it's signed by a trusted CA), add ssl_verify_peer_certificate=true. The CA certificate path is defined with ssl_ca. This prevents MaxScale from routing queries to a malicious server that has hijacked the address of the real server.

    The server section in your MaxScale configuration file should look like:

    If you are using MaxScale 25.10 and a recent MariaDB Server version, certificate verification no longer requires a ca-certificate. In this case, the ssl_ca setting can be omitted. See here for more information.

    If the MariaDB Server requires clients (such as MaxScale) to connect with a verified certificate, then such a certificate must be defined in the MaxScale configuration, with settings ssl_cert and ssl_key. If using a X509v3 certificate with extendedKeyUsage extension settings, the clientAuth flag should be set in the certificate.

    This page is licensed: CC BY-SA / Gnu FDL

    Securing Your MaxScale Deployment

    $ maxkeys
    $ maxpasswd plaintextpassword
    96F99AA1315BDC3604B006F427DD9484
    [MariaDB-Service]
    type=service
    router=readwritesplit
    servers=MariaDB1,MariaDB2,MariaDB3
    user=maxscale-user
    password=96F99AA1315BDC3604B006F427DD9484
    [maxscale]
    admin_host=10.0.0.3
    admin_port=2222
    [maxscale]
    admin_secure_gui=true
    admin_ssl_key=/certs/maxscale-key.pem
    admin_ssl_cert=/certs/maxscale-cert.pem
    admin_ssl_ca_cert=/certs/ca-cert.pem
    $ maxctrl --user=my_user --password=my_password --secure --tls-ca-cert=/certs/ca-cert.pem --tls-verify-server-cert=false show maxscale
    $ maxctrl create user my_user my_password --type=admin
    $ maxctrl destroy user admin
    [maxscale]
    admin_audit = true
    admin_audit_file = /var/log/maxscale/audit_files/audit.csv
    $ maxctrl rotate logs
    [RWS-Listener]
    type=listener
    service=RWS-Service
    ssl=true
    ssl_key=/certs/my-cert-key.pem
    ssl_cert=/certs/my-cert.pem
    [RWS-Listener]
    type=listener
    service=RWS-Service
    ssl=true
    ssl_key=/certs/my-cert-key.pem
    ssl_cert=/certs/my-cert.pem
    ssl_ca=/certs/my_ca_cert.pem
    [MariaDB-Server1]
    type=server
    address=...
    port=...
    ssl=true
    ssl_verify_peer_certificate=true
    ssl_ca=/certs/my_ca_cert.pem
    [MariaDB-Server1]
    type=server
    address=...
    port=...
    ssl=true
    ssl_verify_peer_certificate=true
    ssl_key=/certs/my-cert-key.pem
    ssl_cert=/certs/my-cert.pem
    ssl_ca=/certs/my_ca_cert.pem

    Encrypt Plaintext Passwords

    Secure GUI & Admin Interface Connections

    Enable TLS Encryption

    Change Admin User & Password

    Enable Audit Logging

    Encrypt Incoming Database Connections

    1. Enable TLS:

    2. Verify client certificates

    Encrypt Outgoing Database Connections

    1. Enable TLS:

    2. Verify server certificate:

    3. Configure a pre-generated certificate for connecting to the server

    spinner
    Because MariaDB MaxScale sits between the clients and the backend databases, the backend databases will see all clients as if they were connecting from MaxScale's address. This usually means that two sets of grants for each user are required.

    For example, assume that the user 'jdoe'@'client-host' exists and MaxScale is located at maxscale-host. If 'jdoe'@'client-host' needs to be able to connect through MaxScale, another user, 'jdoe'@'maxscale-host', must be created. The second user must have the same password and similar grants as 'jdoe'@'client-host'.

    The quickest way to do this is to first create the new user:

    Then do a SHOW GRANTS query:

    Then copy the same grants to the 'jdoe'@'maxscale-host' user.

    An alternative to generating two separate accounts is to use one account with a wildcard host ('jdoe'@'%') which covers both hosts. This is more convenient but less secure than having specific user accounts as it allows access from all hosts.

    MaxScale reads its configuration from /etc/maxscale.cnf. A template configuration is provided with the MaxScale installation.

    A global maxscale section is included in every MaxScale configuration file. This section sets the values of various global parameters, such as the number of threads MaxScale uses to handle client requests. To set thread count to the number of available cpu cores, set the following.

    Read the Configuring Servers mini-tutorial for server configuration instructions.

    The type of monitor used depends on the type of cluster used. For a primary-replica cluster read Configuring MariaDB Monitor. For a Galera cluster read Configuring Galera Monitor.

    This part is covered in two different tutorials. For a fully automated read-write-splitting setup, read the Read Write Splitting Tutorial. For a simple connection based setup, read the Connection Routing Tutorial.

    After configuration is complete, MariaDB MaxScale is ready to start. For systems that use systemd, use the systemctl command.

    For older SysV systems, use the service command.

    If MaxScale fails to start, check the error log in /var/log/maxscale/maxscale.log to see if any errors are detected in the configuration file.

    The maxctrl-command can be used to confirm that MaxScale is running and the services, listeners and servers have been correctly configured. The following shows expected output when using a read-write-splitting configuration.

    MariaDB MaxScale is now ready to start accepting client connections and route queries to the backend cluster.

    More options can be found in the Configuration Guide,readwritesplit module documentation and readconnroute module documentation.

    For more information about MaxCtrl and how to secure it, see the REST-API Tutorial.

    This page is licensed: CC BY-SA / Gnu FDL

    CREATE USER 'maxscale'@'%' IDENTIFIED BY 'maxscale_pw';
    GRANT SELECT ON mysql.user TO 'maxscale'@'%';
    GRANT SELECT ON mysql.db TO 'maxscale'@'%';
    GRANT SELECT ON mysql.tables_priv TO 'maxscale'@'%';
    GRANT SELECT ON mysql.columns_priv TO 'maxscale'@'%';
    GRANT SELECT ON mysql.procs_priv TO 'maxscale'@'%';
    GRANT SELECT ON mysql.proxies_priv TO 'maxscale'@'%';
    GRANT SELECT ON mysql.global_priv TO 'maxscale'@'%';
    GRANT SELECT ON mysql.roles_mapping TO 'maxscale'@'%';
    GRANT SHOW DATABASES ON *.* TO 'maxscale'@'%';

    Installing MaxScale

    If you are using MaxScale Trial, see Installing MaxScale Trial.

    Creating a user account for MaxScale

    Creating client user accounts

    Setting Up Replication
    Getting Started With MariaDB Galera Cluster
    Installation Guide
    CREATE USER 'jdoe'@'maxscale-host' IDENTIFIED BY 'my_secret_password';
    SHOW GRANTS FOR 'jdoe'@'client-host';
    +-----------------------------------------------------------------------+
    | Grants for jdoe@client-host                                           |
    +-----------------------------------------------------------------------+
    | GRANT SELECT, INSERT, UPDATE, DELETE ON *.* TO 'jdoe'@'client-host'   |
    +-----------------------------------------------------------------------+
    1 row in set (0.01 sec)
    GRANT SELECT, INSERT, UPDATE, DELETE ON *.* TO 'jdoe'@'maxscale-host';
    [maxscale]
    threads=auto
    sudo systemctl start maxscale
    sudo service maxscale start
    % sudo maxctrl list services
    
    ┌──────────────────┬────────────────┬─────────────┬───────────────────┬───────────────────────────┐
    │ Service          │ Router         │ Connections │ Total Connections │ Servers                   │
    ├──────────────────┼────────────────┼─────────────┼───────────────────┼───────────────────────────┤
    │ Splitter-Service │ readwritesplit │ 1           │ 1                 │ dbserv1, dbserv2, dbserv3 │
    └──────────────────┴────────────────┴─────────────┴───────────────────┴───────────────────────────┘
    
    % sudo maxctrl list servers
    
    ┌─────────┬─────────────┬──────┬─────────────┬─────────────────┬───────────┐
    │ Server  │ Address     │ Port │ Connections │ State           │ GTID      │
    ├─────────┼─────────────┼──────┼─────────────┼─────────────────┼───────────┤
    │ dbserv1 │ 192.168.2.1 │ 3306 │ 0           │ Master, Running │ 0-3000-62 │
    ├─────────┼─────────────┼──────┼─────────────┼─────────────────┼───────────┤
    │ dbserv2 │ 192.168.2.2 │ 3306 │ 0           │ Slave, Running  │ 0-3000-62 │
    ├─────────┼─────────────┼──────┼─────────────┼─────────────────┼───────────┤
    │ dbserv3 │ 192.168.2.3 │ 3306 │ 0           │ Slave, Running  │ 0-3000-62 │
    └─────────┴─────────────┴──────┴─────────────┴─────────────────┴───────────┘
    
    % sudo maxctrl list listeners Splitter-Service
    
    ┌───────────────────┬──────┬──────┬─────────┐
    │ Name              │ Port │ Host │ State   │
    ├───────────────────┼──────┼──────┼─────────┤
    │ Splitter-Listener │ 3306 │      │ Running │
    └───────────────────┴──────┴──────┴─────────┘

    Creating the configuration file

    If using , you also need:

    Configuring the servers

    Configuring the monitor

    Configuring the services and listeners

    Starting MaxScale

    Checking MaxScale status with MaxCtrl

    spinner
    [Read-Write-Listener]
    type=listener
    address=::
    service=Read-Write-Service
    authenticator=ed25519auth
    authenticator_options=ed_mode=sha256
    authenticator_options=ed_mode=sha256,
     ed_rsa_privkey_path=/tmp/sha_private_key.pem,
     ed_rsa_pubkey_path=/tmp/sha_public_key.pem
    [Read-Write-Listener]
    type=listener
    address=::
    service=Read-Write-Service
    authenticator=ed25519auth,mariadbauth
    user_mapping_file=/home/joe/mapping.json
    {
        "user_map": [
            {
                "original_user": "alpha",
                "mapped_user": "beta"
            },
            {
                "original_user": "gamma",
                "mapped_user": "gamma"
            }
        ],
        "server_credentials": [
            {
                "mapped_user": "beta",
                "password": "hunter2",
                "plugin": "mysql_native_password"
            },
            {
                "mapped_user": "gamma",
                "password": "letmein",
                "plugin": "ed25519"
            }
        ]
    }
    [Read-Write-Listener]
    type=listener
    address=::
    service=Read-Write-Service
    authenticator=ed25519auth
    authenticator_options=ed_mode=sha256
    ssl=true
    ssl_key=/tmp/my-key.pem
    ssl_cert=/tmp/my-cert.pem
    ssl_ca=/tmp/myCA.pem
    [Read-Write-Listener]
    type=listener
    address=::
    service=Read-Write-Service
    authenticator=ed25519auth
    authenticator_options=ed_mode=sha256,
     ed_rsa_privkey_path=/tmp/sha_private_key.pem,
     ed_rsa_pubkey_path=/tmp/sha_public_key.pem
    openssl genrsa -out sha_private_key.pem 2048
    openssl rsa -in sha_private_key.pem -pubout -out sha_public_key.pem

    Configuration

    ed_mode

    ed_rsa_privkey_path and ed_rsa_pubkey_path

    Using a Mapping File

    Using sha256 Authentication

    user mapping
    spinner

    MariaDB MaxScale Beginner's Guide

    Start your journey with MariaDB MaxScale. This guide introduces the database proxy's architecture, key components, and basic setup steps for first-time users.

    Introduction

    After MaxScale has been installed, test that MaxScale starts by executing sudo systemctl start maxscale, followed by sudo systemctl status maxscale.

    ● maxscale.service - MariaDB MaxScale Database Proxy
       Loaded: loaded (/usr/lib/systemd/system/maxscale.service; enabled; vendor preset: disabled)
       Active: active (running) since Mon 2024-09-23 08:57:14 CEST; 6s ago

    Stop MaxScale with sudo systemctl stop maxscale. The log file is written at /var/log/maxscale/maxscale.log. If the startup failed, the log should explain why. With the default configuration file, MaxScale does not yet do anything interesting.

    A functional configuration of MaxScale should include a listener, a service, a monitor and one or more servers. An incoming client connects to a listener port. Once the connection is established, the listener passes the client to a service. The service then handles all client traffic, from authentication to disconnection. Client queries are routed to servers and query results from servers back to the client. A monitor regularly checks the status of the servers.

    A client connects through a listener into the service, where an optional filter feeds the router, which distributes queries across the backend servers monitored separately by the monitor.

    MaxScale configuration files use the common file format. The files contain sections and each section can contain multiple key-value pairs. The MaxScale installer creates an example configuration file to /etc/maxscale.cnf.

    Let's modify the example configuration file to include a service that routes all queries to one server. For this, you will need to have a running MariaDB Server accessible in the network. One option is to run a MariaDB Server . Once the server is running, log in to it with an administrative account and create a user account for MaxScale itself to use when monitoring the server and fetching user accounts. The following example creates user maxscale with all privileges.

    Next, edit /etc/maxscale.cnf. Perform the following modifications:

    1. In the section [server1], set correct address and port. These should match the running MariaDB Server.

    2. In the section [MariaDB-Monitor], set user to maxscale and password to maxscale_passwd (or whatever user/password was created earlier).

    The configuration file should now have the following effective contents.

    Then, start MaxScale. If MaxScale started successfully, run maxctrl list servers in the terminal. If MaxScale can successfully connect to the server, the output should be approximately:

    Next, check the log file at /var/log/maxscale/maxscale.log. It should have a message like:

    If the monitor cannot connect to the server, the State is Down. In this case, check the log for error messages. Similarly, if the service cannot load user account information, an error is logged.

    If everything is working properly, connect as client to the MaxScale listener port, configured to 4006.

    Other user accounts on the server should work as well if their host patterns allow connections from MaxScale's IP address.

    The Read-Write Service configured above only uses one server. To enable read-write splitting, a replication cluster with a primary server and one or more replicas is required. Setting up such a cluster is outside the scope of this document, see for more information.

    Once the replicas are set up, add them to the MaxScale configuration file as separate sections: [server2], [server3] etc., similar to [server1]. Remember to set the addresses and ports. Then, add the server names to the servers-settings of the monitor:

    Then, restart MaxScale to take the configuration into use and run maxctrl list servers once more. If replication is working and MaxScale can connect to all the servers, the output should be as below. If this is not the case, check the log again for error messages.

    Run maxctrl show servers to get more detailed information about the servers such as connection and query counts, and maxctrl show monitors to see monitor-related information such as replication status.

    Connect to the listener port again with mariadb -h127.0.0.1 -P4006 -umaxscale -pmaxscale_passwd and run the query select @@server_id; a few times. It should give the server id of a replica, alternating if multiple are available. This demonstrates that read queries are sent to the replicas. Writes and other queries that depend on the primary are sent to the primary only, e.g. select @@last_insert_id,@@server_id;. Reads inside transactions are also ran on the primary to maintain transaction consistency.

    Filters are components added to the query processing chain that can act on the query. A typical use-case is logging. To add a log filter, add the following to the configuration file:

    Then, add the filter to the service:

    Again, restart MaxScale to take the configuration into use. MaxScale will now log any client queries passing through MaxScale to /var/log/maxscale/query_log.unified.

    Add admin_secure_gui=false to the [maxscale]-section of the configuration file and restart MaxScale. This allows access to the GUI without configuring SSL certificates. Then, open a web browser and navigate to http://127.0.0.1:8989. A login screen should open, use username admin and password mariadb to access the GUI. The GUI can show MaxScale and server status, show and modify MaxScale configuration, perform SQL queries and much more. See for more information on the GUI.

    The lists all global configuration parameters. The explains the ReadWriteSplit-router and its features, such as transaction replay and causal reads. The explains monitor features such as failover and switchover.

    This page is licensed: CC BY-SA / Gnu FDL

    MaxScale Named Server Filter

    Route queries to specific servers based on regex patterns. This filter allows you to direct traffic matching defined rules to a particular backend server by name.

    Overview

    The namedserverfilter is a MariaDB MaxScale filter module able to route queries to servers based on regular expression (regex) matches. Since it is a filter instead of a router, the NamedServerFilter only sets routing suggestions. It requires a compatible router to be effective. Currently, bothreadwritesplit and hintrouter take advantage of routing hints in the data packets. This filter uses the PCRE2 library for regular expression matching.

    Configuration

    The filter accepts settings in two modes: legacy and indexed. Only one of the modes may be used for a given filter instance. The legacy mode is meant for backwards compatibility and allows only one regular expression and one server name in the configuration. In indexed mode, up to 25 regex-server pairs are allowed in the form match01 - target01, match02 - target02 and so on. Also, in indexed mode, the server names (targets) may contain a list of names or special tags ->master or ->slave.

    All parameters except the deprecated match and target parameters can be modified at runtime. Any modifications to the filter configuration will only affect sessions created after the change has completed.

    Below is a configuration example for the filter in indexed-mode. The legacy mode is not recommended and may be removed in a future release. In the example, a SELECT on TableOne (match01) results in routing hints to two named servers, while a SELECT on TableTwo is suggested to be routed to the primary server of the service. Whether a list of server names is interpreted as a route-to-any or route-to-all is up to the attached router. The HintRouter sees a list as a suggestion to route-to-any. For additional information on hints and how they can also be embedded into SQL-queries, see .

    NamedServerFilter requires at least one matchXY - targetXY pair.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    matchXY defines a against which the incoming SQL query is matched. XY must be a number in the range 01 - 25. Each match-setting pairs with a similarly indexed target-setting. If one is defined, the other must be defined as well. If a query matches the pattern, the filter attaches a routing hint defined by the target-setting to the query. The options-parameter affects how the patterns are compiled.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: ignorecase

    for matchXY.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    The hint which is attached to the queries matching the regular expression defined by matchXY. If a compatible router is used in the service the query will be routed accordingly. The target can be one of the following:

    • a server or service name (adds a HINT_ROUTE_TO_NAMED_SERVER hint)

    • a list of server names, comma-separated (adds severalHINT_ROUTE_TO_NAMED_SERVER hints)

    • ->master (adds a HINT_ROUTE_TO_MASTER

    The support for service names was added in MaxScale 6.3.2. Older versions of MaxScale did not accept service names in the target parameters.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    This optional parameter defines an IP address or mask which a connecting client's IP address is matched against. Only sessions whose address matches this setting will have this filter active and performing the regex matching. Traffic from other client IPs is simply left as is and routed straight through.

    Since MaxScale 2.1 it's also possible to use % wildcards:

    Note that using source=% to match any IP is not allowed.

    Since MaxScale 2.3 it's also possible to specify multiple addresses separated by comma. Incoming client connections are subsequently checked against each.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    This optional parameter defines a username the connecting client username is matched against. Only sessions that are connected using this username will have the match and routing hints applied to them. Traffic from other users is simply left as is and routed straight through.

    The maximum number of accepted match - target pairs is 25.

    In the configuration file, the indexed match and target settings may be in any order and may skip numbers. During SQL-query matching, however, the regexes are tested in ascending order: match01, match02, match03 and so on. As soon as a match is found for a given query, the routing hints are written and the packet is forwarded to the next filter or router. Any remaining match regexes are ignored. This means the match - target pairs should be indexed in priority order, or, if priority is not a factor, in order of decreasing match probability.

    Binary-mode prepared statements (COM_STMT_PREPARE) are handled by matching the prepared sql against the match-parameters. If a match is found, the routing hints are attached to any execution of that prepared statement. Text- mode prepared statements are not supported in this way. To divert them, use regular expressions which match the specific "EXECUTE"-query.

    This will route all queries matching the regular expression *from *users to the server named server2. The filter will ignore character case in queries.

    A query like SELECT * FROM users would be routed to server2 where as a query like SELECT * FROM accounts would be routed according to the normal rules of the router.

    This page is licensed: CC BY-SA / Gnu FDL

    Authentication Modules

    Understand how MaxScale handles MySQL protocol authentication. This guide covers the User Account Manager, required database grants, and general authentication settings like matching hosts.

    This document describes general MySQL protocol authentication in MaxScale. For REST-api authentication, see the and the .

    Similar to the MariaDB Server, MaxScale uses authentication plugins to implement different authentication schemes for incoming clients. The same plugins also handle authenticating the clients to backend servers. The authentication plugins available in MaxScale are , , , and .

    Most of the authentication processing is performed on the protocol level, before handing it over to one of the plugins. This shared part is described in this document. For information on an individual plugin, see its documentation.

    Every MaxScale service with a MariaDB protocol listener requires knowledge of the user accounts defined on the backend databases. The service maintains this information in an internal component called the user account manager (UAM). The UAM queries relevant data from the mysql-database of the backends and stores it. Typically, only the current primary server is queried, as all servers are assumed to have the same users. The service settings

    Failure-tolerant replication and failover

    Build a resilient replication cluster. This guide explains how to combine MaxScale's failover with semi-synchronous replication to minimize data loss during crashes.

    The goal of this guide is to set up a replication cluster managed by MaxScale that is reasonably tolerant of failures. That is, even if one part fails, the cluster continues to work. Additionally, transaction data are preserved whenever possible. All of this works automatically.

    This guide assumes that the reader is familiar with MariaDB replication and GTIDs, , and .

    The basic problem of replication is that the primary and the replica are not always in the same state. When a commit is performed on the primary, the primary updates both the actual database file and the binary log. These items are updated in a transactional manner, either both succeed or fail. Then, the primary sends the binary log event to the replicas and they update their own databases and logs.

    A replica may crash or lose connection to the primary. Fortunately, this is not a big issue, because once the replica returns, it can simply resume replication from where it left off. The replica cannot diverge as it is always either in the same state as the primary, or behind. Only if the primary lacks the binary logs from the moment the replica went down, the replica is lost.

    Schemarouter: Simple Sharding With Two Servers

    Implement basic database sharding using the schemarouter. Learn to distribute data across multiple servers while presenting a single logical database to clients.

    Sharding is the method of splitting a single logical database server into separate physical databases. This tutorial describes a very simple way of sharding. Each schema is located on a different database server and MariaDB MaxScale's schemarouter module is used to combine them into a single logical database server.

    This tutorial was written for Ubuntu 22.04, MaxScale 23.08 and . In addition to the MaxScale server, you'll need two MariaDB servers which will be used for the sharding. The installation of MariaDB is not covered by this tutorial.

    The easiest way to install MaxScale is to use the MariaDB repositories.

    This tutorial uses a broader set of grants than is required for the sake of brevity and backwards compatibility. For the minimal set of grants, refer to the .

    All MaxScale configurations require at least two accounts: one for reading authentication data and another for monitoring the state of the database. Services will use the first one and monitors will use the second one. In addition to this, we want to have a separate account that our application will use.

    MaxScale Firewall Filter

    Protect your database by blocking unauthorized queries. This filter inspects incoming SQL against a defined set of rules to prevent SQL injection and unauthorized access.

    The database firewall acts as a protective barrier for a database, ensuring that only expected queries are allowed through. It learns the typical patterns of queries during a training period and then uses this knowledge to block any queries that do not match what it has learned. This helps safeguard the database from unauthorized access or potentially harmful operations.

    The firewall has two primary modes; a learning mode during which it learns what kind of statements are allowed and an enforcing mode during which it rejects or warns about non-allowed statements. In addition there is an idle mode, when the filter neither learns, nor enforces and a supervising mode, when the filter checks the incoming statements but takes no action but only warns about non-allowed statements.

    When in the learning mode a representative workload should be run through the filter. While the learning mode is active, the filter collects the canonical form of all statements that pass through it. The canonical form of a statement is the statement with all literals replaced with a question mark. For instance, the following two statements

    MaxScale Tee Filter

    Duplicate query traffic to multiple targets. This filter sends a copy of incoming requests to a secondary service or server useful for testing and auditing.

    The tee filter is a "plumbing" fitting in the MariaDB MaxScale filter toolkit. It can be used in a filter pipeline of a service to make copies of requests from the client and send the copies to another service within MariaDB MaxScale.

    Please Note: Starting with MaxScale 2.2.0, any client that connects to a service which uses a tee filter will require a grant for the loopback address, i.e. 127.0.0.1.

    The configuration block for the TEE filter requires the minimal filter parameters in its section within the MaxScale configuration file. The service to send the duplicates to must be defined.

    The tee filter requires a mandatory parameter to define the service to replicate statements to and accepts a number of optional parameters.

    MaxScale Top Filter

    Identify the most expensive queries. This filter logs the top N slowest queries passing through MaxScale helping to pinpoint performance bottlenecks.

    The top filter is a filter module for MariaDB MaxScale that monitors every SQL statement that passes through the filter. It measures the duration of that statement, the time between the statement being sent and the first result being returned. The top N times are kept, along with the SQL text itself and a list sorted on the execution times of the query is written to a file upon closure of the client session.

    Example minimal configuration:

    The top filter has one mandatory parameter, filebase, and a number of optional parameters.

    • Type: string

    In the section [Read-Write-Service], set user to maxscale and password to maxscale_passwd (or whatever user/password was created earlier).

    Configure a Read-Write Service

    Extend Read-Write Service

    Add a filter

    Test the GUI

    Further reading

    INI
    Docker image
    here
    here
    Configuration Guide
    ReadWriteSplit documentation
    MariaDB Monitor documentation
    ,
    case
    ,
    extended
  • Default: ignorecase

  • hint)
  • ->slave (adds a HINT_ROUTE_TO_SLAVE hint)

  • ->all (legacy hint that never did anything, ignored)

  • Settings

    matchXY

    options

    targetXY

    source

    user

    Additional remarks

    Examples

    Example 1 - Route queries targeting a specific table to a server

    Hint-Syntax
    regex
    PCRE2 regular expression
    enum
    Regular expression options
    spinner
    MaxScale Trial
    user
    and
    password
    define the credentials used when fetching user accounts.

    The service uses the stored data when authenticating clients, checking their passwords and database access rights. This results in an authentication process very similar to the MariaDB Server itself. Unauthorized users are generally detected already at the MaxScale level instead of the backend servers. This may not apply in some cases, for example if MaxScale is using old user account data.

    If authentication fails, the UAM updates its data from a backend. MaxScale may attempt authenticating the client again with the refreshed data without communicating the first failure to the client. This transparent user data update does not always work, in which case the client should try to log in again.

    As the UAM is shared between all listeners of a service, its settings are defined in the service configuration. For more information, search the configuration guide for users_refresh_time, users_refresh_interval and auth_all_servers. Other settings which affect how the UAM connects to backends are the global settings auth_connect_timeout and local_address, and the various server-level ssl-settings.

    To properly fetch user account information, the MaxScale service user must be able to read from various tables in the mysql-database: user, db, tables_priv, columns_priv, procs_priv, proxies_priv, global_priv and roles_mapping. The user should also have the SHOW DATABASES-grant.

    The SET USER grant is optional but recommended if MaxScale is used with MariaDB version 12 or newer. Granting it to the service user allows the backend authentication to use the service credentials to log in after which the final user account is selected using the SET SESSION AUTHORIZATION command. For more information, refer to the documentation of the use_service_credentials setting.

    If using MariaDB ColumnStore, the following grant is required:

    When a client logs in to MaxScale, MaxScale sees the client's IP address. When MaxScale then connects the client to backends (using the client's username and password), the backends see the connection coming from the IP address of MaxScale. If the client user account is to a wildcard host ('alice'@'%'), this is not an issue. If the host is restricted ('alice'@'123.123.123.123'), authentication to backends will fail.

    There are two primary ways to deal with this:

    1. Duplicate user accounts. For every user account with a restricted hostname an equivalent user account for MaxScale is added ('alice'@'maxscale-ip').

    2. Use proxy protocol.

    Option 1 limits the passwords for user accounts with shared usernames. Such accounts must use the same password since they will effectively share the MaxScale-to-backend user account. Option 2 requires server support.

    See MaxScale Troubleshooting for additional information on how to solve authentication issues.

    MaxScale supports wildcards _ and % for database-level grants. As with MariaDB Server, grant select on test_.* to 'alice'@'%'; gives access to test_ as well as test1, test2 and so on. If the GRANT command escapes the wildcard (grant select on \test_`.* to 'alice'@'%';) both MaxScale and the MariaDB Server interpret it as only allowing access to _test\__. _and%are only interpreted as wildcards when the grant is to a database:grant select on `test_`.t1 to 'alice'@'%';` only grants access to the test_.t1-table, not to test1.t1.

    The listener configuration defines authentication options which only affect the listener. authenticator defines the authentication plugins to use. authenticator_options sets various options. These options may affect an individual authentication plugin or the authentication as a whole. The latter are explained below. Multiple options can be given as a comma-separated list.

    • Type: boolean

    • Mandatory: No

    • Dynamic: No

    • Default: false

    If enabled, MaxScale will not check the passwords of incoming clients and just assumes that they are correct. Wrong passwords are instead detected when MaxScale tries to authenticate to the backend servers.

    This setting is mainly meant for failure tolerance in situations where the password check is performed outside of MaxScale. If, for example, MaxScale cannot use an LDAP-server but the backend databases can, enabling this setting allows clients to log in. Even with this setting enabled, a user account matching the incoming client username and IP must exist on the backends for MaxScale to accept the client.

    This setting is incompatible with standard MariaDB/MySQL authentication plugin (MariaDBAuth in MaxScale). If enabled, MaxScale cannot authenticate clients to backend servers using standard authentication.

    • Type: boolean

    • Mandatory: No

    • Dynamic: No

    • Default: true

    If disabled, MaxScale does not require that a valid user account entry for incoming clients exists on the backends. Specifically, only the client username needs to match a user account, hostname/IP is ignored.

    This setting may be used to force clients to connect through MaxScale. Normally, creating the user jdoe@% will allow the user jdoe to connect from any IP-address. By disabling match_host and replacing the user with_jdoe@maxscale-IP_, the user can still connect from any client IP but will be forced to go through MaxScale.

    • Type: number

    • Mandatory: No

    • Dynamic: No

    • Default: 0

    Controls database name matching for authentication when an incoming client logs in to a non-empty database. The setting functions similar to the MariaDB Server setting lower_case_table_names and should be set to the value used by the backends.

    The setting accepts the values 0, 1 or 2:

    • 0: case-sensitive matching (default)

    • 1: convert the requested database name to lower case before using case-insensitive matching. Assumes that database names on the server are stored in lower case.

    • 2: use case-insensitive matching.

    true and false are also accepted for backwards compatibility. These map to 1 and 0, respectively.

    The identifier names are converted using an ASCII-only function. This means that non-ASCII characters will retain their case-sensitivity.

    Starting with MaxScale versions 2.5.25, 6.4.6, 22.08.5 and 23.02.2, the behavior of lower_case_table_names=1 is identical with how the MariaDB server behaves. In older releases the comparisons were done in a case-sensitive manner after the requested database name was converted into lowercase. Using lower_case_table_names=2 will behave identically in all versions which makes it a safe alternative to use when a mix of older and newer MaxScale versions is being used.

    This page is licensed: CC BY-SA / Gnu FDL

    User account management

    configuration guide
    REST-api guide
    standard MySQL password
    GSSAPI
    ed25519
    PARSEC
    pluggable authentication modules (PAM)

    Required grants

    Limitations and troubleshooting

    Wildcard database grants

    Settings

    skip_authentication

    match_host

    lower_case_table_names

    spinner

    Type: target

  • Mandatory: No

  • Dynamic: Yes

  • Default: none

  • The target where the filter will duplicate all queries. The target can be either a service or a server. The duplicate connection that is created to this target will be referred to as the "branch target" in this document.

    • Type: service

    • Mandatory: No

    • Dynamic: Yes

    • Default: none

    The service where the filter will duplicate all queries. This parameter is deprecated in favor of the target parameter and will be removed in a future release. Both target and service cannot be defined.

    • Type: regex

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    What queries should be included.

    • Type: regex

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    What queries should be excluded.

    • Type: enum

    • Mandatory: No

    • Dynamic: Yes

    • Values: ignorecase, case, extended

    • Default: ignorecase

    How regular expressions should be interpreted.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    The optional source parameter defines an address that is used to match against the address from which the client connection to MariaDB MaxScale originates. Only sessions that originate from this address will be replicated.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    The optional user parameter defines a user name that is used to match against the user from which the client connection to MariaDB MaxScale originates. Only sessions that are connected using this username are replicated.

    • Type: boolean

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    Enable synchronous routing mode. When configured with sync=true, the filter will queue new queries until the response from both the main and the branch target has been received. This means that for n executed queries, n - 1 queries are guaranteed to be synchronized. Adding one extra statement (e.g. SELECT 1) to a batch of statements guarantees that all previous SQL statements have been successfully executed on both targets.

    In the synchronous routing mode, a failure of the branch target will cause the client session to be closed.

    • All statements that are executed on the branch target are done in an asynchronous manner. This means that when the client receives the response there is no guarantee that the statement has completed on the branch target. The sync feature provides some synchronization guarantees that can be used to verify successful execution on both targets.

    • Any errors on the branch target will cause the connection to it to be closed. If target is a service, it is up to the router to decide whether the connection is closed. For direct connections to servers, any network errors cause the connection to be closed. When the connection is closed, no new queries will be routed to the branch target.

    With sync=true, a failure of the branch target will cause the whole session to be closed.

    Read Module Commands documentation for details about module commands.

    The tee filter supports the following module commands.

    This command disables a tee filter instance. A disabled tee filter will not send any queries to the target service.

    Enable a disabled tee filter. This resumes the sending of queries to the target service.

    Assume an order processing system that has a table called orders. You also have another database server, the datamart server, that requires all inserts into orders to be replicated to it. Deletes and updates are not, however, required.

    Set up a service in MariaDB MaxScale, called Orders, to communicate with the order processing system with the tee filter applied to it. Also set up a service to talk to the datamart server, using the DataMart service. The tee filter would have as its service entry the DataMart service, by adding a match parameter of "insert into orders" would then result in all requests being sent to the order processing system, and insert statements that include the orders table being additionally sent to the datamart server.

    This page is licensed: CC BY-SA / Gnu FDL

    Overview

    Configuration

    Settings

    target

    service

    match

    exclude

    options

    source

    user

    sync

    Limitations

    Module commands

    tee disable [FILTER]

    tee enable [FILTER]

    Examples

    Example 1 - Replicate all inserts into the orders table

    spinner

    Mandatory: Yes

  • Dynamic: Yes

  • The basename of the output file created for each session. The session ID is added to the filename for each file written. This is a mandatory parameter.

    The filebase may also be set as the filter, the mechanism to set the filebase via the filter option is superseded by the parameter. If both are set the parameter setting will be used and the filter option ignored.

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 10

    The number of SQL statements to store and report upon.

    • Type: regex

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    Limits the queries logged by the filter.

    • Type: regex

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    Limits the queries logged by the filter.

    • Type: enum

    • Mandatory: No

    • Dynamic: No

    • Values: ignorecase, case, extended

    • Default: case

    Regular expression options for match and exclude.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    Defines an address that is used to match against the address from which the client connection to MariaDB MaxScale originates. Only sessions that originate from this address will be logged.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    Defines a username that is used to match against the user from which the client connection to MariaDB MaxScale originates. Only sessions that are connected using this username will result in results being generated.

    You have an order system and believe the updates of the PRODUCTS table is causing some performance issues for the rest of your application. You would like to know which of the many updates in your application is causing the issue.

    Add a filter with the following definition:

    Note the exclude entry, this is to prevent updates to the PRODUCTS_STOCK table from being included in the report.

    One of your applications servers is slower than the rest, you believe it is related to database access but you are not sure what is taking the time.

    Add a filter with the following definition:

    In order to produce a comparison with an unaffected application server you can also add a second filter as a control.

    In the service definition add both filters

    You will then have two sets of logs files written, one which profiles the top 20 queries of the slow application server and another that gives you the top 20 queries of your control application server. These two sets of files can then be compared to determine what if anything is different between the two.

    The following is an example report for a number of fictitious queries executed against the employees example database available for MySQL.

    This page is licensed: CC BY-SA / Gnu FDL

    Overview

    Configuration

    Settings

    filebase

    count

    match

    exclude

    options

    source

    user

    Examples

    Example 1 - Heavily Contended Table

    Example 2 - One Application Server is Slow

    Output Report

    spinner
    CREATE USER 'maxscale_monitor'@'%' IDENTIFIED BY 'monitor_password';
    GRANT BINLOG ADMIN, BINLOG MONITOR, CONNECTION ADMIN, READ_ONLY ADMIN, REPLICATION SLAVE ADMIN, SLAVE MONITOR, RELOAD, PROCESS, SUPER, EVENT, SET USER, SHOW DATABASES ON *.* TO `maxscale_monitor`@`%`;
    GRANT SELECT ON mysql.global_priv TO 'maxscale_monitor'@'%';
    [Read-Write-Service]
    type=service
    # The readwritesplit router module load balances reads and routes writes to the primary node
    router=readwritesplit
    # Servers available for this service
    cluster=MariaDB-Cluster
    # The user account used to fetch the user information from MariaDB
    user=maxscale_user
    password=maxscale_password
    CREATE USER 'maxscale_user'@'%' IDENTIFIED BY 'maxscale_password';
    GRANT SELECT ON mysql.user TO 'maxscale_user'@'%';
    GRANT SELECT ON mysql.db TO 'maxscale_user'@'%';
    GRANT SELECT ON mysql.tables_priv TO 'maxscale_user'@'%';
    GRANT SELECT ON mysql.columns_priv TO 'maxscale_user'@'%';
    GRANT SELECT ON mysql.procs_priv TO 'maxscale_user'@'%';
    GRANT SELECT ON mysql.proxies_priv TO 'maxscale_user'@'%';
    GRANT SELECT ON mysql.roles_mapping TO 'maxscale_user'@'%';
    GRANT SHOW DATABASES ON *.* TO 'maxscale_user'@'%';
    [Read-Write-Listener]
    type=listener
    # The service that this listener connects to
    service=Read-Write-Service
    # The port that MaxScale will listen on for client applications
    port=3306
    [maxscale]
    # Select the number of worker threads automatically based on the CPU thread count
    threads=auto
    CREATE USER 'maxscale' IDENTIFIED BY 'maxscale_passwd';
    GRANT ALL PRIVILEGES ON *.* to 'maxscale';
    [maxscale]
    threads=auto
    
    [server1]
    type=server
    address=127.0.0.1
    port=3306
    
    [MariaDB-Monitor]
    type=monitor
    module=mariadbmon
    servers=server1
    user=maxscale
    password=maxscale_passwd
    monitor_interval=2s
    
    [Read-Write-Listener]
    type=listener
    service=Read-Write-Service
    port=4006
    
    [Read-Write-Service]
    type=service
    router=readwritesplit
    cluster=MariaDB-Monitor
    user=maxscale
    password=maxscale_passwd
    ┌─────────┬───────────┬───────┬─────────────┬─────────────────┬─────────┬─────────────────┐
    │ Server  │ Address   │ Port  │ Connections │ State           │ GTID    │ Monitor         │
    ├─────────┼───────────┼───────┼─────────────┼─────────────────┼─────────┼─────────────────┤
    │ server1 │ 127.0.0.1 │ 3306  │ 0           │ Master, Running │ 1-100-3 │ MariaDB-Monitor │
    └─────────┴───────────┴───────┴─────────────┴─────────────────┴─────────┴─────────────────┘
    2024-09-17 17:55:55   notice : Read 16 user@host entries from 'server1' for service 'Read-Write-Service'.
    mariadb -h127.0.0.1 -P4006 -umaxscale -pmaxscale_passwd
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 7
    Server version: 11.4.3-MariaDB-log MariaDB Server
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]> select 1;
    +---+
    | 1 |
    +---+
    | 1 |
    +---+
    1 row in set (0,001 sec)
    [MariaDB-Monitor]
    type=monitor
    module=mariadbmon
    servers=server1,server2,server3
    user=maxscale
    password=maxscale_passwd
    monitor_interval=2s
    ┌─────────┬───────────┬───────┬─────────────┬─────────────────┬─────────┬─────────────────┐
    │ Server  │ Address   │ Port  │ Connections │ State           │ GTID    │ Monitor         │
    ├─────────┼───────────┼───────┼─────────────┼─────────────────┼─────────┼─────────────────┤
    │ server1 │ 127.0.0.1 │ 3306  │ 0           │ Master, Running │ 1-100-3 │ MariaDB-Monitor │
    ├─────────┼───────────┼───────┼─────────────┼─────────────────┼─────────┼─────────────────┤
    │ server2 │ 127.0.0.1 │ 3307  │ 0           │ Slave, Running  │ 1-100-3 │ MariaDB-Monitor │
    ├─────────┼───────────┼───────┼─────────────┼─────────────────┼─────────┼─────────────────┤
    │ server3 │ 127.0.0.1 │ 3308  │ 0           │ Slave, Running  │ 1-100-3 │ MariaDB-Monitor │
    └─────────┴───────────┴───────┴─────────────┴─────────────────┴─────────┴─────────────────┘
    [MyLogFilter]
    type=filter
    module=qlafilter
    filebase=/var/log/maxscale/query_log
    log_type=unified
    flush=true
    [Read-Write-Service]
    type=service
    filters=MyLogFilter
    router=readwritesplit
    cluster=MariaDB-Monitor
    user=maxscale
    password=maxscale_passwd
    [NamedServerFilter]
    type=filter
    module=namedserverfilter
    match01=^Select.*TableOne$
    target01=server2,server3
    match22=^SELECT.*TableTwo$
    target22=->master
    
    [MyService]
    type=service
    router=readwritesplit
    servers=server1,server2,server3
    user=myuser
    password=mypasswd
    filters=NamedServerFilter
    match01=^SELECT
    options=case,extended
    target01=MyServer2
    source=127.0.0.1
    source=192.%.%.%
    source=192.168.%.%
    source=192.168.10.%
    source=192.168.21.3,192.168.10.%
    user=john
    [NamedServerFilter]
    type=filter
    module=namedserverfilter
    match02= *from *users
    target02=server2
    
    [MyService]
    type=service
    router=readwritesplit
    servers=server1,server2
    user=myuser
    password=mypasswd
    filters=NamedServerFilter
    license_key=<key>
    CREATE USER 'maxscale'@'maxscalehost' IDENTIFIED BY 'maxscale-password';
    GRANT SELECT ON mysql.user TO 'maxscale'@'maxscalehost';
    GRANT SELECT ON mysql.db TO 'maxscale'@'maxscalehost';
    GRANT SELECT ON mysql.tables_priv TO 'maxscale'@'maxscalehost';
    GRANT SELECT ON mysql.columns_priv TO 'maxscale'@'maxscalehost';
    GRANT SELECT ON mysql.procs_priv TO 'maxscale'@'maxscalehost';
    GRANT SELECT ON mysql.proxies_priv TO 'maxscale'@'maxscalehost';
    GRANT SELECT ON mysql.global_priv TO 'maxscale'@'maxscalehost';
    GRANT SELECT ON mysql.roles_mapping TO 'maxscale'@'maxscalehost';
    GRANT SHOW DATABASES ON *.* TO 'maxscale'@'maxscalehost';
    GRANT SET USER ON *.* TO 'maxscale'@'maxscalehost';
    GRANT ALL ON infinidb_vtable.* TO 'maxscale'@'maxscalehost';
    authenticator_options=skip_authentication=true,lower_case_table_names=1
    authenticator_options=skip_authentication=true
    authenticator_options=match_host=false
    authenticator_options=lower_case_table_names=0
    [DataMartFilter]
    type=filter
    module=tee
    target=DataMart
    
    [Data-Service]
    type=service
    router=readconnroute
    servers=server1
    user=myuser
    password=mypasswd
    filters=DataMartFilter
    match=/insert.*into.*order*/
    exclude=/select.*from.*t1/
    options=case,extended
    source=127.0.0.1
    user=john
    [Orders]
    type=service
    router=readconnroute
    servers=server1, server2, server3, server4
    user=massi
    password=6628C50E07CCE1F0392EDEEB9D1203F3
    filters=ReplicateOrders
    
    [ReplicateOrders]
    type=filter
    module=tee
    target=DataMart
    match=insert[   ]*into[     ]*orders
    
    [DataMart]
    type=service
    router=readconnroute
    servers=datamartserver
    user=massi
    password=6628C50E07CCE1F0392EDEEB9D1203F3
    filters=QLA-DataMart
    
    [QLA-DataMart]
    type=filter
    module=qlafilter
    options=/var/log/DataMart/InsertsLog
    
    [Orders-Listener]
    type=listener
    target=Orders
    port=4011
    
    [DataMart-Listener]
    type=listener
    target=DataMart
    port=4012
    [MyLogFilter]
    type=filter
    module=topfilter
    
    [Service]
    type=service
    router=readconnroute
    servers=server1
    user=myuser
    password=mypasswd
    filters=MyLogFilter
    filebase=/tmp/SqlQueryLog
    count=30
    match=select.*from.*customer.*where
    exclude=where
    options=case,extended
    source=127.0.0.1
    user=john
    [ProductsUpdateTop20]
    type=filter
    module=topfilter
    count=20
    match=UPDATE.*PRODUCTS.*WHERE
    exclude=UPDATE.*PRODUCTS_STOCK.*WHERE
    filebase=/var/logs/top/ProductsUpdate
    [SlowAppServer]
    type=filter
    module=topfilter
    count=20
    source=192.168.0.32
    filebase=/var/logs/top/SlowAppServer
    [ControlAppServer]
    
    type=filter
    module=topfilter
    count=20
    source=192.168.0.42
    filebase=/var/logs/top/ControlAppServer
    [App-Service]
    type=service
    router=readconnroute
    servers=server1
    user=myuser
    password=mypasswd
    filters=SlowAppServer | ControlAppServer
    -bash-4.1$ cat /var/logs/top/Employees-top-10.137
    
    Top 10 longest running queries in session.
    
    ==========================================
    
    Time (sec) | Query
    
    -----------+-----------------------------------------------------------------
    
        22.985 |  select sum(salary), year(from_date) from salaries s, (select distinct year(from_date) as y1 from salaries) y where (makedate(y.y1, 1) between s.from_date and s.to_date) group by y.y1
    
         5.304 |  select d.dept_name as "Department", y.y1 as "Year", count(*) as "Count" from departments d, dept_emp de, (select distinct year(from_date) as y1 from dept_emp order by 1) y where d.dept_no = de.dept_no and (makedate(y.y1, 1) between de.from_date and de.to_date) group by y.y1, d.dept_name order by 1, 2
    
         2.896 |  select year(now()) - year(birth_date) as age, gender, avg(salary) as "Average Salary" from employees e, salaries s where e.emp_no = s.emp_no and ("1988-08-01"  between from_date AND to_date) group by year(now()) - year(birth_date), gender order by 1,2
    
         2.160 |  select dept_name as "Department", sum(salary) / 12 as "Salary Bill" from employees e, departments d, dept_emp de, salaries s where e.emp_no = de.emp_no and de.dept_no = d.dept_no and ("1988-08-01"  between de.from_date AND de.to_date) and ("1988-08-01"  between s.from_date AND s.to_date) and s.emp_no = e.emp_no group by dept_name order by 1
    
         0.845 |  select dept_name as "Department", avg(year(now()) - year(birth_date)) as "Average Age", gender from employees e, departments d, dept_emp de where e.emp_no = de.emp_no and de.dept_no = d.dept_no and ("1988-08-01"  between from_date AND to_date) group by dept_name, gender
    
         0.668 |  select year(hire_date) as "Hired", d.dept_name, count(*) as "Count" from employees e, departments d, dept_emp de where de.emp_no = e.emp_no and de.dept_no = d.dept_no group by d.dept_name, year(hire_date)
    
         0.249 |  select moves.n_depts As "No. of Departments", count(moves.emp_no) as "No. of Employees" from (select de1.emp_no as emp_no, count(de1.emp_no) as n_depts from dept_emp de1 group by de1.emp_no) as moves group by moves.n_depts order by 1
    
         0.245 |  select year(now()) - year(birth_date) as age, gender, count(*) as "Count" from employees group by year(now()) - year(birth_date), gender order by 1,2
    
         0.179 |  select year(hire_date) as "Hired", count(*) as "Count" from employees group by year(hire_date)
    
         0.160 |  select year(hire_date) - year(birth_date) as "Age", count(*) as Count from employees group by year(hire_date) - year(birth_date) order by 1
    
    -----------+-----------------------------------------------------------------
    
    Session started Wed Jun 18 18:41:03 2014
    
    Connection from 127.0.0.1
    
    Username        massi
    
    Total of 24 statements executed.
    
    Total statement execution time      35.701 seconds
    
    Average statement execution time     1.488 seconds
    
    Total connection time               46.500 seconds
    
    -bash-4.1$
    If the primary crashes or loses network connection, failover may lose data. This depends on the point in time at which the crash happens:
    1. If the primary managed to send all committed transactions to a replica, all is still well. The replica has all the data, and can be promoted to primary e.g. by MaxScale (which, in that case, promotes the most up-to-date replica). Once the old primary returns, it can rejoin the cluster.

    2. If the primary crashes just after it committed a transaction and updated its binary log, but before it sent the binary log event to a replica, failover loses data and the old primary can no longer rejoin the cluster.

    Let’s look at situation 2 in more detail. server1 is the original primary and server2 and server3 are its replicas, with server ids 1, 2 and 3, respectively. server1 is at gtid 1-1-101 when it crashes, while the others have replicated to the previous event 1-1-100. The example server status output below is for demonstration only, since in reality it would be unlikely that the monitor would manage to update the gtid-position of server1 right at the moment of crash.

    server1 stays down long enough for failover to activate. (In MaxScale, the time is roughly monitor_interval * failcount.) server2 gets promoted, and MaxScale routes any new writes to it. server2 starts generating binary log events with gtids 1-2-101, 1-2-102 and so on. If server1 now comes back online, it can no longer rejoin as it is at gtid 1-1-101, which conflicts with 1-2-101.

    At this point, the DBA could forcefully alter the gtid of server1, setting it to 1-1-100, which is in server2’s binary log, enabling rejoin. This is usually ill-advised, as changing the gtid does not roll back the actual data in server2’s database, meaning that data conflicts can still happen, perhaps days later. A more reliable way to handle this case is to rebuild server1 from one of the other servers. (MaxScale can help with this process, but it requires configuration and manual launching.)

    If the old primary returns before failover activates, replication can continue regardless of what exact moment the crash happened. This means that the DBA should configure automatic failover to happen only after the primary has been down so long that the downsides of service outage outweigh the threat of losing data and the need of having to rebuild the old primary. monitor_interval * failcount should at a minimum be large enough that failover does not trigger due to a momentary network failure.

    Semi-synchronous replication offers a more reliable, but also a more complicated way to keep the cluster in sync. Semi-sync replication means that after the primary commits a transaction, it does not immediately return an OK to the client. Instead, the primary sends the binary log update to the replicas and waits for an acknowledgement from at least one replica before sending the OK message back to the client. This means that once the client gets the OK, the transaction data is typically on at least two servers. This is not absolutely certain, though, as the primary does not wait forever for the replica acknowledgement. If no replica responds in time, the primary switches to normal replication and returns OK to the client. This timeout is controlled by MariaDB Server setting rpl_semi_sync_master_timeout. If this limit is being hit, the client should notice it by the transaction visibly stalling. Even if this limit is not hit, throughput suffers compared to normal replication, due to the additional waiting.

    Semi-synchronous replication by itself does not remove the possibility of the primary diverging after a crash. Scenario 2 presented in the previous section can still happen if the primary crashes after applying the transaction but before sending it to replicas. To increase crash safety, a few settings need to be tuned to change the behavior of the primary server both during replication and during startup after a crash (crash recovery).

    To enable semi-synchronous replication, add the following to the configuration files of all servers:

    These settings allow the servers to act as both semi-sync primary and replica, which is useful when combined with automatic failover. Restart the servers and run SHOW STATUS LIKE 'rpl%';, a statement that shows semi-sync related status variables. Check the values of Rpl_semi_sync_master_clients, Rpl_semi_sync_master_status and Rpl_semi_sync_slave_status. On the primary, their values should be:

    1. Rpl_semi_sync_master_clients: <number of replicas>

    2. Rpl_semi_sync_master_status: ON

    3. Rpl_semi_sync_slave_status: OFF

    On the replicas, the values should be:

    1. Rpl_semi_sync_master_clients: 0

    2. Rpl_semi_sync_master_status: ON

    3. Rpl_semi_sync_slave_status: ON

    Next, change the point at which the primary server waits for the replica acknowledgement. By default, this is after the transaction is written to storage, which is not much different compared to normal replication. Set the following in the server configuration files:

    AFTER_SYNC means that the primary sends the binary log event to replicas, after writing it to the binary log but before committing the actual transaction to its own storage. The primary only updates its internal storage when at least one replica gives the reply or when the rpl_semi_sync_master_timeout is reached. More importantly, this means that if the primary crashes while waiting for the reply, its binary log and storage engine will be out of sync. On startup, the server must thus decide what to do: either consider the binary log correct and apply the missing transactions to storage, or discard the unverified binary log events.

    As of MariaDB Server 10.6.19, 10.11.9, 11.1.6, 11.2.5, 11.4.3 and 11.5.2, this decision is controlled by the startup option init-rpl-role. If set to MASTER, the server applies the transactions during startup, as it assumes to still be the primary. If init-rpl-role is set to SLAVE, the server discards the transactions. The former option does not improve the situation after a failover, as the primary could apply transactions that never made it to a replica. The latter option, on the other hand, ensures that, when the old primary comes back online, it does not have conflicting transactions and can rejoin the cluster as a replica. So, add the following to all server configurations:

    This scheme is not entirely without issues. init-rpl-role=SLAVE means that the old primary (server1) always discards the unverified transactions during startup, even if the data did successfully replicate to a replica before the crash (server1 crashed after sending the data but before receiving the reply). This is not an issue if failover has already occurred by this point, as server1 can just fetch the same writes from the new primary (server2). However, if server1 comes back online quickly, before failover, it could be behind server2: server1 at gtid 1-1-100 and server2 at 1-1-101.

    As server1 is still the primary, MaxScale sends any new writes to it. The next write will get gtid 1-1-101, meaning that both servers are on the same gtid but their actual contents likely differ. This will cause a replication error at some point.

    This means that if a primary server crashes, it must stay down long enough for failover to occur, and to ensure MaxScale does not treat it as the primary once it returns. This can be enforced by changing the service settings. Run sudo systemctl edit mariadb.service on all server machines and add the following:

    The configured time needs to be comfortably longer than monitor_interval * failcount configured to the MariaDB Monitor in MaxScale.

    The setup described above protects against a primary server crashing and its diversion from the rest of the cluster. It does not protect from data loss due to network outages. If the connection to the primary server is lost during a transaction commit (before the data was replicated), the primary will eventually apply the transaction to its storage. If a failover occurred during the network outage, the rest of the cluster has already continued under a new primary, leaving the old one diverged. This is similar to normal replication.

    Some queries are not transactional and may still risk diverging replication. These are typically DDL queries such as CREATE TABLE, ALTER TABLE, and so on. DDL queries can be transactional if the changes they do are “small”, such as renaming a column. Large-scale DDL queries (e.g. ADD COLUMN to a table with a billion rows) are more vulnerable. The settings presented in this document were only tested against simple DML queries that updated a single row.

    If the client gets an OK to its commit command, then it knows that (assuming no semi-sync timeout happened) the transaction is in at least two servers. Only the primary has with certainty processed the update at this point; the replica may just have the event in its relay log. This means that SELECT queries routed to a replica (e.g. by the ReadWriteSplit router) may see old data.

    If the client does not get an OK due to primary crash, the situation is more ambiguous:

    1. Primary crashed before starting the commit

    2. Primary crashed just before receiving the replica acknowledgement

    3. Primary crashed just as it was about to send the OK

    In case 1, the transaction is lost. In case 2, the transaction is present on the replica and will become visible at some point. In case 3, the transaction is present on both servers. Since MaxScale cannot know which case is in effect, it does not attempt transaction replay (even if configured) and disconnects the client. It’s up to the client to then reconnect and figure out the status of the transaction.

    The server settings used during testing are below. rpl_semi_sync_master_timeout is given in milliseconds, rpl_semi_sync_slave_kill_conn_timeout in seconds.

    The MariaDB Monitor in MaxScale was configured with both auto_failover and auto_rejoin enabled. Hundreds of failovers with continuous write traffic succeeded without a diverging old primary. When init-rpl-role was changed to MASTER, replication eventually broke, although this could take some time.

    This page is licensed: CC BY-SA / Gnu FDL

    Introduction

    The Problem with Normal Replication

    MariaDB Monitor
    failover
    $ maxctrl list servers
    ┌──────────┬─────────────────┬──────┬─────────────┬────────┬────────────────────┬─────────┬──────────┐
    │ Server   │ Address         │ Port │ Connections │ Status │ Status Info        │ GTID    │ Monitor  │
    ├──────────┼─────────────────┼──────┼─────────────┼────────┼────────────────────┼─────────┼──────────┤
    │ server1  │ 192.168.121.51  │ 3306 │ 0           │ Write  │ Down               │ 1-1-101 │ Monitor1 │
    ├──────────┼─────────────────┼──────┼─────────────┼────────┼────────────────────┼─────────┼──────────┤
    │ server2  │ 192.168.121.190 │ 3306 │ 0           │ Read   │ Replica, read_only │ 1-1-100 │ Monitor1 │
    ├──────────┼─────────────────┼──────┼─────────────┼────────┼────────────────────┼─────────┼──────────┤
    │ server3  │ 192.168.121.112 │ 3306 │ 0           │ Read   │ Replica, read_only │ 1-1-100 │ Monitor1 │
    └──────────┴─────────────────┴──────┴─────────────┴────────┴────────────────────┴─────────┴──────────┘
    $ maxctrl list servers
    ┌──────────┬─────────────────┬──────┬─────────────┬────────┬────────────────────┬─────────┬──────────┐
    │ Server   │ Address         │ Port │ Connections │ Status │ Status Info        │ GTID    │ Monitor  │
    ├──────────┼─────────────────┼──────┼─────────────┼────────┼────────────────────┼─────────┼──────────┤
    │ server1  │ 192.168.121.51  │ 3306 │ 0           │ Up     │                    │ 1-1-101 │ Monitor1 │
    ├──────────┼─────────────────┼──────┼─────────────┼────────┼────────────────────┼─────────┼──────────┤
    │ server2  │ 192.168.121.190 │ 3306 │ 0           │ Write  │ Primary            │ 1-2-102 │ Monitor1 │
    ├──────────┼─────────────────┼──────┼─────────────┼────────┼────────────────────┼─────────┼──────────┤
    │ server3  │ 192.168.121.112 │ 3306 │ 0           │ Read   │ Replica, read_only │ 1-2-102 │ Monitor1 │
    └──────────┴─────────────────┴──────┴─────────────┴────────┴────────────────────┴─────────┴──────────┘
    rpl_semi_sync_master_enabled=ON
    rpl_semi_sync_slave_enabled=ON
    rpl_semi_sync_master_wait_point=AFTER_SYNC
    init-rpl-role=SLAVE
    $ maxctrl list servers
    ┌──────────┬─────────────────┬──────┬─────────────┬────────┬────────────────────┬─────────┬──────────┐
    │ Server   │ Address         │ Port │ Connections │ Status │ Status Info        │ GTID    │ Monitor  │
    ├──────────┼─────────────────┼──────┼─────────────┼────────┼────────────────────┼─────────┼──────────┤
    │ server1  │ 192.168.121.51  │ 3306 │ 0           │ Write  │ Primary            │ 1-1-100 │ Monitor1 │
    ├──────────┼─────────────────┼──────┼─────────────┼────────┼────────────────────┼─────────┼──────────┤
    │ server2  │ 192.168.121.190 │ 3306 │ 0           │ Read   │ Replica, read_only │ 1-1-101 │ Monitor1 │
    ├──────────┼─────────────────┼──────┼─────────────┼────────┼────────────────────┼─────────┼──────────┤
    │ server3  │ 192.168.121.112 │ 3306 │ 0           │ Read   │ Replica, read_only │ 1-1-101 │ Monitor1 │
    └──────────┴─────────────────┴──────┴─────────────┴────────┴────────────────────┴─────────┴──────────┘
    [Service]
    RestartSec=1min
    rpl_semi_sync_master_enabled=ON
    rpl_semi_sync_slave_enabled=ON
    rpl_semi_sync_master_wait_point=AFTER_SYNC
    rpl_semi_sync_master_timeout=6000
    rpl_semi_sync_slave_kill_conn_timeout=5
    init-rpl-role=SLAVE
    gtid_strict_mode=1
    log_slave_updates=1

    Semi-Synchronous Replication

    This page assumes a single MaxScale. If multiple MaxScale instances monitor the same cluster, rpl_semi_sync_master_timeout needs different tuning — see .

    Enable Semi-Synchronous Replication

    Configure Wait Point and Startup Role

    Configure Service Restart Delay

    Failure Scenarios

    Client Perspective

    Test Summary

    spinner

    The grants required by the server user are documented here and the grants required by the Galera monitor user are documented here.

    All of the users must be created on both of the MariaDB servers.

    In case there are problems, please check [limitations and troubleshooting]((../maxscale-security/authentication-modules.md#limitations-and-troubleshooting).

    Each server will hold one unique schema which contains the data of one specific customer. We'll also create a shared schema that is present on all shards that the shard-local tables can be joined into.

    Create the tables on the first server:

    Create the tables on the second server:

    The MaxScale configuration is stored in /etc/maxscale.cnf.

    First, we configure two servers we will use to shard our database. The db-01 server has the customer_01 schema and the db-02 server has the customer_02 schema.

    The next step is to configure the service which the users connect to. This section defines which router to use, which servers to connect to and the credentials to use. For sharding, we use schemarouter router and the service_user credentials we defined earlier. By default the schemarouter warns if two or more nodes have duplicate schemas so we need to ignore them withignore_tables_regex=.*.

    After this we configure a listener for the service. The listener is the actual port that the user connects to. We will use the port 4000.

    The final step is to configure a monitor which will monitor the state of the servers. The monitor will notify MariaDB MaxScale if the servers are down. We add the two servers to the monitor and use the monitor_user credentials. For the sharding use-case, the galeramon module is suitable even if we're not using a Galera cluster. The schemarouter is only interested in whether the server is in the Running state or in the Down state.

    After this we have a fully working configuration and the contents of/etc/maxscale.cnf should look like this.

    Then you're ready to start MaxScale.

    MariaDB MaxScale is now ready to start accepting client connections and routing them. Queries are routed to the right servers based on the database they target and switching between the shards is seamless since MariaDB MaxScale keeps the session state intact between servers.

    To test, we query the schema that's located on the local shard and join it to the shared table.

    The sharding also works even if no default database is selected.

    One limitation of this sort of simple sharding is that cross-shard joins are not possible.

    In most multi-tenant situations, this is an acceptable limitation. If you do need cross-shard joins, the Spider storage engine will provide you this.

    This page is licensed: CC BY-SA / Gnu FDL

    # Install MaxScale
    apt update
    apt -y install sudo curl
    curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash
    apt -y install maxscale

    Environment

    Installing MaxScale

    Creating Users

    MaxScale Configuration Guide
    -- Create the user for the service
    CREATE USER 'service_user'@'%' IDENTIFIED BY 'secret';
    GRANT SELECT ON mysql.* TO 'service_user'@'%';
    GRANT SHOW DATABASES ON *.* TO 'service_user'@'%';
    
    -- Create the user for the monitor
    CREATE USER 'monitor_user'@'%' IDENTIFIED BY 'secret';
    GRANT REPLICATION CLIENT ON *.* TO 'monitor_user'@'%';
    
    -- Create the application user
    CREATE USER app_user@'%' IDENTIFIED BY 'secret';
    GRANT SELECT, INSERT, UPDATE, DELETE ON *.* TO app_user@'%';
    CREATE DATABASE IF NOT EXISTS customer_01;
    CREATE TABLE IF NOT EXISTS customer_01.accounts(id INT, account_type INT, account_name VARCHAR(255));
    INSERT INTO customer_01.accounts VALUES (1, 1, 'foo');
    
    -- The shared schema that's on all shards
    CREATE DATABASE IF NOT EXISTS shared_info;
    CREATE TABLE IF NOT EXISTS shared_info.account_types(account_type INT, type_name VARCHAR(255));
    INSERT INTO shared_info.account_types VALUES (1, 'admin'), (2, 'user');
    CREATE DATABASE IF NOT EXISTS customer_02;
    CREATE TABLE IF NOT EXISTS customer_02.accounts(id INT, account_type INT, account_name VARCHAR(255));
    INSERT INTO customer_02.accounts VALUES (2, 2, 'bar');
    
    -- The shared schema that's on all shards
    CREATE DATABASE IF NOT EXISTS shared_info;
    CREATE TABLE IF NOT EXISTS shared_info.account_types(account_type INT, type_name VARCHAR(255));
    INSERT INTO shared_info.account_types VALUES (1, 'admin'), (2, 'user');
    [db-01]
    type=server
    address=192.168.0.102
    port=3306
    
    [db-02]
    type=server
    address=192.168.0.103
    port=3306
    [Sharded-Service]
    type=service
    router=schemarouter
    targets=db-02,db-01
    user=service_user
    password=secret
    ignore_tables_regex=.*
    [Sharded-Service-Listener]
    type=listener
    service=Sharded-Service
    port=4000
    [Shard-Monitor]
    type=monitor
    module=galeramon
    servers=db-02,db-01
    user=monitor_user
    password=secret
    [db-01]
    type=server
    address=192.168.0.102
    port=3306
    
    [db-02]
    type=server
    address=192.168.0.103
    port=3306
    
    [Sharded-Service]
    type=service
    router=schemarouter
    targets=db-02,db-01
    user=service_user
    password=secret
    ignore_tables_regex=.*
    
    [Sharded-Service-Listener]
    type=listener
    service=Sharded-Service
    port=4000
    
    [Shard-Monitor]
    type=monitor
    module=galeramon
    servers=db-02,db-01
    user=monitor_user
    password=secret
    systemctl start maxscale.service
    $ mariadb -A -u app_user -psecret -h 127.0.0.1 -P 4000
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 3
    Server version: 10.11.7-MariaDB-1:10.11.7+maria~ubu2004-log mariadb.org binary distribution
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]> USE customer_01;
    Database changed
    MariaDB [customer_01]> SELECT c.account_name, c.account_type, s.type_name FROM accounts c
        ->   JOIN shared_info.account_types s ON (c.account_type = s.account_type);
    +--------------+--------------+-----------+
    | account_name | account_type | type_name |
    +--------------+--------------+-----------+
    | foo          |            1 | admin     |
    +--------------+--------------+-----------+
    1 row in set (0.001 sec)
    
    MariaDB [customer_01]> USE customer_02;
    Database changed
    MariaDB [customer_02]> SELECT c.account_name, c.account_type, s.type_name FROM accounts c
        ->   JOIN shared_info.account_types s ON (c.account_type = s.account_type);
    +--------------+--------------+-----------+
    | account_name | account_type | type_name |
    +--------------+--------------+-----------+
    | bar          |            2 | user      |
    +--------------+--------------+-----------+
    1 row in set (0.000 sec)
    MariaDB [(none)]> SELECT c.account_name, c.account_type, s.type_name FROM customer_01.accounts c
        ->   JOIN shared_info.account_types s ON (c.account_type = s.account_type);
    +--------------+--------------+-----------+
    | account_name | account_type | type_name |
    +--------------+--------------+-----------+
    | foo          |            1 | admin     |
    +--------------+--------------+-----------+
    1 row in set (0.001 sec)
    
    MariaDB [(none)]> SELECT c.account_name, c.account_type, s.type_name FROM customer_02.accounts c
        ->   JOIN shared_info.account_types s ON (c.account_type = s.account_type);
    +--------------+--------------+-----------+
    | account_name | account_type | type_name |
    +--------------+--------------+-----------+
    | bar          |            2 | user      |
    +--------------+--------------+-----------+
    1 row in set (0.001 sec)
    MariaDB [(none)]> SELECT * FROM customer_01.accounts UNION SELECT * FROM customer_02.accounts;
    ERROR 1146 (42S02): Table 'customer_01.accounts' doesn't exist
    MariaDB [(none)]> USE customer_01;
    Database changed
    MariaDB [customer_01]> SELECT * FROM customer_01.accounts UNION SELECT * FROM customer_02.accounts;
    ERROR 1146 (42S02): Table 'customer_02.accounts' doesn't exist
    MariaDB [customer_01]> USE customer_02;
    Database changed
    MariaDB [customer_02]> SELECT * FROM customer_01.accounts UNION SELECT * FROM customer_02.accounts;
    ERROR 1146 (42S02): Table 'customer_01.accounts' doesn't exist

    Creating the Schemas and Tables

    Configuring MaxScale

    Testing the Sharding

    spinner
    are different, but the canonical form of both is SELECT * FROM t WHERE f = ?.

    When the learning mode is finished, the allowed statements are persistently stored in a file. The file is not specific to the MaxScale instance where it was created and can be copied to other MaxScale installations.

    When in the enforcing mode, the filter checks whether the canonical form of a statement is found in the set of allowed canonical statements. If it is, the statement is let through. If it is not, the behaviour depends upon the value of action.

    As an example, suppose the firewall is in the learning mode and it encounters the following statements:

    That results in the following canonical statements:

    When switched to the enforcing mode, the following statements will be let through

    but the following will not

    While learning, the user information will be retained and saved together with the statements. When enforcing, the value of user_scope defines whether the allowed statements are user specific or whether the union of all statements will be allowed for all users.

    The allowed canonical statements will be stored in a file in the sub-directory firewall in the data directory of MaxScale, which typically is /var/lib/maxscale. The name of the file will be <Filter>-allowed_statements.json, where <Filter> is the name of the firewall filter in the MaxScale configuration file.

    For instance, with a configuration like this:

    The name of the file will be MyFirewall-allowed_statements.json.

    The file is not specific to the MaxScale instance where it was created, but can, for instance, in an HA setup be copied to another MaxScale.

    The firewall filter saves the allow list when its mode is switched from learning to something else but idle. If the old allow list needs to be retained, it should be copied before the firewall filter is taken out from the learning mode.

    The format of the file is JSON and sufficiently self-explanatory that it can be edited manually. With caution, since, if there are syntax errors that prevent it from being read, MaxScale will not start.

    • Type: enum

    • Mandatory: No

    • Dynamic: Yes

    • Values: idle, learn-clear, learn-append, supervise, enforce

    • Default: idle

    This enumeration option specifies the mode of the firewall.

    • idle: The firewall is idle, it neither learns nor enforces.

    • learn-clear: The firewall first clears the existing allow list and then learns the valid statements from the traffic passing through it.

    • learn-append: The firewall learns the valid statements from the traffic passing through it and appends them to the existing list.

    • supervise: The firewall only warns about statements that are not allowed.

    • enforce: The firewall acts as specified by when it encounters a statement that is not allowed.

    If the firewall is in a learning mode, switching it to any other non-learning mode but idle, will cause the allow list to be saved. Switching the firewall from a learning mode to idle, will cause the learnt statements to be discarded and a possible existing allow list will be left unchanged.

    Even if there is no allow list, the firewall can be put in the supervise or the enforce mode. The result is equivalent with having and empty allow list, that is, no statements will be allowed.

    • Type: enum

    • Mandatory: No

    • Dynamic: Yes

    • Values: return-error, disconnect

    • Default: return-error

    This enumeration option specifies the following action, if the firewall is in enforcing mode and it encounters a statement that is not allowed:

    • return-error: An error is returned to the client.

    • disconnect: The client is disconnected.

    • Type: enum

    • Mandatory: No

    • Dynamic: Yes

    • Values: collective, individual

    • Default: collective

    This enumeration option specifies whether the firewall blocks a user based upon the statements executed by that user during the learning mode, or whether it blocks all users based upon the union of statements executed by all users during the learning mode.

    If the scope is collective a user not active during the learning mode will be able to execute the same statements the users that were active during the learning mode will. However, if the scope is individual, a user not active during the learning mode, will not be able to execute any statements.

    With exclude_users users, e.g. admins, whose statements should not be subject to the firewall can be listed.

    • Type: stringlist

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    This string list option specifies users that are excluded and whose statements will not be subject to the firewall. The users can be specified with or without a host and quoting can be used.

    When the firewall is in supervise mode, a firewall violation will cause a warning to be logged:

    When the firewall is in 'enforce' mode, a firewall violation will cause the event firewall_incident, which, by default, will cause a warning to be logged to the MaxScale log file, if maxlog is enabled, and a syslog event to be generated, if syslog is enabled.

    The first step when taking the firewall into use, is to create the filter

    and add it to the service

    Since the firewall filter was just configured, the firewall will start up in the idle mode.

    The second step is to switch the firewall to the learning mode.

    The firewall will switch to the learning mode and start collecting the canonical form of the statements that flow through it. While the firewall is learning, a representative workload should be run through it. In this case, since there was no allow list, it does not matter whether the mode is set to learn-clear or learn-append.

    The third step, once there is confidence that the firewall has seen all relevant statements, is to switch the firewall to supervising mode.

    At this point, the canonical statements will be saved to the file <datadir>/firewall/MyFirewall-allowed_statements.json.

    Since the firewall is now in the supervise mode, all statements will be checked, but no action will be taken in case of a statement that is not allowed. A warning will be logged, which allows it to be detected whether there are statements that currently are not allowed that should be allowed.

    The last step is to switch the firewall to the enforcing mode.

    This page is licensed: CC BY-SA / Gnu FDL

    SELECT * FROM t WHERE f = 10
    SELECT * FROM t WHERE f = 20

    This feature is available from MaxScale 25.10.

    Overview

    SELECT * FROM t WHERE f > 5
    SELECT * FROM t WHERE f = 10
    INSERT INTO t VALUES (42)
    DELETE FROM t WHERE f > 20
    SELECT * FROM users WHERE username = 'input' AND password = 'input'
    SELECT * FROM t WHERE f > ?
    SELECT * FROM t WHERE f = ?
    INSERT INTO t VALUES (?)
    DELETE FROM t WHERE f > ?
    SELECT * FROM users WHERE username = ? AND password = ?
    SELECT * FROM t WHERE f > 100
    SELECT * FROM t WHERE f = 42
    INSERT INTO t VALUES (84)
    DELETE FROM t WHERE f > 200
    SELECT * FROM users WHERE username = 'joe' AND password = 'secret'
    # != is neither > nor =
    SELECT * FROM t WHERE f != 10
    # During learning only one value was inserted
    INSERT INTO t VALUES (1), (2)
    # During learning DELETE was always accompanied by a WHERE clause
    DELETE FROM t
    # An apparent SQL-injection attack does not match what was learnt.
    SELECT * FROM users WHERE username = '' OR '1'='1' AND password = ''
    [MyFirewall]
    type=filter
    module=firewall
    exclude_users=admin, 'super'@'192.168.02.1'
    2024-11-18 08:01:47   warning: (1) [firewall] (Service); Firewall incident (user@127.0.0.1): DELETE FROM t
    [MyFirewall]
    type=filter
    module=firewall
    [MyService]
    type=service
    router=readwritesplit
    ...
    filters=MyFirewall
    maxctrl alter filter MyFirewall mode=learn-clear
    maxctrl alter filter MyFirewall mode=supervise
    maxctrl alter filter MyFilter mode=enforce

    Allowlist

    Settings

    mode

    action

    user_scope

    exclude_users

    Logging

    Workflow

    spinner

    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 the memory usage can be useful for finding out why MaxScale appears to use more memory than it should. It is especially helpful for analyzing OOM situations or other cases where the memory grows linearly and causes problems.

    To profile the memory usage of MaxScale, there are multiple options. The following sections describe the methods that are available.

    If a problem in memory usage is identified and it appears to be due to a bug in MaxScale, please open a new bug report on the . Remember to include all the profiling and leak check reports along with the MaxScale version number and the configuration file with all password and other sensitive information removed.

    The instructions on the page that are for the MariaDB server also apply to MaxScale. The following modifications to the commands must be done in order for them to work with MaxScale.

    • Replace /usr/sbin/mariadbd with /usr/bin/maxscale

    • Replace /var/lib/mysql/ with /var/log/maxscale/

    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.

    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.

    • MaxScale connection

      1. SSH to the server where MaxScale is installed

      2. Connect to MariaDB

    Service Grants

    Make sure that the MaxScale services have a user configured and that it has the correct grants. Refer to the MariaDB protocol documentation on what grants are required for services.

    Monitor Grants

    The monitor user requires different grants than the service user and each monitor type requires different grants.

    • Asynchronous MariaDB replication with mariadbmon

    • Galera clusters with galeramon

    For all authentication and permission related errors, add debug=enable-statement-logging under the [maxscale] section of your MaxScale configuration file. This will cause all SQL statements to be logged on the notice level which will help you figure out what the problem is.

    If you want to connect as root, you'll need to add to the service.

    There seems to be a bug for databases containing underscores. Connect as root and use "SHOW GRANTS FOR user".

    If you got a grant containing a escaped underscore, you can add the strip\_db\_esc=true parameter to the service to automatically strip escape characters or just replace the grant with a unescaped one.

    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.

    This is a common error when system limits for open files is too low. The fix to this is to increase the limits.

    Edit or add LimitNOFILE=<number of files> under the [Service] section in /usr/lib/systemd/system/maxscale.service.

    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.

    If MaxCtrl fails to start and throws this error, it most likely means that the maxctrl executable has been stripped of symbols. To fix this problem, reinstall the MaxScale package.

    Make sure you are connecting on the port where the binlogrouter is listening. A common mistake is to connect to a readwritesplit or readconnroute port and execute the replication configuration commands there.

    For most problems, resetting the conversion state is the solution. If the conversion repeatedly stops at a certain point, please .

    • Stop MaxScale

    • Remove the avro.index and avro-conversion.ini files along with any generated .avro files from the director where the Avro files are stored

    • Start MaxScale

    Make sure the start_index parameter is set to the lowest binlog file number. For example, to start from mariadb-bin-000005, set start_index=5.

    Create the user with maxadmin call command cdc add_user <service name> <user> <password> or maxctrl call command cdc add_user <service name> <user> <password>.

    Check that sysctl kernel.core_pattern is set to forward coredupms to systemd-coredump:

    Also make sure that SystemD is configured to allow coredumps. In External images are disabled suitable size limits must be set as they are set to zero by default.

    Read the MariaDB documentation for and . Most of the operating system level documentation applies to MaxScale as well except that MaxScale is always run as a SystemD service and it only supports Linux as the platform.

    This page is licensed: CC BY-SA / Gnu FDL

    MaxScale PAM Authenticator

    Authenticate users via Pluggable Authentication Modules (PAM). This reference details the PAMAuth module, supporting standard passwords, two-factor authentication, and SUID mode.

    Overview

    Pluggable authentication module (PAM) is a general purpose authentication API. An application using PAM can authenticate a user without knowledge about the underlying authentication implementation. The actual authentication scheme is defined in the operating system PAM config (e.g. /etc/pam.d/), and can be quite elaborate. MaxScale supports a very limited form of the PAM protocol, which this document details.

    Configuration

    The MaxScale PAM module requires little configuration. All that is required is to change the listener authenticator module to "PAMAuth".

    [Read-Write-Listener]
    type=listener
    address=::
    service=Read-Write-Service
    authenticator=PAMAuth
    
    [Primary-Server]
    type=server
    address=123.456.789.10
    port=12345

    MaxScale uses the PAM authenticator plugin to authenticate users with plugin set to pam in the mysql.user table. The PAM service name of a user is read from the authentication_string column. The matching PAM service in the operating system PAM config is used for authenticating the user. If the authentication_string for a user is empty, the fallback service "mysql" is used.

    PAM service configuration is out of the scope of this document, see for more information. A simple service definition used for testing this module is below.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: false

    If enabled, MaxScale communicates with the client as if using . This setting has no effect on MaxScale-to-backend communication, which adapts to either "dialog" or mysql_clear_password, depending on which one the backend suggests. This setting is meant to be used with the similarly named MariaDB Server setting.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: password

    This setting defines the authentication mode used. Two values are supported:

    • password Normal password-based authentication

    • password_2FA Password + 2FA-code based authentication

    • suid Authenticate using suid sandbox subprocess

    If set to password_2FA, any users authenticating via PAM will be asked two passwords ("Password" and "Verification code") during login. MaxScale uses the normal password when either the local PAM api or a backend asks for "Password". MaxScale answers any other password prompt (e.g. "Verification code") with the second password. See for more details. Two-factor mode is incompatible with _use_cleartext_plugin_.

    If set to suid, MaxScale will launch a separate subprocess for every client to handle pam authentication. This subprocess runs the binary maxscale_pam_auth_tool (installed in the binary directory), which calls the system pam libraries. The binary is installed with the SUID bit set, which means that it runs with root-privileges regardless of the user launching it. This should bypass any file grant issues (e.g. reading etc/shadow) that may arise with the password or password_2FA options. The suid option may also perform faster if many clients authenticate with pam simultaneously due to better separation of clients. It may also resist buggy pam plugins crashing, as the crash would be limited to the subprocess only. T he MariaDB Server uses a similar pam authentication scheme. suid mode supports two-factor authentication.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: none

    Defines backend authentication mapping, i.e. switch of authentication method between client-to-MaxScale and MaxScale-to-backend. Supported values:

    • none No mapping

    • mariadb Map users to normal MariaDB accounts

    If set to "mariadb", MaxScale will authenticate clients to backends using standard MariaDB authentication. Authentication to MaxScale itself still uses PAM. MaxScale asks the local PAM system if the client username was mapped to another username during authentication, and use the mapped username when logging in to backends. Passwords for the mapped users can be given in a file, see pam_mapped_pw_file below. If passwords are not given, MaxScale will try to authenticate without a password. Because of this, normal PAM users and mapped users cannot be used on the same listener.

    Because the client still needs to authenticate to MaxScale normally, an anonymous user may be required. If the backends do not allow such a user, one can be manually added using the service setting .

    To map usernames, the PAM service needs to use a module such as _user_map.so_. This module is not a standard Linux component and needs to be installed separately. It is included in recent MariaDB Server packages and can also be compiled from source. See for more information on how to configure the module. If the goal is to only map users from PAM to MariaDB in MaxScale, then configuring user mapping on just the machine running MaxScale is enough.

    Instead of using pam_backend_mapping, consider using the listener setting , as it is easier to configure. pam_backend_mapping should only be used when the user mapping needs to be defined by pam.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: None

    Path to a json-text file with user passwords. Default value is empty, which disables the feature.

    This feature only works together with pam_backend_mapping=mariadb. The file is only read during listener creation (typically MaxScale start) or when a listener is modified during runtime. The file should contain passwords for the mapped users. When a client is authenticating, MaxScale searches the password data for a matching username. If one is found, MaxScale uses the supplied password when logging in to backends. Otherwise, MaxScale tries to authenticate without a password.

    One array, "users_and_passwords", is read from the file. Each array element in the array must define the following fields:

    • "user": String. Mapped client username.

    • "password": String. Backend server password. Can be encrypted with maxpasswd.

    An example file is below.

    When backend authenticator mapping is not in use (authenticator_options=pam_backend_mapping=none), the PAM authenticator supports a limited version of . It requires less configuration but is also less accurate than proper mapping. Anonymous mapping is enabled in MaxScale if the following user exists:

    • Empty username (e.g. ''@'%' or ''@'myhost.com')

    • plugin = 'pam'

    • Proxy grant is on (The query SHOW GRANTS FOR user@host;

    When the authenticator detects such users, anonymous account mapping is enabled for the hosts of the anonymous users. To verify this, enable the info log (log_info=1 in MaxScale config file). When a client is logging in using the anonymous user account, MaxScale logs a message starting with "Found matching anonymous user ...".

    When mapping is on, the MaxScale PAM authenticator does not require client accounts to exist in the mysql.user table received from the backend. MaxScale only requires that the hostname of the incoming client matches the host field of one of the anonymous users (comparison performed using LIKE). If a match is found, MaxScale attempts to authenticate the client to the local machine with the username and password supplied. The PAM service used for authentication is read from the authentication_string field of the anonymous user. If authentication was successful, MaxScale then uses the username and password to log to the backends.

    Anonymous mapping is only attempted if the client username is not found in themysql.user table as explained in . This means, that if a user is found and the authentication fails, anonymous authentication is not attempted even when it could use a different PAM service with a different outcome.

    Setting up PAM group mapping for the MariaDB server is a more involved process as the server requires details on which Unix user or group is mapped to which MariaDB user. See for more details. Performing all the steps in the guide also on the MaxScale machine is not required, as the MaxScale PAM plugin only checks that the client host matches an anonymous user and that the client (with the username and password it provided) can log into the local PAM configuration. If using normal password authentication, simply generating the Unix user and password should be enough.

    The general PAM authentication scheme is difficult for a proxy such as MaxScale. An application using the PAM interface needs to define a conversation function to allow the OS PAM modules to communicate with the client, possibly exchanging multiple messages. This works when a client logs in to a normal server, but not with MaxScale since it needs to autonomously log into multiple backends. For MaxScale to successfully log into the servers, the messages and answers need to be predefined. The passwords given to MaxScale need to work as is when MaxScale logs into the backends. This requirement prevents the use of one-time passwords.

    The MaxScale PAM authentication module supports two password modes. In normal mode, client authentication begins with MaxScale sending an AuthSwitchRequest packet. In addition to the command, the packet contains the client plugin name ("dialog" or "mysql_clear_password"), a message type byte (4) and the message "Password: ". In the next packet, the client should send the password, which MaxScale will forward to the PAM api running on the local machine. If the password is correct, an OK packet is sent to the client. If the local PAM api asks for additional credentials as is typical in two-factor authentication schemes, authentication fails. Informational messages such as password expiration notifications are allowed. These are simply printed to the log.

    On the backend side, MaxScale expects the servers to act as MaxScale did towards the client. The servers should send an AuthSwitchRequest packet as defined above, MaxScale responds with the password received by the client authenticator and finally backend replies with OK. Informational messages from backends are only printed to the info-log.

    MaxScale supports a limited form of two-factor authentication with thepam_mode=password_2FA-option. Since MaxScale uses the 2FA-code given by the client to log in to the local PAM api as well as all the backends, the code must be reusable. This prevents the use of any kind of centrally checked one-use codes. Time-based codes work, assuming the backends are checking the codes independently of each other. Automatic reconnection features (e.g. readwritesplit router) does not work, as the code has likely changed since original authentication.

    Optionally, the PAM configuration on the backend servers can be weakened such that the servers only asks for the normal password. This way, MaxScale checks the 2FA-code of the incoming client, while MaxScale logs into the backends using only the password.

    Due to technical reasons, MaxScale does not forward the password prompts from the PAM api to the client. MaxScale will always ask for "Password" and "Verification code", even if the PAM api asks for other items. This prevents the use of authentication schemes where a specific question must be answered (e.g. "Input code Nr. 5"). This is not a significant limitation, as such schemes would not work with backend servers anyway.

    MaxScale binary directory contains the test_pam_login-executable. This simple program asks for a username, password and PAM service and then uses the given credentials to login to the given service. test_pam_login uses the same code as MaxScale itself to communicate with the OS PAM interface and may be useful for diagnosing PAM login issues.

    This page is licensed: CC BY-SA / Gnu FDL

    MaxScale Administration Tutorial

    Master common administrative tasks in MaxScale. Learn to start/stop services, rotate logs, manage servers with MaxCtrl, and put nodes into maintenance mode.

    The purpose of this tutorial is to introduce the MariaDB MaxScale Administrator to a few of the common administration tasks. This is intended to be an introduction for administrators who are new to MariaDB MaxScale and not a reference to all the tasks that may be performed.

    The REST API calls that MaxCtrl and MaxGui issue to MaxScale can be logged by enabling .

    The generated file is a csv file that can be opened in most spread sheet programs.

    [Rotating Log Files](#Rotating Log Files) also applies to the audit file. The admin audit file will never be overwritten as a result of a rotate, unlike the regular log file (in case a rotate is issued, but the file name has not been moved). There is also the option to change the audit file name, which effectively rotates it independently of the regular log file. For example:

    MaxScale uses systemd for managing the process. This means that normalsystemctl

    action
    Failover With Multiple MaxScales
    ,
    password_2FA
    ,
    suid
  • Default: password

  • ,
    mariadb
  • Default: none

  • returns at least one row with
    GRANT PROXY ON ...
    )

    Settings

    pam_use_cleartext_plugin

    pam_mode

    pam_backend_mapping

    pam_mapped_pw_file

    Anonymous User Mapping

    Implementation Details and Limitations

    Two-factor Authentication Support

    Test Tool

    The Linux-PAM System Administrators' Guide
    boolean
    mysql_clear_password
    enumeration
    the limitations section
    enumeration
    user_accounts_file
    user mapping
    user_mapping_file
    user mapping
    Configuration
    this guide
    spinner
    commands can be used to start and stop MaxScale. To start MaxScale, use
    systemctl start maxscale
    . To stop it, use
    systemctl stop maxscale
    .

    The systemd service file for MaxScale is located in /lib/systemd/system/maxscale.service.

    Additional command line options and other systemd configuration options can be given to MariaDB MaxScale by creating a drop-in file for the service unit file. You can do this with the systemctl edit maxscale.servicecommand. For more information about systemd drop-in files, refer to the systemctl man page and the systemd documentation.

    It is possible to use the maxctrl command to obtain statistics about the services that are running within MaxScale. The maxctrl command list serviceswill give very basic information regarding services. This command may be either run in interactive mode or passed on the maxctrl command line.

    Network listeners count as a user of the service, therefore there will always be one user per network port in which the service listens. More details can be obtained by using the "show service" command.

    To determine what client are currently connected to MariaDB MaxScale, you can use the list sessions command within maxctrl. This will give you IP address and the ID of the session for that connection. As with any maxctrl command this can be passed on the command line or typed interactively in maxctrl.

    Log rotation applies to the MaxScale log file, admin audit file and qlafilter files.

    MariaDB MaxScale logs messages of different priority into a single log file. With the exception if error messages that are always logged, whether messages of a particular priority should be logged or not can be enabled via the maxctrl interface or in the configuration file. By default, MaxScale keeps on writing to the same log file. To prevent the file from growing indefinitely, the administrator must take action.

    The name of the log file is maxscale.log. When the log is rotated, MaxScale closes the current log file and opens a new one using the same name.

    Log file rotation is achieved by use of the rotate logs command in maxctrl.

    As there currently is only the maxscale log, that is the only one that will be rotated.

    This may be integrated into the Linux logrotate mechanism by adding a configuration file to the /etc/logrotate.d directory. If we assume we want to rotate the log files once per month and wish to keep 5 log files worth of history, the configuration file would look as follows.

    MariaDB MaxScale will also rotate all of its log files if it receives the USR1 signal. Using this the logrotate configuration script can be rewritten as

    MariaDB MaxScale supports the concept of maintenance mode for servers within a cluster. This allows for planned, temporary removal of a database from the cluster without the need to change the MariaDB MaxScale configuration.

    To achieve this, you can use the set server command in maxctrl to set the maintenance mode flag for the server. This may be done interactively within maxctrl or by passing the command on the command line.

    This will cause MariaDB MaxScale to stop routing any new requests to the server, however if there are currently requests executing on the server these will not be interrupted. Connections to servers in maintenance mode are closed as soon as the next request arrives. To close them immediately, use the --force option for maxctrl set server.

    Clearing the maintenance mode for a server will bring it back into use. If multiple MariaDB MaxScale instances are configured to use the node then maintenance mode must be set within each MariaDB MaxScale instance.

    Services can be stopped to temporarily halt their use. Stopping a service will cause it to stop accepting new connections until it is started. New connections are not refused if the service is stopped and are queued instead. This means that connecting clients will wait until the service is started again.

    Starting a service will cause it to accept all queued connections that were created while it was stopped.

    Stopping a monitor will cause it to stop monitoring the state of the servers assigned to it. This is useful when the state of the servers is assigned manually with maxctrl set server.

    Starting a monitor will make it resume monitoring of the servers. Any manually assigned states will be overwritten by the monitor.

    The MaxScale configuration can be changed at runtime by using the create,alter and destroy commands of maxctrl. These commands either create, modify or destroy objects (servers, services, monitors etc.) inside MaxScale. The exact syntax for each of the commands and any additional options that they take can be seen with maxctrl --help <command>.

    Not all parameters can be modified at runtime. Refer to the module documentation for more information on which parameters can be modified at runtime. If a parameter cannot be modified at runtime, the object can be destroyed and recreated in order to change it.

    All runtime changes are persisted in files stored by default in /var/lib/maxscale/maxscale.cnf.d/. This means that any changes done at runtime persist through restarts. Any changes done to objects in the main configuration file are ignored if a persisted entry is found for it.

    For example, if the address of a server is modified with maxctrl alter server db-server-1 address 192.168.0.100, the file/var/lib/maxscale/maxscale.cnf.d/db-server-1.cnf is created with the complete configuration for the object. To remove all runtime changes for all objects, remove all files found in /var/lib/maxscale/maxscale.cnf.d.

    Modify global MaxScale parameters:

    Some global parameters cannot be modified at runtime. Refer to the Configuration Guide for a full list of parameters that can be modified at runtime.

    Create a new server

    Modify a Server

    Destroy a Server

    A server can only be destroyed if it is not used by any services or monitors. To automatically remove the server from the services and monitors that use it, use the --force flag.

    Drain a Server

    When a server is set into the drain state, no new connections to it are created. Unlike to the maintenance state which immediately stops all new requests and closes all connections if used with the --force option, thedrain state allows existing connections to continue routing requests to them in order to be gracefully closed once the client disconnects.

    To remove the drain state, use clear server command:

    Servers with the Master state cannot be drained. To drain them, first perform a switchover to another node and then drain the server.

    Create a new Monitor

    Modify a Monitor

    Add Server to a Monitor

    Remove a Server from a Monitor

    Destroy a Monitor

    A monitor can only be destroyed if it is not monitoring any servers. To automatically remove the servers from the monitor, use the --force flag.

    Create a New Service

    Modify a Service

    Add Servers to a Service

    Any servers added to services will only be used by new sessions. Existing sessions will use the servers that were available when they connected.

    Remove Servers from a Service

    Similarly to adding servers, removing servers from a service will only affect new sessions. Existing sessions keep using the servers even if they are removed from a service.

    Change the Filters of a Service

    The order of the filters is significant: the first filter will be the first to receive the query. The new set of filters will only be used by new sessions. Existing sessions will keep using the filters that were configured when they connected.

    Destroy a Service

    The service can only be destroyed if it uses no servers or clusters and has no listeners associated with it. To force destruction of a service even if it does use servers or has listeners, use the --force flag. This will also destroy any listeners associated with the service.

    Create a New Filter

    Alter a Filter

    Destroy a Filter

    A filter can only be destroyed if it is not used by any services. To automatically remove the filter from all services using it, use the --forceflag.

    Create a New Listener

    Destroy a Listener

    Destroying a listener will close the network socket and stop it from accepting new connections. Existing connections that were created through it will keep displaying it as the originating listener.

    Listeners cannot be moved from one service to another. In order to do this, the listener must be destroyed and then recreated with the new service.

    MaxCtrl uses the same credentials as the MaxScale REST API. These users can be managed via MaxCtrl.

    By default new users are only allowed to read data. To make the account an administrative account, add the --type=admin option to the command:

    Administrative accounts are allowed to use all MaxCtrl commands and modify any parts of MaxScale.

    This page is licensed: CC BY-SA / Gnu FDL

    Administration audit file

    Starting and Stopping MariaDB MaxScale

    admin_audit

    Additional Options for MaxScale

    Checking The Status Of The MariaDB MaxScale Services

    What Clients Are Connected To MariaDB MaxScale

    Rotating Log Files

    Taking Objects Temporarily Out of Use

    Putting Servers into Maintenance

    Stopping and Starting Services

    Stopping and Starting Monitors

    Runtime Configuration Modification

    Core Parameter Configuration

    Managing Servers

    Managing Monitors

    Managing Services

    Managing Filters

    Managing Listeners

    Managing MaxCtrl and REST API Users

    Create a New MaxCtrl User

    Change the Password of an Existing User

    Remove a User

    spinner
    auth            required        pam_unix.so
    account         required        pam_unix.so
    authenticator_options=pam_use_cleartext_plugin=1
    authenticator_options=pam_mode=password_2FA
    authenticator_options=pam_backend_mapping=mariadb
    authenticator_options=pam_mapped_pw_file=/home/root/passwords.json,pam_backend_mapping=mariadb
    {
        "users_and_passwords": [
            {
                "user": "my_mapped_user1",
                "password": "my_mapped_pw1"
            },
            {
                "user": "my_mapped_user2",
                "password": "A6D4C53619FFFF4DF252A0E595EDB0A12CA44E16AF154D0ED08F687E81604BFF42218B4EBA9F3EF8D907CF35E74ABDAA"
            }
        ]
    }
    maxctrl alter maxscale admin_audit_file=/var/log/maxscale/admin_audit.march.csv.
    $ maxctrl list services
    ┌────────────────────────┬────────────────┬─────────────┬───────────────────┬────────────────────────────────────┐
    │ Service                │ Router         │ Connections │ Total Connections │ Servers                            │
    ├────────────────────────┼────────────────┼─────────────┼───────────────────┼────────────────────────────────────┤
    │ CLI                    │ cli            │ 1           │ 1                 │                                    │
    ├────────────────────────┼────────────────┼─────────────┼───────────────────┼────────────────────────────────────┤
    │ RW-Split-Router        │ readwritesplit │ 1           │ 1                 │ server1, server2, server3, server4 │
    ├────────────────────────┼────────────────┼─────────────┼───────────────────┼────────────────────────────────────┤
    │ RW-Split-Hint-Router   │ readwritesplit │ 1           │ 1                 │ server1, server2, server3, server4 │
    ├────────────────────────┼────────────────┼─────────────┼───────────────────┼────────────────────────────────────┤
    │ SchemaRouter-Router    │ schemarouter   │ 1           │ 1                 │ server1, server2, server3, server4 │
    ├────────────────────────┼────────────────┼─────────────┼───────────────────┼────────────────────────────────────┤
    │ Read-Connection-Router │ readconnroute  │ 1           │ 1                 │ server1                            │
    └────────────────────────┴────────────────┴─────────────┴───────────────────┴────────────────────────────────────┘
    $ maxctrl list sessions
    ┌────┬─────────┬──────────────────┬──────────────────────────┬──────┬─────────────────┐
    │ Id │ User    │ Host             │ Connected                │ Idle │ Service         │
    ├────┼─────────┼──────────────────┼──────────────────────────┼──────┼─────────────────┤
    │ 6  │ maxuser │ ::ffff:127.0.0.1 │ Thu Aug 27 10:39:16 2020 │ 4    │ RW-Split-Router │
    └────┴─────────┴──────────────────┴──────────────────────────┴──────┴─────────────────┘
    maxctrl rotate logs
    /var/log/maxscale/maxscale.log {
    monthly
    rotate 5
    missingok
    nocompress
    sharedscripts
    postrotate
    \# run if maxscale is running
    if test -n "`ps acx|grep maxscale`"; then
    /usr/bin/maxctrl rotate logs
    fi
    endscript
    }
    /var/log/maxscale/maxscale.log {
    monthly
    rotate 5
    missingok
    nocompress
    sharedscripts
    postrotate
    kill -USR1 `cat /run/maxscale/maxscale.pid`
    endscript
    }
    maxctrl set server db-server-3 maintenance
    maxctrl clear server db-server-3 maintenance
    maxctrl stop service db-service
    maxctrl start service db-service
    maxctrl stop monitor db-monitor
    maxctrl start monitor db-monitor
    maxctrl alter maxscale auth_connect_timeout 5s
    maxctrl create server db-server-1 192.168.0.100 3306
    maxctrl alter server db-server-1 port 3307
    maxctrl destroy server db-server-1
    maxctrl set server db-server-1 drain
    maxctrl clear server db-server-1 drain
    maxctrl create monitor db-monitor mariadbmon user=db-user password=db-password
    maxctrl alter monitor db-monitor monitor_interval 1000
    maxctrl link monitor db-monitor db-server-1
    maxctrl unlink monitor db-monitor db-server-1
    maxctrl destroy monitor db-monitor
    maxctrl create service db-service readwritesplit user=db-user password=db-password
    maxctrl alter service db-service user new-db-user
    maxctrl link service db-service db-server1
    maxctrl unlink service db-service db-server1
    maxctrl alter service-filters my-regexfilter my-qlafilter
    maxctrl destroy service db-service
    maxctrl create filter my-filter regexfilter match=ENGINE=MyISAM replace=ENGINE=InnoDB
    maxctrl alter filter my-filter match=ENGINE=InnoDB
    maxctrl destroy filter my-filter
    maxctrl create listener db-listener db-service 4006
    maxctrl destroy listener db-listener
    maxctrl create user basic-user basic-password
    maxctrl create user admin-user admin-password --type=admin
    maxctrl alter user admin-user new-admin-password
    maxctrl destroy user basic-user
    Replace pidof mariadbd with pidof maxscale
  • Replace mariadb.service with maxscale.service

  • Check output of SHOW GRANTS
  • Client connection

    1. SSH to theserver where client is connecting from

    2. Connect to MariaDB

    3. Check output of

  • [Service]
    ExecStart=valgrind --leak-check=full /usr/bin/maxscale -d
    Type=simple
    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
    }
    sysctl -w kernel.core_pattern='|/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %e'
    $ cat /etc/systemd/coredump.conf
    #  This file is part of systemd.
    #
    #  systemd is free software; you can redistribute it and/or modify it
    #  under the terms of the GNU Lesser General Public License as published by
    #  the Free Software Foundation; either version 2.1 of the License, or
    #  (at your option) any later version.
    #
    # Entries in this file show the compile time defaults.
    # You can change settings by editing this file.
    # Defaults can be restored by simply deleting this file.
    #
    # See coredump.conf(5) for details.
    
    [Coredump]
    Storage=external
    Compress=yes
    ProcessSizeMax=1G
    ExternalSizeMax=1G
    JournalSizeMax=1G
    #MaxUse=
    #KeepFree=

    Profiling Memory Usage

    Profiling Release Mode Binaries

    Valgrind

    Authentication Errors

    Access Denied

    Verifying that a user is allowed to connect

    Checking MaxScale has correct grants

    Other Errors

    Access denied errors for user root!

    Access denied on databases/tables containing underscores

    System Errors

    Failed to write message: 11, Resource temporarily unavailable

    Error 23: Too many open files

    Systemd

    MaxCtrl

    Error: ENOENT: no such file or directory, uv_cwd

    Pkg: Error reading from file.

    Binlogrouter

    Commands not Working

    MaxScale CDC: Avrorouter

    Resetting conversion state

    Binlog files are not found

    Access denied to CDC interface

    Coredumps Are Not Being Generated

    MariaDB Jira under the MaxScale project
    profiling-memory-usage
    allow proxied connections
    enable_root_user=true
    MXS-4474
    MXS-1983
    MXS-4474
    open a bug report
    spinner

    REST API Tutorial

    Interact with MaxScale programmatically using the REST API. This tutorial demonstrates how to create, modify, and inspect MaxScale objects at runtime using curl.

    This tutorial is a quick overview of what the MaxScale REST API offers, how it can be used to inspect the state of MaxScale and how to use it to modify the runtime configuration of MaxScale. The tutorial uses the curl command line client to demonstrate how the API is used.

    Configuration and Hardening

    The MaxScale REST API listens on port 8989 on the local host. The admin_port and admin_host parameters control which port and address the REST API listens on. Note that for security reasons the API only listens for local connections with the default configuration. It is critical that the default credentials are changed and TLS/SSL encryption is configured before exposing the REST API to a network.

    The default user for the REST API is admin and the password is mariadb. The easiest way to secure the REST API is to use the maxctrl command line client to create a new admin user and delete the default one. To do this, run the following commands:

    This will create the user my_user with the password my_password that is an administrative account. After this account is created, the default admin account is removed with the next command.

    The next step is to enable TLS encryption. To do this, you need a CA certificate, a private key and a public certificate file all in PEM format. Add the following three parameters under the [maxscale] section of the MaxScale configuration file and restart MaxScale.

    Use maxctrl to verify that the TLS encryption is enabled. In this tutorial our server certificates are self-signed so the --tls-verify-server-cert=false option is required.

    If no errors are raised, this means that the communication via the REST API is now secure and can be used across networks.

    Note: For the sake of brevity, the rest of this tutorial will omit theTLS/SSL options from the curl command line. For more information, refer to thecurl manpage.

    The most basic task to do with the REST API is to see whether MaxScale is up and running. To do this, we do a HTTP request on the root resource (the -i option shows the HTTP headers).

    curl -i 127.0.0.1:8989/v1/

    To query a resource collection endpoint, append it to the URL. The /v1/filters/ endpoint shows the list of filters configured in MaxScale. This is a resource collection endpoint: it contains the list of all resources of a particular type.

    curl 127.0.0.1:8989/v1/filters

    The data holds the actual list of resources: the Hint and Logger filters. Each object has the id field which is the unique name of that object. It is the same as the section name in maxscale.cnf.

    Each resource in the list has a relationships object. This shows the relationship links between resources. In our example, the Hint filter is used by a service named RW-Split-Hint-Router and the Logger is not currently in use.

    To request an individual resource, we add the object name to the resource collection URL. For example, if we want to get only the Logger filter we execute the following command.

    curl 127.0.0.1:8989/v1/filters/Logger

    Note that this time the data member holds an object instead of an array of objects. All other parts of the response are similar to what was shown in the previous example.

    One of the uses of the REST API is to create new objects in MaxScale at runtime. This allows new servers, services, filters, monitor and listeners to be created without restarting MaxScale.

    For example, to create a new server in MaxScale the JSON definition of a server must be sent to the REST API at the /v1/servers/ endpoint. The request body defines the server name as well as the parameters for it.

    To create objects with curl, first write the JSON definition into a file.

    To send the data, use the following command.

    The -d option takes a file name prefixed with a @ as an argument. Here we have @new_server.txt which is the name of the file where the JSON definition was stored. The -X option defines the HTTP verb to use and to create a new object we must use the POST verb.

    To verify the data request the newly created object.

    The easiest way to modify an object is to first request it, store the result in a file, edit it and then send the updated object back to the REST API.

    Let's say we want to modify the port that the server we created earlier listens on. First we request the current object and store the result in a file.

    After that we edit the file and change the port from 3003 to 3306. Next the modified JSON object is sent to the REST API as a PATCH command. To do this, execute the following command.

    To verify that the data was updated correctly, request the updated object.

    To continue with our previous example, we add the updated server to a service. To do this, the relationships object of the server must be modified to include the service we want to add the server to.

    To define a relationship between a server and a service, the data member must have the relationships field and it must contain an object with the servicesfield (some fields omitted for brevity).

    The data.relationships.services.data field contains a list of objects that define the id and type fields. The id is the name of the object (a service or a monitor for servers) and the type tells which type it is. Only services type objects should be present in the services object.

    In our example we are linking the server1 server to the RW-Split-Router service. As was seen with the previous example, the easiest way to do this is to store the result, edit it and then send it back with a HTTP PATCH.

    If we want to remove a server from all services and monitors, we can set thedata member of the services and monitors relationships to an empty array:

    This is useful if you want to delete the server which can only be done if it has no relationships to other objects.

    To delete an object, simply execute a HTTP DELETE request on the resource you want to delete. For example, to delete the server1 server, execute the following command.

    In order to delete an object, it must not have any relationships to other. objects.

    The full list of all available endpoints in MaxScale can be found in the .

    The maxctrl command line client is self-documenting and the maxctrl help command is a good tool for exploring the various commands that are available in it. The maxctrl api get command can be useful way to explore the REST API as it provides a way to easily extract values out of the JSON data generated by the REST API.

    There is a multitude of REST API clients readily available and most of them are far more convenient to use than curl. We recommend investigating what you need and how you intend to either integrate or use the MaxScale REST API. Most modern languages either have a built-in HTTP library or there exists a de facto standard library.

    The MaxScale REST API follows the JSON API specification and there exist libraries that are built specifically for these sorts of APIs

    This page is licensed: CC BY-SA / Gnu FDL

    Automatic Failover With MariaDB Monitor

    Configure automatic failover for MariaDB replication clusters. This tutorial covers setting up the monitor to handle primary server failures and promote replicas automatically.

    MariaDB Monitor can do more than just monitor the state of a MariaDB replication cluster. The monitor can perform cluster manipulation operations such as failover, switchover and rejoin. By default, these operations are launched manually, but they can be configured to also trigger automatically. All replication modifying operations assume GTID-based replication, and refuse to launch or may work incorrectly when using file-and-position-based replication. Also, the operations are mainly designed to work with simple topologies, for instance 1 primary and one to multiple replicas. More complicated setups (multilayered replication, multimaster rings etc.) may work, but should be tested separately to ensure the results are predictable.

    The following examples have four servers: server1 is the initial primary and server2 to server4 are replicas. The servers are monitored by TheMonitor. The MaxScale configuration file looks as follows:

    [server1]
    type=server
    address=192.168.121.51
    port=3306
    
    [server2]
    ...
    
    [server3]
    ...
    
    [server4]
    ...
    
    [TheMonitor]
    type=monitor
    module=mariadbmon
    servers=server1,server2,server3,server4
    ...

    Manual Failover

    If everything is in order, the state of the cluster looks like this:

    $ maxctrl list servers
    ┌─────────┬─────────────────┬──────┬─────────────┬─────────────────┐
    │ Server  │ Address         │ Port │ Connections │ State           │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server1 │ 192.168.121.51  │ 3306 │ 0           │ Master, Running │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server2 │ 192.168.121.190 │ 3306 │ 0           │ Slave, Running  │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server3 │ 192.168.121.112 │ 3306 │ 0           │ Slave, Running  │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server4 │ 192.168.121.201 │ 3306 │ 0           │ Slave, Running  │
    └─────────┴─────────────────┴──────┴─────────────┴─────────────────┘

    If the primary server goes down, the cluster looks like this:

    Since automatic failover is not enabled, failover needs to be invoked manually:

    The MaxCtrl command invocation is composed of the following parts:

    1. call command launches a module command

    2. mariadbmon is the module which implements the command

    3. failover is the command to invoke

    In MaxScale 25.10 and later, the configured monitor name can be used as the module name. The above command invocation can thus be shortened to maxctrl call command TheMonitor failover. This alternate form works for module commands in general.

    During failover, TheMonitor selects the best replica, promotes it to primary and modifies the other replicas to replicate from the new primary. The main criteria for best replica is being most up-to-date. If the best replica has unprocessed events in its relay log, meaning it has received binary log events from the old primary but not processed them, failover stalls until the processing is complete. If multiple replicas are equally good, the monitor prefers to promote servers in the order stated in the servers-setting.

    After failover completes, the cluster looks like this:

    If server1 comes back online, it is not rejoined to the cluster:

    This case can be handled by the . For more details on what exactly failover does, see .

    To enable automatic failover, add auto_failover=true to the monitor section in the configuration file:

    When everything is running fine, the cluster state is as follows:

    If server1 goes down, the monitor performs failover automatically and promotes an existing replica to primary.

    If you are continuously monitoring the server states, you may notice that, for a brief period, the state of server1 is Down and the state of server2 is still Slave, Running. This is because the monitor does not begin failover immediately when the server goes down, as the problem could be temporary. The monitor waits for server1 to come back for monitor intervals. The recommended value for failcount depends on monitor_interval and the stability of the network.

    To enable automatic rejoin, simply add auto_rejoin=true to the monitor section in the configuration file:

    When automatic rejoin is enabled, MariaDB Monitor attempts to rejoin a failed primary as a replica if it comes back online.

    In the next example, failover (either automatic or manual) has promoted server2 to replace failed primary server1:

    If server1 reappears, the monitor detects that, and attempts to rejoin the old primary as a replica. Rejoin is not always possible: If the old primary processed a write (just before crashing), and that write was never replicated to the new primary, then automatic rejoin is not possible because the old and new primaries have diverged.

    If rejoin succeeds, the cluster state ends up looking like:

    Switchover is for cases when you explicitly want to move the primary role from one server to another. Switchover is safer than failover, as switchover prevents writes to the cluster during the operation.

    Continuing from the cluster state at the end of the previous example, to make server1 primary again, issue the following command:

    The MaxCtrl command invocation is composed of the following parts:

    1. call command launches a module command

    2. mariadbmon is the module which implements the command

    3. switchover is the command to invoke

    Specifying the current primary is optional. The name of the new primary server can also be left out if autoselection is tolerable, leaving just maxctrl call command mariadbmon switchover TheMonitor. As with failover, in MaxScale 25.10, the configured monitor name can be used as the module name: maxctrl call command TheMonitor switchover.

    If the switchover succeeds, we end up with the following cluster state:

    For more details on what exactly switchover does, see .

    This page is licensed: CC BY-SA / Gnu FDL

    MaxScale Rewrite Filter

    Transform SQL queries using template-based rules. This filter modifies incoming statements to optimize performance or fix compatibility issues without changing application code.

    The rewrite filter allows modification of sql queries on the fly. Reasons for modifying queries can be to rewrite a query for performance, or to change a specific query when the client query is incorrect and cannot be changed in a timely manner.

    The examples will use Rewrite Filter file format. See below.

    Native syntax

    Rewriter native syntax uses placeholders to grab and replace parts of text.

    Placeholders

    The syntax for a plain placeholder is @{N} where N is a positive integer.

    Requesting Data

    Creating Objects

    Modifying Data

    Object Relationships

    Deleting Objects

    Further Reading

    REST API documentation
    spinner

    TheMonitor is the first and only argument to the command, specifying the target monitor

    TheMonitor specifies the target monitor

  • server1 is the server to promote

  • server2 is the server to demote, the current primary

  • Automatic Failover

    If more than one MaxScale instance monitors the same cluster, the instances must coordinate before you enable auto_failover. Otherwise they can promote different servers and diverge the cluster. See Failover With Multiple MaxScales.

    Rejoin

    Switchover

    rejoin-command
    MariaDB Monitor documentation
    failcount
    MariaDB Monitor documentation
    spinner
    maxctrl create user my_user my_password --type=admin
    maxctrl destroy user admin
    admin_ssl_key=/certs/server-key.pem
    admin_ssl_cert=/certs/server-cert.pem
    admin_ssl_ca_cert=/certs/ca-cert.pem
    maxctrl --user=my_user --password=my_password --secure --tls-ca-cert=/certs/ca-cert.pem --tls-verify-server-cert=false show maxscale
    HTTP/1.1 200 OK
    Connection: Keep-Alive
    Content-Length: 0
    Last-Modified: Mon, 04 Mar 2019 08:23:09 GMT
    ETag: "0"
    Date: Mon, 04 Mar 19 08:29:41 GMT
    {
        "links": {
            "self": "http://127.0.0.1:8989/v1/filters/"
        },
        "data": [
            {
                "id": "Hint",
                "type": "filters",
                "relationships": {
                    "services": {
                        "links": {
                            "self": "http://127.0.0.1:8989/v1/services/"
                        },
                        "data": [
                            {
                                "id": "RW-Split-Hint-Router",
                                "type": "services"
                            }
                        ]
                    }
                },
                "attributes": {
                    "module": "hintfilter",
                    "parameters": {}
                },
                "links": {
                    "self": "http://127.0.0.1:8989/v1/filters/Hint"
                }
            },
            {
                "id": "Logger",
                "type": "filters",
                "relationships": {
                    "services": {
                        "links": {
                            "self": "http://127.0.0.1:8989/v1/services/"
                        },
                        "data": []
                    }
                },
                "attributes": {
                    "module": "qlafilter",
                    "parameters": {
                        "match": null,
                        "exclude": null,
                        "user": null,
                        "source": null,
                        "filebase": "/tmp/log",
                        "options": "ignorecase",
                        "log_type": "session",
                        "log_data": "date,user,query",
                        "newline_replacement": "\" \"",
                        "separator": ",",
                        "flush": false,
                        "append": false
                    },
                    "filter_diagnostics": {
                        "separator": ",",
                        "newline_replacement": "\" \""
                    }
                },
                "links": {
                    "self": "http://127.0.0.1:8989/v1/filters/Logger"
                }
            }
        ]
    }
    {
        "links": {
            "self": "http://127.0.0.1:8989/v1/filters/Logger"
        },
        "data": {
            "id": "Logger",
            "type": "filters",
            "relationships": {
                "services": {
                    "links": {
                        "self": "http://127.0.0.1:8989/v1/services/"
                    },
                    "data": []
                }
            },
            "attributes": {
                "module": "qlafilter",
                "parameters": {
                    "match": null,
                    "exclude": null,
                    "user": null,
                    "source": null,
                    "filebase": "/tmp/log",
                    "options": "ignorecase",
                    "log_type": "session",
                    "log_data": "date,user,query",
                    "newline_replacement": "\" \"",
                    "separator": ",",
                    "flush": false,
                    "append": false
                },
                "filter_diagnostics": {
                    "separator": ",",
                    "newline_replacement": "\" \""
                }
            },
            "links": {
                "self": "http://127.0.0.1:8989/v1/filters/Logger"
            }
        }
    }
    {
        "data": {
            "id": "server1",
            "type": "servers",
            "attributes": {
                "parameters": {
                    "address": "127.0.0.1",
                    "port": 3003
                }
            }
        }
    }
    curl -X POST -d @new_server.txt 127.0.0.1:8989/v1/servers
    curl 127.0.0.1:8989/v1/servers/server1
    curl 127.0.0.1:8989/v1/servers/server1 > server1.txt
    curl -X PATCH -d @server1.txt 127.0.0.1:8989/v1/servers/server1
    curl 127.0.0.1:8989/v1/servers/server1
    {
        "data": {
            "id": "server1",
            "type": "servers",
            "relationships": {
                "services": {
                    "data": [
                        {
                            "id": "RW-Split-Router",
                            "type": "services"
                        }
                    ]
                }
            },
            "attributes":  ...
        }
    }
    {
        "data": {
            "relationships": {
                "services": {
                    "data": []
                },
                "monitors": {
                    "data": []
                }
            }
        }
    }
    curl -X DELETE 127.0.0.1:8989/v1/servers/server1
    $ maxctrl list servers
    ┌─────────┬─────────────────┬──────┬─────────────┬────────────────┐
    │ Server  │ Address         │ Port │ Connections │ State          │
    ├─────────┼─────────────────┼──────┼─────────────┼────────────────┤
    │ server1 │ 192.168.121.51  │ 3306 │ 0           │ Down           │
    ├─────────┼─────────────────┼──────┼─────────────┼────────────────┤
    │ server2 │ 192.168.121.190 │ 3306 │ 0           │ Slave, Running │
    ├─────────┼─────────────────┼──────┼─────────────┼────────────────┤
    │ server3 │ 192.168.121.112 │ 3306 │ 0           │ Slave, Running │
    ├─────────┼─────────────────┼──────┼─────────────┼────────────────┤
    │ server4 │ 192.168.121.201 │ 3306 │ 0           │ Slave, Running │
    └─────────┴─────────────────┴──────┴─────────────┴────────────────┘
    $ maxctrl call command mariadbmon failover TheMonitor
    OK
    $ maxctrl list servers
    ┌─────────┬─────────────────┬──────┬─────────────┬─────────────────┐
    │ Server  │ Address         │ Port │ Connections │ State           │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server1 │ 192.168.121.51  │ 3306 │ 0           │ Down            │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server2 │ 192.168.121.190 │ 3306 │ 0           │ Master, Running │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server3 │ 192.168.121.112 │ 3306 │ 0           │ Slave, Running  │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server4 │ 192.168.121.201 │ 3306 │ 0           │ Slave, Running  │
    └─────────┴─────────────────┴──────┴─────────────┴─────────────────┘
    $ maxctrl list servers
    ┌─────────┬─────────────────┬──────┬─────────────┬─────────────────┐
    │ Server  │ Address         │ Port │ Connections │ State           │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server1 │ 192.168.121.51  │ 3306 │ 0           │ Running         │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server2 │ 192.168.121.190 │ 3306 │ 0           │ Master, Running │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server3 │ 192.168.121.112 │ 3306 │ 0           │ Slave, Running  │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server4 │ 192.168.121.201 │ 3306 │ 0           │ Slave, Running  │
    └─────────┴─────────────────┴──────┴─────────────┴─────────────────┘
    [TheMonitor]
    type=monitor
    module=mariadbmon
    servers=server1,server2,server3,server4
    auto_failover=true
    ...
    $ maxctrl list servers
    ┌─────────┬─────────────────┬──────┬─────────────┬─────────────────┐
    │ Server  │ Address         │ Port │ Connections │ State           │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server1 │ 192.168.121.51  │ 3306 │ 0           │ Master, Running │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server2 │ 192.168.121.190 │ 3306 │ 0           │ Slave, Running  │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server3 │ 192.168.121.112 │ 3306 │ 0           │ Slave, Running  │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server4 │ 192.168.121.201 │ 3306 │ 0           │ Slave, Running  │
    └─────────┴─────────────────┴──────┴─────────────┴─────────────────┘
    $ maxctrl list servers
    ┌─────────┬─────────────────┬──────┬─────────────┬────────────────────────┐
    │ Server  │ Address         │ Port │ Connections │ State                  │
    ├─────────┼─────────────────┼──────┼─────────────┼────────────────────────┤
    │ server1 │ 192.168.121.51  │ 3306 │ 0           │ Down                   │
    ├─────────┼─────────────────┼──────┼─────────────┼────────────────────────┤
    │ server2 │ 192.168.121.190 │ 3306 │ 0           │ Master, Slave, Running │
    ├─────────┼─────────────────┼──────┼─────────────┼────────────────────────┤
    │ server3 │ 192.168.121.112 │ 3306 │ 0           │ Slave, Running         │
    ├─────────┼─────────────────┼──────┼─────────────┼────────────────────────┤
    │ server4 │ 192.168.121.201 │ 3306 │ 0           │ Slave, Running         │
    └─────────┴─────────────────┴──────┴─────────────┴────────────────────────┘
    [TheMonitor]
    type=monitor
    module=mariadbmon
    servers=server1,server2,server3,server4
    auto_failover=true
    monitor_interval=2s
    failcount=5
    ...
    [TheMonitor]
    type=monitor
    module=mariadbmon
    servers=server1,server2,server3,server4
    auto_failover=true
    auto_rejoin=true
    ...
    $ maxctrl list servers
    ┌─────────┬─────────────────┬──────┬─────────────┬─────────────────┐
    │ Server  │ Address         │ Port │ Connections │ State           │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server1 │ 192.168.121.51  │ 3306 │ 0           │ Down            │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server2 │ 192.168.121.190 │ 3306 │ 0           │ Master, Running │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server3 │ 192.168.121.112 │ 3306 │ 0           │ Slave, Running  │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server4 │ 192.168.121.201 │ 3306 │ 0           │ Slave, Running  │
    └─────────┴─────────────────┴──────┴─────────────┴─────────────────┘
    $ maxctrl list servers
    ┌─────────┬─────────────────┬──────┬─────────────┬─────────────────┐
    │ Server  │ Address         │ Port │ Connections │ State           │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server1 │ 192.168.121.51  │ 3306 │ 0           │ Slave, Running  │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server2 │ 192.168.121.190 │ 3306 │ 0           │ Master, Running │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server3 │ 192.168.121.112 │ 3306 │ 0           │ Slave, Running  │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server4 │ 192.168.121.201 │ 3306 │ 0           │ Slave, Running  │
    └─────────┴─────────────────┴──────┴─────────────┴─────────────────┘
    $ maxctrl call command mariadbmon switchover TheMonitor server1 server2
    OK
    $ maxctrl list servers
    ┌─────────┬─────────────────┬──────┬─────────────┬─────────────────┐
    │ Server  │ Address         │ Port │ Connections │ State           │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server1 │ 192.168.121.51  │ 3306 │ 0           │ Master, Running │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server2 │ 192.168.121.190 │ 3306 │ 0           │ Slave, Running  │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server3 │ 192.168.121.112 │ 3306 │ 0           │ Slave, Running  │
    ├─────────┼─────────────────┼──────┼─────────────┼─────────────────┤
    │ server4 │ 192.168.121.201 │ 3306 │ 0           │ Slave, Running  │
    └─────────┴─────────────────┴──────┴─────────────┴─────────────────┘

    The syntax for a placeholder regex is @{N:regex}. It allows more control when needed.

    The below is a valid entry in rf format. For demonstration, all options are set. This entry is a do-nothing entry, but illustrates placeholders.

    If the input sql is select id, name from my_table where id = 42 then @{2} = "id, name" and @{3} = "42". Since the replace template is identical to the match template the end result is that the output sql will be the same as the input sql.

    Placeholders can be used as forward references.@{1:^}select @{2}, count(*) from @{3} group by @{2}. For a match, the two @{2} text grabs must be equal.

    Match template

    The match template is used to match against the sql to be rewritten.

    The match template can be partial from mytable. But the actual underlying regex match is always for the whole sql. If the match template does not start or end with a placeholder, placeholders are automatically added so that the above becomes @{1}from mytable@{2}. The automatically added placeholders cannot be used in the replace template.

    Matching the whole input also means that Native syntax does not support (and is not intended to support) scan and replace. Only the first occurrence of the above from mytable can be modified in the replace template. However, one can selectively choose to modify e.g. the first through third occurrence of from mytable by writingfrom mytable @{1} from mytable @{2} from mytable @{3}.

    For scan and replace use a different regex_grammar (see below).

    Replace template

    The replace template uses the placeholders from the match template to rewrite sql.

    An important option for smooth matching is ignore_whitespace, which is on (true) by default. It creates the match regex in such a way that the amount and kind of whitespace does not affect matching. However, to make ignore_whitespace always work, it is important to add whitespace where allowed. If "id=42" is in the match template then only the exact "id=42" can match. But if "id = 42" is used, andignore_whitespace is on, both "id=42" and "id = 42" will match.

    Another example, and what not to do:

    That works, but because the match lacks specific detail about the expected sql, things are likely to break. In this caseshow indexes from my_table would no longer work.

    The minimum detail in this case could be:

    but if more detail is known, like something specific in the where clause, that too should be added.

    Placeholder Regex

    Syntax: @{N:regex}

    In a placeholder regex the character } must be escaped to \} (for literal matching). Plain parenthesis "()" indicate capturing groups, which are internally used by the Native grammar. Thus plain parentheses in a placeholder regex will break matching. However, non-capturing groups can be used: e.g. @{1:(:?Jane|Joe)}. To match a literal parenthesis use an escape, e.g. \(.

    Suppose an application is misbehaving after an upgrade and a quick fix is needed. This query select zip from address_book where str_id = "AZ-124" is correct, but if the id is an integer the where clause should be id = 1234.

    Using plain regular expressions

    For scan and replace the regex_grammar must be set to something else than Native. An example will illustrate the usage.

    Replace all occurrences of "wrong_table_name" with "correct_table_name". Further, if the replacement was made then replace all occurrences of wrong_column_name with correct_column_name.

    Adding a rewrite filter.

    • Type: string

    • Mandatory: Yes

    • Dynamic: Yes

    • Default: No default value

    Path to the template file.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: Native

    • Values: Native, ECMAScript, Posix, EPosix, Awk, Grep, EGrep

    Default regex_grammar for templates

    • Type: boolean

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    Default case sensitivity for templates

    • Type: boolean

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    Log replacements at NOTICE level.

    • Type: string

    • Values: Native, ECMAScript, Posix, EPosix, Awk, Grep, EGrep

    • Default: From maxscale.cnf

    Overrides the global regex_grammar of a template.

    • Type: boolean

    • Default: From maxscale.cnf

    Overrides the global case sensitivity of a template.

    • Type: boolean

    • Default: true

    Ignore whitespace differences in the match template and input sql.

    • Type: boolean

    • Default: false

    If a template matches and the replacement is done, continue to the next template and apply it to the result of the previous rewrite.

    • Type: boolean

    • Default: false

    Do not make the replacement, only log what would have been replaced (NOTICE level).

    The rf format for an entry is:

    The character # starts a single line comment when it is the first character on a line.

    Empty lines are ignored.

    The rf format does not need any additional escaping to what the basic format requires (see Placeholder Regex).

    Options are specified as follows:

    The colon must stick to the option name.

    The separators % and %% must be the exact content of their respective separator lines.

    The templates can span multiple lines. Whitespace does not matter as long as ignore_whitespace = true. Always use space where space is allowed to maximize the utility ofignore_whitespace.

    Example

    The json file format is harder to read and edit manually. It will be needed if support for editing of rewrite templates is added to the GUI.

    All double quotes and escape characters have to be escaped in json, i.e '"' and '\'.

    The same example as above is:

    The configuration is re-read if any dynamic value is updated even if the value does not change.

    • ECMAScript ECMAScript

    • Posix V1_chap09.html#tag_09_03

    • EPosix V1_chap09.html#tag_09_04

    • Awk

    • Grep Same as Posix with the addition of newline '\n' as an alternation separator.

    • EGrep Same as EPosix with the addition of newline '\n' as an alternation separator in addition to '|'.

    This page is licensed: CC BY-SA / Gnu FDL

    Overview

    Syntax

    %%
    # options
    regex_grammar: Native
    case_sensitive: true
    what_if: false
    continue_if_matched: false
    ignore_whitespace: true
    %
    # match template
    @{1:^}select @{2} from my_table where id = @{3}
    %
    # replace template
    select @{2} from my_table where id = @{3}
    %%
    # use default options by leaving this blank
    %
    @{1:^}select count(distinct @{2}) from @{3}
    %
    select count(*) from (select distinct @{1} from @{2}) as t123
    
    Input: select count(distinct author) from books where entity != "AI"
    
    Rewritten: select count(*) from (select distinct author from books where entity != "AI") as t123
    %%
    %
    from mytable
    %
    from mytable force index (myindex)
    
    Input: select name from mytable where id=42
    
    Rewritten: select name from mytable force index (myindex) where id=42
    %%
    %
    @{1:^}select @{2} from mytable
    %
    select @{2} from mytable force index (myindex)
    %%
    %
    @{1:^}select zip_code from address_book where str_id = @{1:["]}@{2:[[:digit:]]+}@{3:["]}
    %
    select zip_code from address_book where id = @{2}
    
    Input: select zip_code from address_book where str_id = "1234"
    
    Rewritten: select zip_code from address_book where id = 1234
    %%
    regex_grammar: EPosix
    continue_if_matched: true
    %
    wrong_table_name
    %
    correct_table_name
    
    %%
    regex_grammar: EPosix
    %
    wrong_column_name
    %
    correct_column_name
    [Rewrite]
    type = filter
    module = rewritefilter
    template_file = /path/to/template_file.rf
    ...
    
    [Router]
    type=service
    ...
    filters=Rewrite
    %%
    options
    %
    match template
    %
    replace template
    case_sensitive: true
    %%
    case_sensitive: false
    %
    @{1:^}select @{2}
    from mytable
    where user = @{3}
    %
    select @{2} from mytable where user = @{3}
    and @{3} in (select user from approved_users)
    { "templates" :
        [
            {
                "case_sensitive" : false,
                "match_template" : "@{1:^}select @{2} from mytable where user = @{3}",
                "replace_template" : "select @{2} from mytable where user = @{3}
    and @{3} in (select user from approved_users)"
            }
        ]
    }
    maxctrl alter filter Rewrite log_replacement=false

    Configuration

    Settings

    template_file

    regex_grammar

    case_sensitive

    log_replacement

    Settings per template in the template file

    regex_grammar

    case_sensitive

    ignore_whitespace

    continue_if_matched

    what_if

    Rewrite file format

    Json file format

    Reload template file

    Reference

    spinner
    SHOW GRANTS

    MaxScale Query Log All Filter

    Log every SQL query passing through MaxScale. This filter provides comprehensive audit trails by recording query text, execution time, and client details.

    Overview

    The Query Log All (QLA) filter logs query content. Logs are written to a file in CSV format. Log elements are configurable and include the time submitted and the SQL statement text, among others.

    Configuration

    A minimal configuration is below.

    [MyLogFilter]
    type=filter
    module=qlafilter
    filebase=/tmp/SqlQueryLog
    
    [MyService]
    type=service
    router=readconnroute
    servers=server1
    user=myuser
    password=mypasswd
    filters=MyLogFilter

    Log Rotation

    The qlafilter logs can be rotated by executing the maxctrl rotate logs command. This will cause the log files to be reopened when the next message is written to the file. This applies to both unified and session type logging.

    Settings

    The QLA filter has one mandatory parameter, filebase, and a number of optional parameters. These were introduced in the 1.0 release of MariaDB MaxScale.

    filebase

    • Type: string

    • Mandatory: Yes

    • Dynamic: No

    The basename of the output file created for each session. A session index is added to the filename for each written session file. For unified log files,.unified is appended.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    Include queries that match the regex.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    Exclude queries that match the regex.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: case

    The extended option enables PCRE2 extended regular expressions.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    Limit logging to sessions with this user.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    Limit logging to sessions with this client source address.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    Only log queries from users that match this pattern. If the user parameter is used, the value of user_match is ignored.

    Here is an example pattern that matches the users alice and bob:

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    Exclude all queries from users that match this pattern. If the user parameter is used, the value of user_exclude is ignored.

    Here is an example pattern that excludes the users alice and bob:

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    Only log queries from hosts that match this pattern. If the source parameter is used, the value of source_match is ignored.

    Here is an example pattern that matches the loopback interface as well as the address 192.168.0.109:

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    Exclude all queries from hosts that match this pattern. If the source parameter is used, the value of source_exclude is ignored.

    Here is an example pattern that excludes the loopback interface as well as the address 192.168.0.109:

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: session

    The type of log file to use.

    Value
    Description
    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: service

    Type of data to log in the log files.

    Value
    Description

    The durations reply_time and total_reply_time are by default in milliseconds, but can be specified to another unit using duration_unit.

    The log entry is written when the last reply from the server is received. Prior to version 6.2 the entry was written when the query was received from the client, or if reply_time was specified, on first reply from the server.

    NOTE The error_msg is the raw message from the server. Even if use_canonical_form is set the error message may contain user defined constants. For example:

    Starting with MaxScale 24.02, the query parameter now correctly logs the execution of binary protocol commands as SQL (). The execution of batched statements (COM_STMT_BULK_LOAD) used by some connectors is not logged.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: milliseconds

    The unit for logging a duration. The unit can be milliseconds or microseconds. The abbreviations ms for milliseconds and us for microseconds are also valid. This option is available as of MaxScale version 6.2.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    When this option is true the canonical form of the query is logged. In the canonical form all user defined constants are replaced with question marks. This option is available as of MaxScale version 6.2.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    Flush log files after every write.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: ","

    Defines the separator string between elements of log entries. The value should be enclosed in quotes.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: " "

    Default value is " " (one space). SQL-queries may include line breaks, which, if printed directly to the log, may break automatic parsing. This parameter defines what should be written in the place of a newline sequence (\r, \n or \r\n). If this is set as the empty string, then newlines are not replaced and printed as is to the output. The value should be enclosed in quotes.

    • Trailing parts of SQL queries that are larger than 16MiB are not logged. This means that the log output might contain truncated SQL.

    • Batched execution using COM_STMT_BULK_EXECUTE is not converted into their textual form. This is done due to the large volumes of data that are usually involved with batched execution.

    Imagine you have observed an issue with a particular table and you want to determine if there are queries that are accessing that table but not using the primary key of the table. Let's assume the table name is PRODUCTS and the primary key is called PRODUCT_ID. Add a filter with the following definition:

    The result of using this filter with the service used by the application would be a log file of all select queries querying PRODUCTS without using the PRODUCT_ID primary key in the predicates of the query. Executing SELECT * FROM PRODUCTS would log the following into /var/logs/qla/SelectProducts:

    This page is licensed: CC BY-SA / Gnu FDL

    Galera Monitor

    Monitor Galera Clusters with the galeramon module. This guide explains how to detect cluster state, assign read/write roles, and manage node priorities for effective load balancing.

    The Galera Monitor monitors a Galera cluster. It detects whether nodes are part of the cluster and if they are in sync with the rest of the cluster. The monitor also assigns read and write roles to servers, allowing Galera clusters to be used with modules designed for traditional primary-replica clusters.

    By default, the Galera Monitor will choose the node with the lowest wsrep_local_index value as the primary. This will mean that two MaxScales running on different servers will choose the same server as the primary.

    The following WSREP variables are inspected by Galera Monitor to see whether a node is usable. If the node is not usable, it loses the Read and Write labels and will be in the Running state.

    awk.html#tag_20_06_13_04
    ,
    ignorecase
    ,
    extended
  • Default: case

  • ,
    unified
    ,
    stdout
  • Default: session

  • ,
    session
    ,
    date
    ,
    user
    ,
    reply_time
    ,
    total_reply_time
    ,
    query
    ,
    default_db
    ,
    num_rows
    ,
    reply_size
    ,
    transaction
    ,
    transaction_time
    ,
    num_warnings
    ,
    error_msg
  • Default: date, user, query

  • user

    User and hostname of client

    reply_time

    Duration from client query to first server reply

    total_reply_time

    Duration from client query to last server reply (v6.2)

    query

    The SQL of the query if it contains it

    default_db

    The default (current) database

    num_rows

    Number of rows in the result set (v6.2)

    reply_size

    Number of bytes received from the server (v6.2)

    transaction

    BEGIN, COMMIT and ROLLBACK (v6.2)

    transaction_time

    The duration of a transaction (v6.2)

    num_warnings

    Number of warnings in the server reply (v6.2)

    error_msg

    Error message from the server (if any) (v6.2)

    server

    The server where the query was routed (if any) (v22.08)

    command

    The protocol command that was executed (v24.02)

    session

    Write to session-specific files

    unified

    Use one file for all sessions

    stdout

    Same as unified, but to stdout

    service

    Service name

    session

    Unique session id (ignored for session files)

    date

    Timestamp

    match

    exclude

    options

    user

    source

    user_match

    user_exclude

    source_match

    source_exclude

    log_type

    log_data

    duration_unit

    use_canonical_form

    flush

    append

    separator

    newline_replacement

    Limitations

    Examples

    Example 1 - Query without primary key

    regex
    regex
    enum_mask
    regex
    regex
    regex
    regex
    enum_mask
    enum_mask
    MXS-4959
    bool
    bool
    bool
    spinner
    filebase=/tmp/SqlQueryLog
    user_match=/(^alice$)|(^bob$)/
    user_exclude=/(^alice$)|(^bob$)/
    source_match=/(^127[.]0[.]0[.]1)|(^192[.]168[.]0[.]109)/
    source_exclude=/(^127[.]0[.]0[.]1)|(^192[.]168[.]0[.]109)/
    MariaDB [test]> select secret from T where x password="clear text pwd";
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual
    that corresponds to your MariaDB server version for the right syntax to
    use near 'password="clear text pwd"' at line 1
    newline_replacement=" NL "
    [ProductsSelectLogger]
    type=filter
    module=qlafilter
    match=SELECT.*from.*PRODUCTS .*
    exclude=WHERE.*PRODUCT_ID.*
    filebase=/var/logs/qla/SelectProducts
    
    [Product-Service]
    type=service
    router=readconnroute
    servers=server1
    user=myuser
    password=mypasswd
    filters=ProductsSelectLogger
    07:12:56.324 7/01/2016, SELECT * FROM PRODUCTS
  • If wsrep_ready=0, the WSREP system is not yet ready and the Galera node cannot accept queries.

  • If wsrep_desync=1 is set, the node is desynced and is not participating in the Galera replication.

  • If wsrep_reject_queries=[ALL|ALL_KILL] is set, queries are refused and the node is unusable.

  • With wsrep_sst_donor_rejects_queries=1, donor nodes reject queries. Galera Monitor treats this the same as if wsrep_reject_queries=ALL was set.

  • If wsrep_local_state is not 4 (or 2 with available_when_donor=true), the node is not in the correct state and is not used.

  • MaxScale 2.4.0 added support for replicas replicating off of Galera nodes. If a non-Galera server monitored by Galera Monitor is replicating from a Galera node also monitored by the same monitor, it will be assigned the Read, Running status as long as the replication works. This allows read-scaleout with Galera servers without increasing the size of the Galera cluster.

    As of MaxScale 25.10.2, the Galera Monitor can monitor a MariaDB Advanced Cluster. Advanced Cluster is a new synchronized replication scheme that offers reduced latency compared to the standard Galera implementation. An Advanced Cluster promotes one server as the leader. The leader approves and orders transactions. Since all transactions must pass through the leader, the Galera Monitor gives the leader the Write role, causing e.g. the ReadWriteSplit-router to direct all writes to it. If the leader cannot be found, the cluster is in a failure state, and both reads and writes are disabled until a leader emerges.

    The Galera Monitor automatically detects if the monitored cluster is a traditional Galera Cluster or an Advanced Cluster by looking at the wsrep_provider_name status variable. All servers in the cluster must use the same type of replication; mixing Galera and Advanced Cluster nodes is not allowed and will cause the monitor to withhold all Write and Read roles.

    The Galera Monitor does not require any additional configuration to be used with a MariaDB Advanced Cluster. On the contrary, Galera Monitor ignores the values of most of its configuration settings when dealing with a MariaDB Advanced Cluster. Specifically, disable_master_failback, disable_master_role_setting, use_priority and root_node_as_master are ineffective when dealing with an Advanced Cluster, as the cluster decides on the leader itself.

    During startup, the monitor prints a log message specifying which cluster type it detected.

    The Galera Monitor requires the REPLICA MONITOR grant to work:

    With MariaDB Server 10.4 and earlier, REPLICATION CLIENT is required instead.

    If set_donor_nodes is configured, the SUPER grant is required:

    A minimal configuration for a Galera Monitor requires a set of servers and a username and a password to connect to these servers. The user must have grants as described in the required grants section.

    For a list of optional parameters that all monitors support, read the Common Monitor Parameters document.

    • Type: boolean

    • Default: false

    • Dynamic: Yes

    If a node marked as primary inside MaxScale happens to fail and the primary status is assigned to another node MaxScale will normally return the primary status to the original node after it comes back up. With this option enabled, if the primary status is assigned to a new node it will not be reassigned to the original node for as long as the new primary node is running. In this case the Master Stickiness status bit is set which will be visible in the maxctrl list servers output.

    • Type: boolean

    • Default: false

    • Dynamic: Yes

    This option allows Galera nodes to be used normally when they are donors in an SST operation when the SST method is non-blocking (e.g. wsrep_sst_method=mariadb-backup).

    Normally when an SST is performed, both participating nodes lose their Synced, Write or Read statuses. When this option is enabled, the donor is treated as if it was a normal member of the cluster (i.e. wsrep_local_state = 4). This is especially useful if the cluster drops down to one node and an SST is required to increase the cluster size.

    The current list of non-blocking SST methods are xtrabackup, xtrabackup-v2 and mariadb-backup. Read the wsrep_sst_method documentation for more details.

    • Type: boolean

    • Default: false

    • Dynamic: Yes

    This disables the assignment of primary and replica roles to the Galera cluster nodes. If this option is enabled, Synced is the only status assigned by this monitor.

    • Type: boolean

    • Default: false

    • Dynamic: Yes

    Enable interaction with server priorities. This will allow the monitor to deterministically pick the write node for the monitored Galera cluster and will allow for controlled node replacement.

    • Type: boolean

    • Default: false

    • Dynamic: Yes

    This option controls whether the write primary Galera node requires wsrep_local_index value of 0. This option was introduced in MaxScale 2.1.0 and it is disabled by default in versions 2.1.5 and newer. In versions 2.1.4 and older, the option was enabled by default.

    A Galera cluster will always have a node which has a wsrep_local_index value of 0. Based on this information, multiple MaxScale instances can always pick the same node for writes.

    If the root_node_as_master option is disabled, the node with the lowest index will always be chosen as the primary. If it is enabled, only the node with a wsrep_local_index value of 0 can be chosen as the primary.

    This parameter can work with disable_master_failback but using them together is not advisable: the intention of root_node_as_master is to make sure that all MaxScale instances that are configured to use the same Galera cluster will send writes to the same node. If disable_master_failback is enabled, this is no longer true if the Galera cluster reorganizes itself in a way that a different node gets the node index 0, writes would still be going to the old node that previously had the node index 0. A restart of one of the MaxScales or a new MaxScale joining the cluster will cause writes to be sent to the wrong node, thus resulting in an increasing the rate of deadlock errors and sub-optimal performance.

    • Type: boolean

    • Default: false

    • Dynamic: Yes

    This option controls whether the global variable wsrep_sst_donor should be set in each cluster node with Read status. The variable contains a list of replica servers, automatically sorted, with possible primary candidates at its end.

    The sorting is based either on wsrep_local_index or node server priority depending on the value of use_priority option. If no server has priority defined the sorting switches to wsrep_local_index. Node names are collected by fetching the result of the variable wsrep_node_name.

    Example of variable being set in all replica nodes, assuming three nodes:

    The monitor user requires the SUPER privilege to set the global variable.

    If the use_priority option is set and a server is configured with the priority=<int> parameter, the monitor will use that as the basis on which the primary node is chosen. This requires the disable_master_role_setting to be undefined or disabled. The server with the lowest positive value of priority will be chosen as the primary node when a replacement Galera node is promoted to a primary server inside MaxScale. If all candidate servers have the same priority, the order of the servers in the servers parameter dictates which is chosen as the primary.

    Nodes with a negative value (priority < 0) will never be chosen as the primary. This allows you to mark some servers as permanent replicas by assigning a non-positive value into priority. Nodes with the default priority of 0 are only selected if no nodes with higher priority are present and the normal node selection rules apply to them (i.e. selection is based on wsrep_local_index).

    Here is an example.

    In this example node-1 is always used as the primary if available. If node-1 is not available, then the next node with the highest priority rank is used. In this case it would be node-3. If both node-1 and node-3 were down, thennode-2 would be used. Because node-4 has a value of -1 in priority, it will never be the primary. Nodes without priority parameter are considered as having a priority of 0 and will be used only if all nodes with a positive priority value are not available.

    With priority ranks you can control the order in which MaxScale chooses the primary node. This will allow for a controlled failure and replacement of nodes.

    Priorities can be used to force a runtime change of the primary server in a Galera Cluster. For example, if server1 has a priority of 1 and server2 a priority of 2 (with server1 being primary), the roles can be reversed with MaxCtrl:

    This does not affect the Galera Cluster itself, just the roles MaxScale assigns to the servers. If multiple MaxScales monitor the same Galera Cluster without configuration synchronization, the commands should be run on all MaxScales.

    Bootstrap (added in MaxScale 25.10) bootstraps an empty monitor (no servers), adding servers from an existing Galera cluster. Bootstrap requires the address of a server in the cluster to start from. The monitor connects to the address and reads the wsrep_incoming_addresses variable. The monitor adds the addresses listed as servers to both MaxScale and the monitor. Server names are auto-generated as in <monitor_name>-server, e.g. MyGaleraMonitor-server1.

    Bootstrap accepts the following key-value arguments:

    argument
    type
    default
    description

    monitor

    monitor

    none (mandatory)

    Monitor name

    template

    Any discovered servers are added to MaxScale as if created via runtime maxctrl create server .... The servers are thus similar to any other runtime configured server and are visible in the GUI and maxctrl list servers.

    The address and port-settings of the discovered servers are set to the values listed in wsrep_incoming_addresses. Other settings are copied from the server given in the template-setting, so that the discovered servers inherit e.g. TLS settings. If no server template is given, discovered servers will use server default settings. The server template must be a valid, existing server in MaxScale configuration. It need not be monitored by any monitor and its address and port-settings can point to a non-existing (but theoretically valid) network address. It can be configured in the config file or created runtime:

    Bootstrap is incompatible with configuration synchronization and will refuse to run if it is enabled.

    Discover-replicas (added in MaxScale 25.10) is a manual command which adds any missing Galera servers to MaxScale and the monitor. The servers are discovered by fetching the value of the wsrep_incoming_addresses status variable (which contains the addresses of all Galera nodes) from the primary server and comparing it to the values of wsrep_node_incoming_address (which contains just the address of the current node) of already monitored servers. Any addresses listed in wsrep_incoming_addresses but not found in any existing server are then assumed to be missing servers. The missing servers are then added to MaxScale configuration and the monitor. The command can also optionally remove servers that are shut down or not part of the Galera cluster.

    Discover-replicas accepts the following key-value arguments:

    argument
    type
    default
    description

    monitor

    monitor

    none (mandatory)

    Monitor name

    remove

    Any discovered servers are added to MaxScale as if created via runtime maxctrl create server .... The servers are thus similar to any other runtime configured server and are visible in the GUI and maxctrl list servers. The address and port-settings of the discovered servers are set to the values listed in wsrep_incoming_addresses. Other settings are copied from the current primary server, so that the discovered servers inherit e.g. TLS settings. Discovered servers are named <monitor_name>-server, e.g. MyGaleraMonitor-server3.

    A server can only be removed if it is not explicitly used by any other module, e.g. a service. Thus, this command is best used when services are configured with the cluster-setting as the services will then automatically match any changes in the set of monitored servers.

    This page is licensed: CC BY-SA / Gnu FDL

    Overview

    WSREP Variables and Their Effects

    CREATE USER 'maxscale'@'maxscalehost' IDENTIFIED BY 'maxscale-password';
    GRANT REPLICA MONITOR ON *.* TO 'maxscale-user'@'maxscalehost';
    GRANT REPLICATION CLIENT ON *.* TO 'maxscale-user'@'maxscalehost';
    GRANT SUPER ON *.* TO 'maxscale'@'maxscalehost';
    [Galera-Monitor]
    type=monitor
    module=galeramon
    servers=server1,server2,server3
    user=myuser
    password=mypwd
    SET GLOBAL wsrep_sst_donor = "galera001,galera000"
    [node-1]
    type=server
    address=192.168.122.101
    port=3306
    priority=1
    
    [node-2]
    type=server
    address=192.168.122.102
    port=3306
    priority=3
    
    [node-3]
    type=server
    address=192.168.122.103
    port=3306
    priority=2
    
    [node-4]
    type=server
    address=192.168.122.104
    port=3306
    priority=-1
    maxctrl alter server server1 priority=2
    maxctrl alter server server2 priority=1
    maxctrl create server MyServerTemplate address=123.123.123.123 port=1111 ssl=true ssl_ca=/certs/ca.crt
    maxctrl call command galeramon bootstrap monitor=MyGaleraMonitor template=MyServerTemplate address=192.168.0.4
    maxctrl call command galeramon discover-replicas monitor=MyGaleraMonitor remove=true

    Galera clusters and replicas replicating from it

    MariaDB Advanced Cluster (RAFT) support

    Required Grants

    Configuration

    Common Monitor Settings

    Settings

    disable_master_failback

    available_when_donor

    disable_master_role_setting

    use_priority

    root_node_as_master

    set_donor_nodes

    Interaction with Server Priorities

    Switchover

    Bootstrap

    Discover-replicas

    spinner

    Deployment Topologies for Multiple MaxScales

    Compare the deployment topologies for running two MariaDB MaxScale instances over the same cluster. Covers what each one costs in hardware, what it survives, and how a co-located tiebreaker or Galera

    Running two MaxScale instances removes MaxScale as a single point of failure, and keeps the two instances from diverging the cluster. What cooperative locking cannot do is invent servers: cooperative_monitoring_locks=majority_of_all, the only mode that survives a network partition, needs a majority of the configured servers to be reachable. How many servers you deploy, and where, therefore decides what the pair actually survives.

    This page compares four topologies for a two-MaxScale deployment, from the cheapest to the ones that tolerate a partition, and shows how co-locating a third database node on a MaxScale server gets three-node safety at close to two-node hardware cost.

    Topology
    Hosts

    MaxScale Workload Capture and Replay

    Record and replay real database traffic. This filter captures client sessions to create realistic benchmarks and test environments based on production workloads.

    The WCAR (Workload Capture and Replay) module is a sophisticated feature designed to capture and archive client traffic passing through a MaxScale instance. This allows system administrators and developers to process and store vast volumes of data related to client-server interactions in a reliable manner. By harnessing this captured data, users gain the flexibility to replay and simulate the varied client activity typically seen in a production environment.

    One of the module's primary advantages is that it removes the necessity of creating explicit traffic generators, which can be resource-intensive and complex to maintain. Instead, the WCAR module provides a seamless method for mirroring realistic client interactions and behavior patterns, which can be critical for testing, debugging, and optimizing system performance.

    Additionally, by facilitating traffic replay, the WCAR module aids in identifying potential system vulnerabilities and performance bottlenecks, allowing for preemptive optimization. This proactive approach ensures that systems are well-prepared for live production scenarios, enhancing overall efficiency and uptime.

    In essence, the WCAR module not only preserves detailed and valuable traffic data but also empowers users with the tools to analyze and refine their systems through accurate simulation, paving the way for robust and resilient system architectures.

    server

    empty

    Server settings template

    address

    string

    none (mandatory)

    Scan starting address

    port

    number

    3306

    Scan starting port

    boolean

    false

    Remove shut down or non-replicating servers

    Survives one database node down
    Survives a network partition

    4

    No

    No

    5

    Yes

    Yes

    4

    The first three use MariaDB Monitor with cooperative_monitoring_locks. The fourth uses Galera Monitor and relies on a different mechanism entirely — see How the Galera Case Differs.

    The minimum deployment: two database servers, two MaxScale servers, four hosts. It removes MaxScale as a single point of failure and nothing else. Neither locking mode makes it partition-tolerant, and the reason is the lock arithmetic.

    Majority is servers / 2 + 1. With two servers in the count, that is two locks — every server, every time.

    Majority is counted over the servers each instance can currently reach. During a partition each instance reaches one server, needs 1 / 2 + 1 = 1 lock, and gets it. Both instances declare themselves the primary monitor, both mark a primary, and both accept writes — on different servers.

    Both sides reach a local majority, so both accept writes and the cluster diverges.

    Divergence is not recoverable: one of the two write streams has to be discarded and the server rebuilt by hand.

    Majority is counted over all configured servers, so it is always two locks whether or not both servers are up. No single side of a partition can reach two, and neither can either instance when one server is simply down. The pair goes read-only.

    With two configured servers, both are required for a majority, so no side of a partition is writable.

    The cluster is consistent, which is the point, but it is also unavailable for writes as soon as either server is lost — a partition and a routine reboot look the same from here. MaxScale logs why, naming the shortfall: it holds one lock of the two required and reports how many could not be acquired because the server is down.

    Adding a third database server is the direct fix. Majority over three configured servers is 3 / 2 + 1 = 2, so majority_of_all tolerates the loss of one server: the two survivors are a majority, and the instance that can lock both keeps performing cluster operations and accepting writes.

    With three configured servers, two locks are a majority, so one node can be lost.

    The same count decides a partition. Only the side holding two of the three servers can act; the other side releases its locks and serves reads only.

    Only the majority side is writable, so there is never more than one write stream.

    The cost is a fifth host, and a third server sized to serve production traffic.

    The majority count does not care what a server is for — only that the monitor can reach it and take a lock on it. That makes the third server cheap: run a small MariaDB instance on one of the MaxScale servers, keep it out of query routing, and let it exist only to be the third vote.

    The result is three configured servers on four hosts. majority_of_all behaves exactly as it does in the three-server topology, at the hardware cost of the two-server one.

    db1 is down, and the surviving full server plus the tiebreaker are a majority.

    During a partition the tiebreaker's location decides which side wins, because it is reachable only from the host it runs on. If the partition leaves MaxScale 1 with the old primary, MaxScale 1 holds the tiebreaker's lock and the old primary's, which is two of three, and keeps writing. MaxScale 2 is left with one server, releases its lock, and serves reads.

    The MaxScale that can reach the tiebreaker has the majority.

    The other partitions work out the same way. If the MaxScale 1 host is isolated, it loses both a MaxScale and the tiebreaker at once, but MaxScale 2 is then left with db1 and db2 — still two of three — and takes over. If the MaxScale 2 host is isolated, MaxScale 1 sees all three servers. In every case exactly one instance is writable.

    The tiebreaker is an ordinary MariaDB server replicating from the primary. Three things make it a tiebreaker rather than a third production node.

    Include it in the monitor. Locking is on by default for every monitored server, so listing it is all that is needed. Do not add it to servers_no_cooperative_monitoring_locks — that setting would remove it from the majority count, which is the one thing it is there for.

    Keep it out of query routing. Give the service an explicit servers list naming only the full servers. Do not use cluster=, which takes the service's targets from the monitor and would include the tiebreaker.

    Keep it out of promotion. A server sharing a host with MaxScale is a poor primary. servers_no_promotion excludes it from failover and from automatic primary selection at startup and on topology changes.

    Use the same configuration on both instances, except that db3's address is the tiebreaker host's address as seen from each instance.

    The same pattern extends to Galera. Two Galera nodes are an even-sized cluster and cannot form a quorum after losing one node, so a third vote is needed there too — and a Galera arbitrator supplies one without a third database host. The arbitrator daemon, garbd, joins the cluster as a full voting member with the default pc.weight of 1, but holds no data and is never a state-snapshot donor. It can be co-hosted with other applications, so one of the MaxScale servers will do.

    Two nodes plus an arbitrator is three votes. Losing one node leaves two, which is a majority, and the surviving node stays in the primary component and keeps accepting writes.

    The arbitrator is the third vote, so the surviving node keeps its quorum.

    A partition resolves the same way, and again the arbitrator's location decides it: the side that can reach the arbitrator has two votes of three, stays in the primary component, and accepts writes. The isolated node drops out of the primary component and refuses queries, so the MaxScale on that side has nothing to route to.

    The topology and the cost are the same as the tiebreaker case, but the mechanism is not, and the difference matters when you configure it.

    • The arbitrator is not a MaxScale server. garbd is a separate daemon with no SQL interface, so the monitor cannot query it or take a lock on it. Do not list it in the monitor's servers; the monitor sees two servers, not three.

    • There is no lock majority. cooperative_monitoring_locks is a MariaDB Monitor setting. Galera Monitor does not have it, and does not need it: by default it selects the node with the lowest wsrep_local_index as the primary, which is a property of the cluster rather than of the monitor, so two MaxScale instances independently reach the same answer.

    • The vote is Galera's, not MaxScale's. The arbitrator votes in the Galera primary-component quorum. Galera itself takes a minority component out of service, so there is no second write stream for the MaxScale instances to disagree about. Divergence is prevented a layer below MaxScale.

    • The arbitrator sees all replication traffic. It receives the same write-set stream as a full node, without storing it. Put it on a link that can carry that stream, and secure it with TLS from the same cluster CA as the nodes.

    • Two databases and two MaxScales is enough only when MaxScale failure is the risk you are protecting against and database-side fault tolerance is not. Use majority_of_running, and accept that a partition can diverge the cluster.

    • Three databases and two MaxScales is the topology to deploy when a fifth host is affordable. It tolerates one server down or a partition, with a full server's worth of read capacity for the third vote and no correlated failures.

    • A co-located tiebreaker buys the same tolerance on four hosts. Choose it when the fifth host is the obstacle, and place the tiebreaker on the MaxScale server whose side of a likely partition you want to survive.

    • A Galera arbitrator is the equivalent for a two-node Galera cluster, and the same placement logic applies.

    Whichever you choose, majority_of_all needs semisynchronous replication to make its guarantee real. Verify which instance is the primary monitor with maxctrl show monitors, and per-server lock state in the server-specific lock_held field.

    This page is licensed: CC BY-SA / Gnu FDL

    This page assumes you have read Failover With Multiple MaxScales. The lock arithmetic, the master lock, and the semisynchronous-replication requirement of majority_of_all are explained there and only referenced here.

    Comparing the Topologies

    cooperative locking
    maxscale.cnf
    [db1]
    type=server
    address=10.0.0.1
    port=3306
    
    [db2]
    type=server
    address=10.0.0.2
    port=3306
    
    [db3]
    type=server
    address=127.0.0.1
    port=3306
    
    [TheMonitor]
    type=monitor
    module=mariadbmon
    servers=db1,db2,db3
    cooperative_monitoring_locks=majority_of_all
    servers_no_promotion=db3
    auto_failover=true
    auto_rejoin=true
    
    [Read-Write-Service]
    type=service
    router=readwritesplit
    servers=db1,db2

    Two Databases and Two MaxScales

    With majority_of_running

    With majority_of_all

    Do not run majority_of_all over two servers if write availability matters. The mode is safe there but it has no fault tolerance at all: any one server down means no writes.

    Three Databases and Two MaxScales

    Two Databases, Two MaxScales, and a Co-located Tiebreaker

    Configuring the Tiebreaker

    majority_of_all guarantees consistency only with semisynchronous replication configured so the primary never falls back to asynchronous replication — see the . MariaDB needs an acknowledgment from one replica, and the tiebreaker can be the one that supplies it, so set rpl_semi_sync_slave_enabled=ON on the tiebreaker too. Otherwise a partition that isolates the primary with only the tiebreaker for company leaves the primary unable to get an acknowledgment from anywhere.

    Co-location concentrates failures. The MaxScale 1 host now carries two of the deployment's five roles, so losing it costs a MaxScale and the third vote together. The topology still survives that, but it has no margin left afterwards: the remaining two servers are exactly the majority that majority_of_all requires. Where a fifth host is affordable, the three-server topology has the better failure budget.

    Two Galera Nodes, Two MaxScales, and a Co-located Arbitrator

    How the Galera Case Differs

    Choosing a Topology

    See Also

    Failover With Multiple MaxScales
    Failure-tolerant replication and failover
    Configuring the Galera Monitor
    https://github.com/mariadb-corporation/mariadb-docs/tree/main/galera-cluster/galera-management/configuration/galera-arbitrator-daemon-garbd.md

    The WCAR filter (module wcar) captures client traffic and stores it in a replayable format.

    WCAR is designed to capture traffic on a production MaxScale instance. The captured data can then be used as a reproducible way of generating client traffic without having to write application-specific traffic generators.

    The captured workloads can be used to:

    • Verify that upgrades of MariaDB behave as expected.

    • Repeatedly measure effects of configuration changes, which is useful for database tuning.

    • Investigate why certain scenarios take longer then expected, as a kind of SQL debugging tool.

    • Both the capture MaxScale and replay MaxScale servers must use the same Linux distribution and CPU architecture. For example, if the capture was taken on an x86_64 RHEL 8 instance, the replay should also happen on an x86_64 RHEL 8 instance. Captured workloads are however usually compatible across different Linux distributions that use the same CPU architecture.

    • The capture MariaDB instance must have binlogging enabled (log-bin=1)

    Workload capture can be used without definitions in static configuration files and without a MaxScale restart.

    If you have an existing routing service named, e.g., RWS-Router in your configuration you can attach a capture filter to it dynamically:

    You can then start a capture with

    If limiting options were given the capture will stop automatically when one of the limits is triggered. You can also stop the capture at any time with:

    See Replay to see how the captured files are used.

    When capture is no longer needed you can remove it with:

    Define a capture filter by adding the following configuration object and add it to each service whose traffic is to be captured. The traffic from all services that use the filter will be combined so only use the filter in services that point to the same database cluster.

    Here is an example configuration for capturing from a single MariaDB server, where capture starts when MaxScale starts and stops when MaxScale is stopped (start_capture=true). MaxScale listens on port 4006 and connects to MariaDB on port 3306.

    This section explains how capture is done with configuration value start_capture=true.

    Two things are needed to replay a workload: the client traffic that's captured by MaxScale and a backup of the database that is used to initialize the replay server. The backup should be taken from the point in time where the capture starts and the simplest way to achieve this is to take a logical backup by doing the following.

    • Stop MaxScale

    • Take a backup of the database with mariadb-dump --all-databases --system=all

    • Start MaxScale

    Once MaxScale has been started, the captured traffic will be written to files in/var/lib/maxscale/wcar/<name> where <name> is the name of the filter (CAPTURE_FLTR in the examples).

    Each capture will generate a number of files named NAME_YYYY-MM-DD_HHMMSS.SUFFIX where NAME is the capture name (defaults to capture), YYYY-MM-DD is the date and HHMMSS is the time and the SUFFIX is one of .cx, .ex or.tx. For example, a capture started on the 18th of April 2024 at 10:26:11 would generate a file named capture_2024-04-18_102611.cx.

    To stop the capture, simply stop MaxScale, or issue the command:

    where CAPTURE_FLTR is the name given to the filter as in the example configuration above.

    To disable capturing altogether, remove the capture filter from the configuration and remove it from all services that it was added to. Restart MaxScale.

    If the replay is to take place on another server, the results can be collected easily from /var/lib/maxscale/wcar/ with the following command.

    Once the capture tarball has been generated, copy it to the replay server. You might then want to delete the directories on the capture server from /var/lib/maxscale/wcar/* to save space (and not copy them again later).

    Each of the commands can be called with the following syntax.

    The <filter> is the name of the filter instance. In the example configuration, the value is CAPTURE_FLTR. The [options] is a list of optional arguments that the command might expect.

    Starts a new capture. Issuing a start command will stop any ongoing capture.

    The start command supports optional key-value pairs. If the values are also defined in the configuration file the command line options have priority. The supported keys are:

    • prefix The prefix added to capture files. The default value is capture.

    • duration Limit capture to this duration. See also configuration file value capture_duration.

    • size Limit capture to approximately this many bytes in the file system. See also configuration file value capture_size.

    The start command options are not persistent, and only apply to the capture that was thus started.

    For example, starting a capture with the below command would create a capture file named Scenario1_2024-04-18_102605.cx and limit the file system usage to approximately 10GiB. If capture_duration was defined in the configuration file it would also be used.

    If both duration and size are specified, the one that triggers first, stops the capture.

    Running the same command again, but without size=10G, the capture_size used would be that defined in the configuration file or no limit if there was no such definition.

    Stops the currently active capture if one is in progress.

    Install the required packages on the MaxScale server where the replay is to be done. An additional dependency that must be manually installed is Python, version 3.9 or newer. On most Linux distributions a new enough version is available as the default Python interpreter. You may also need to install the development packages for Python, python3-devel on RHEL based systems or python3-dev on Debian based systems, as well as a C++ compiler.

    For RHEL 8, Rocky Linux 8 and Alma Linux 8, a newer version of Python must be installed along with the development headers with dnf install python39 python39-devel gcc-c++ and it must be set as the default python implementation with alternatives --set python3 /usr/bin/python3.9.

    The replay consists of restoring the database to the point in time where the capture was started. Start by restoring the replay database to this state. Once the database has been restored from the backup, copy the capture files over to the replay MaxScale server.

    Full Restore

    Start by restoring the database from the backup to put it at the point in time where the capture was started. The GTID position of the first commit within the capture can be seen in the output of the summary command:

    If the captured data has not been transformed to replay format yet, the command will perform the transformation before displaying the summary.

    Run maxplayer --help to see the command line options. The help output is also shown at the end of this file.

    The replay also requires a user account using which the captured traffic is replayed. This user must have access to all the tables in question. In practice the simplest way to do this for testing is to create the user as follows:

    Restore for read-only Replay

    For captures that are intended for read-only Replay, it may not be as important that the servers to be tested against are in the exact GTID the capture server was when capture started. In fact, it may be advantageous that the servers are at the state after the capture finished.

    On the other hand, Replay also supports write-only. Following the Full Restore procedure above and then running a write-only Replay prepares the replay server(s) for easily running read-only multiple times. This way of running read-only may, for example, be used when fine tuning server settings.

    When replay is first done, the capture files will be transformed in-place. Transform can be run separately as well. Depending on the size and structure of the capture file, Transform can use up to twice the space of the capture.ex file. The files with extension .ex contain most of the captured data (events).

    Start by copying the replay file tarball created earlier (captures.tar.gz) to the replay MaxScale server and copy it to a directory of your choice (here called/path/to/capture-dir). Then extract the files.

    After this, replay the workload against the baseline MariaDB setup:

    Once the baseline replay results have been generated, run the replay again but this time against the new MariaDB setup to which the baseline is compared to:

    After both replays have been completed, the results can be post-processed and visualized.

    The results of the captured replay must first be post-processed into summaries that the visualization will then use. First, the canonicals.csv file must be generated that is needed in the post-processing:

    After that, the baseline and comparison replay results can be post-processed into summaries using the maxpostprocess command:

    The visualization itself is done with the maxvisualize program. The visualization will open up a browser window to show the visualization. If no browser opens up, the visualization URL is also printed into the command line which by default should be http://localhost:8866/.

    To listen on all network interfaces, use --Voila.ip='0.0.0.0' as the last argument.

    • Type: path

    • Default: /var/lib/maxscale/wcar/

    • Mandatory: No

    • Dynamic: No

    Directory under which capture directories are stored. Each capture directory has the name of the filter. In the examples above the name CAPTURE_FLTR was used.

    • Type: boolean

    • Default: false

    • Mandatory: No

    • Dynamic: No

    Start capture when maxscale starts.

    • Type: duration

    • Default: 0s

    • Mandatory: No

    • Dynamic: No

    Limit capture to this duration. If set to zero there is no limit.

    • Type: size

    • Default: 0

    • Mandatory: No

    • Dynamic: No

    Limit capture to approximately this many bytes in the file system. If set to zero there is no limit.

    • KILL commands do not work correctly during replay and may kill the wrong session (MXS-5056)

    • COM_STMT_BULK_EXECUTE is not captured (MXS-5057)

    • COM_STMT_EXECUTE that uses a cursor is replayed without a cursor ()

    • For MyISAM and Aria tables, this will cause the table level lock to be held for a shorter time.

    • Execution of a COM_STMT_SEND_LONG_DATA will not work ()

    • The capture files are not necessarily compatible with different linux distributions and CPU architectures than the original capture server has. Different combinations will require further testing, and once done, this document will be updated.

    This page is licensed: CC BY-SA / Gnu FDL

    maxctrl create filter CAPTURE_FLTR wcar
    maxctrl link service RWS-Router CAPTURE_FLTR
    maxctrl call command wcar start CAPTURE_FLTR <options>
    maxctrl call command wcar stop CAPTURE_FLTR
    maxctrl unlink service RWS-Router CAPTURE_FLTR
    maxctrl destroy filter CAPTURE_FLTR
    [CAPTURE_FLTR]
    type=filter
    module=wcar
    capture_duration=1h # Limit capture duration to one hour
    capture_size=1Gi    # Limit capture size to 1GiB
    start_capture=true  # Start capturing immediately after starting MaxScale
    [server1]
    type=server
    address=127.0.0.1
    port=3306
    
    [MariaDB-Monitor]
    type=monitor
    module=mariadbmon
    servers=server1
    user=maxuser
    password=maxpwd
    
    [CAPTURE_FLTR]
    type=filter
    module=wcar
    capture_duration=1h     # Limit capture duration to one hour
    capture_size=1Gi        # Limit capture size to 1GiB
    start_capture=true      # Start capturing immediately after starting MaxScale
    
    [RWS-Router]
    type=service
    router=readwritesplit
    cluster=MariaDB-Monitor
    user=maxuser
    password=maxpwd
    filters=CAPTURE_FLTR
    
    [RWS-Listener]
    type=listener
    service=RWS-Router
    port=4006
    maxctrl call command wcar stop CAPTURE_FLTR
    tar -caf captures.tar.gz -C /var/lib/maxscale wcar
    maxctrl call command wcar <command> <filter> [options]
    maxctrl call command wcar start CAPTURE_FLTR prefix=Scenario1 size=10G
    maxctrl call command wcar stop CAPTURE_FLTR
    maxplayer summary /path/to/capture.cx
    CREATE USER 'maxreplay'@'%' IDENTIFIED BY 'replay-pw';
    GRANT ALL ON *.* TO 'maxreplay'@'%';
    cd /path/to/capture-dir
    tar -xaf captures.tar.gz
    maxplayer replay --user maxreplay --password replay-pw --host <host:port> --output baseline-result.csv /path/to/capture.cx
    maxplayer replay --user maxreplay --password replay-pw --host <host:port> --output comparison-result.csv /path/to/capture.cx
    maxplayer canonicals /path/to/capture.cx > canonicals.csv
    maxpostprocess canonicals.csv baseline-result.csv -o baseline-summary.json
    maxpostprocess canonicals.csv comparison-result.csv -o comparison-summary.json
    maxvisualize baseline-summary.json comparison-summary.json
    maxvisualize baseline-summary.json comparison-summary.json --Voila.ip='0.0.0.0'
    maxplayer -u user -p pwd --speed 1.5 -i 5s -o baseline.csv capture_2024-09-06_090002.cx --help
    Usage: maxplayer [OPTION]... [COMMAND] FILE
    
    Commands: (default: replay)
    summary    Show a summary of the capture.
    replay     Replay the capture.
    convert    Converts the input file (either .cx or .rx) to a replay file (.rx or .csv).
    canonicals List the canonical forms of the captured SQL as CSV.
    dump-data  Dump capture data as SQL.
    show       Show the SQL of one or more events.
    
    Options:
    --user          User name for login to the replay server.
    -u              This version does not support using the actual user names
                    that were used during capture.
    
    --password      Only clear text passwords are supported as of yet.
    -p
    
    --host          The address of the replay server in <IP>:<port> format.
    -h              E.g. 127.0.0.1:4006
    
    --output        The name of the output file: e.g. baseline.csv.
    -o
    
    --report        Periodically report statistics of ongoing operations.
    -r              The option takes a duration, such as 10s.
    
    --report-file   The --report option by default writes to stdout.
    -R              Provide the name of the file to write to. The file will
                    be truncated every time it is written to, allowing for a
                    simple status window by running 'watch cat <path-to-file>'
                    in a terminal.
    
    --speed         The value is a multiplier. 2.5 is 2.5x speed and 0.5 is half speed.
    -s              A value of zero means no limit, or replay as fast as possible.
                    A multiplier of 2.5 might not have any effect as the actual time spent
                    depends on many factors, such as the captured volume and replay server.
    
    --idle-wait     Relates to playback speed, and can be used together with --speed.
    -i              During capture there can be long delays where there is no traffic.
                    One hour of no capture traffic would mean replay waits for one hour.
                    idle-wait allows to move simulation time forwards when such gaps
                    occur. A 'gap' starts when all prior queries have fully executed.
                    --idle-wait takes a duration value. A negative value turns the feature off,
                                i.e. the one hour wait would happen.
                    --idle-wait 0s means time moves to the event start-time immediately
                                when a gap is detected, i.e., all gaps are skipped over.
                    --idle-wait 10s means time moves to the event start-time 10 seconds
                                (wall time) after the gap was detected. Shorter
                                gaps than 10 seconds will thus be fully waited for.
                    --idle-wait has a default value of 1 second.
                    Examples: 1h, 60m, 3600s, 3600000ms, which all define the same duration.
    
    --query-filter  Options: none, write-only, read-only. Default: none.
    -f              Replay can optionally apply only writes or only reads. This option is useful
                    once the databases to be tested have been prepared (see full documentation)
                    and optionally either a write-only run, or a full replay has been run.
                    Now multiple read-only runs against the server(s) are simple as no further
                    data synchronization is needed.
                    Note that this mode has its limitations as the query results may
                    be very different than what they were during capture.
    
    --analyze       Enabling this option will track the server Rows_read statistic for each query.
    -A              This will slow down the overall replay time. The query time measurements
                    are still valid, but currently this option should only be used when
                    it is of real value to know how many rows the server read for each query.
    
    --verbose       Verbose output. The option can be repeated for more verbosity: -vvv
    -v
    
    --version       Display the version number and copyrights.
    -V
    
    input file:       capture_2024-09-06_090002.cx
    -h --help         true
    -u --user         user
    -p --password     pwd
    -H --host         127.1.1.0:3306
    -o --output       baseline.csv
    -r --report       0ns
    -R --report-file
    -s --speed        1.5
    -i --idle-wait    5s
    -f --query-filter none
    -A --analyze      false
    -v --verbose      0
    -V --version      0.2

    Overview

    Prerequisites

    Capture

    Quick start

    File based configuration

    Example configuration file

    Capturing Traffic

    Stopping the Capture

    Commands

    start <filter> [options]

    stop <filter>

    Replay

    Installation

    Preparing the Replay MariaDB Database

    Replaying the Capture

    Visualizing

    Settings

    capture_dir

    start_capture

    capture_duration

    capture_size

    maxplayer command line options

    Limitations

    spinner

    MaxScale Masking Filter

    Obfuscate sensitive data in query results. This filter masks specific columns based on user roles, ensuring compliance with privacy regulations without altering the database.

    Overview

    With the masking filter it is possible to obfuscate the returned value of a particular column.

    For instance, suppose there is a table person that, among other columns, contains the column ssn where the social security number of a person is stored.

    With the masking filter it is possible to specify that when the ssn field is queried, a masked value is returned unless the user making the query is a specific one. That is, when making the query

    > SELECT name, ssn FROM person;

    instead of getting the real result, as in

    +-------+-------------+
    + name  | ssn         |
    +-------+-------------+
    | Alice | 721-07-4426 |
    | Bob   | 435-22-3267 |
    ...

    the ssn would be masked, as in

    +-------+-------------+
    + name  | ssn         |
    +-------+-------------+
    | Alice | XXX-XX-XXXX |
    | Bob   | XXX-XX-XXXX |
    ...

    Note that the masking filter should be viewed as a best-effort solution intended for protecting against accidental misuse rather than malicious attacks.

    From MaxScale 2.3 onwards, the masking filter will reject statements that use functions in conjunction with columns that should be masked. Allowing function usage provides a way for circumventing the masking, unless a firewall filter is separately configured and installed.

    Please see the configuration parameter for how to change the default behaviour.

    From MaxScale 2.3.5 onwards, the masking filter will check the definition of user variables and reject statements that define a user variable using a statement that refers to columns that should be masked.

    Please see the configuration parameter for how to change the default behaviour.

    From MaxScale 2.3.5 onwards, the masking filter will examine unions and if the second or subsequent SELECT refer to columns that should be masked, the statement will be rejected.

    Please see the configuration parameter for how to change the default behaviour.

    From MaxScale 2.3.5 onwards, the masking filter will examine subqueries and if a subquery refers to columns that should be masked, the statement will be rejected.

    Please see the configuration parameter for how to change the default behaviour.

    Note that in order to ensure that it is not possible to get access to masked data, the privileges of the users should be minimized. For instance, if a user can create tables and perform inserts, he or she can execute something like

    to get access to the cleartext version of a masked field ssn.

    From MaxScale 2.3.5 onwards, the masking filter will, if any of theprevent_function_usage, check_user_variables, check_unions orcheck_subqueries parameters is set to true, block statements that cannot be fully parsed.

    Please see the configuration parameter for how to change the default behaviour.

    From MaxScale 2.3.7 onwards, the masking filter will treat any strings passed to functions as if they were fields. The reason is that as the MaxScale query classifier is not aware of whether ANSI_QUOTES is enabled or not, it is possible to bypass the masking by turning that option on.

    Before this change, the content of the field ssn would have been returned in clear text even if the column should have been masked.

    Note that this change will mean that there may be false positives if ANSI_QUOTES is not enabled and a string argument happens to be the same as the name of a field to be masked.

    Please see the configuration parameter [treat_string_arg_as_field(#treat_string_arg_as_field) for how to change the default behaviour.

    The masking filter can only be used for masking columns of the following types: BINARY, VARBINARY, CHAR, VARCHAR, BLOB, TINYBLOB,MEDIUMBLOB, LONGBLOB, TEXT, TINYTEXT, MEDIUMTEXT, LONGTEXT

    Currently, the masking filter can only work on packets whose payload is less than 16MB. If the masking filter encounters a packet whose payload is exactly that, thus indicating a situation where the payload is delivered in multiple packets, the value of the parameter large_payloads specifies how the masking filter should handle the situation.

    The masking filter is taken into use with the following kind of configuration setup.

    The masking filter has one mandatory parameter - rules.

    • Type: path

    • Mandatory: Yes

    • Dynamic: Yes

    Specifies the path of the file where the masking rules are stored. A relative path is interpreted relative to the module configuration directory of MariaDB MaxScale. The default module configuration directory is_/etc/maxscale.modules.d_.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: never

    With this optional parameter the masking filter can be instructed to log a warning if a masking rule matches a column that is not of one of the allowed types.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: ignore

    This optional parameter specifies how the masking filter should treat payloads larger than 16MB, that is, payloads that are delivered in multiple MySQL protocol packets.

    The values that can be used are ignore, which means that columns in such payloads are not masked, and abort, which means that if such payloads are encountered, the client connection is closed. The default is abort.

    Note that the aborting behaviour is applied only to resultsets that contain columns that should be masked. There are no limitations on resultsets that do not contain such columns.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    This optional parameter specifies how the masking filter should behave if a column that should be masked, is used in conjunction with some function. As the masking filter works only on the basis of the information in the returned result-set, if the name of a column is not present in the result-set, then the masking filter cannot mask a value. This means that the masking filter basically can be bypassed with a query like:

    If the value of prevent_function_usage is true, then all statements that contain functions referring to masked columns will be rejected. As that means that also queries using potentially harmless functions, such as LENGTH(masked_column), are rejected as well, this feature can be turned off. In that case, the firewall filter should be setup to allow or reject the use of certain functions.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    This optional parameter specifies how the masking filter should behave in case any of prevent_function_usage, check_user_variables,check_unions or check_subqueries is true and it encounters a statement that cannot be fully parsed,

    If true, then statements that cannot be fully parsed (due to a parser limitation) will be blocked.

    Note that if this parameter is set to false, then prevent_function_usage,check_user_variables, check_unions and check_subqueries are rendered less effective, as it with a statement that cannot be fully parsed may be possible to bypass the protection that they are intended to provide.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    This optional parameter specifies how the masking filter should treat strings used as arguments to functions. If true, they will be handled as fields, which will cause fields to be masked even if ANSI_QUOTES has been enabled and " is used instead of backtick.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    This optional parameter specifies how the masking filter should behave with respect to user variables. If true, then a statement like

    will be rejected if ssn is a column that should be masked.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    This optional parameter specifies how the masking filter should behave with respect to UNIONs. If true, then a statement like

    will be rejected if b is a column that should be masked.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    This optional parameter specifies how the masking filter should behave with respect to subqueries. If true, then a statement like

    will be rejected if a is a column that should be masked.

    The masking rules are expressed as a JSON object.

    The top-level object is expected to contain a key rules whose value is an array of rule objects.

    Each rule in the rules array is a JSON object, expected to contain the keys replace, with, applies_to andexempted. The two former ones are obligatory and the two latter ones optional.

    The value of this key is an object that specifies the column whose values should be masked. The object must contain the keycolumn and may contain the keys table and database. The value of these keys must be a string.

    If only column is specified, then a column with that name matches irrespective of the table and database. If table is specified, then the column matches only if it is in a table with the specified name, and if database is specified when the column matches only if it is in a database with the specified name.

    NOTE If a rule contains a table/database then if the resultset does not contain table/database information, it will always be considered a match if the column matches. For instance, given the rule above, if there is a table person2, also containing an ssn field, then a query like

    will not return masked values, but a query like

    will only return masked values, even if the ssn values fromperson2 in principle should not be masked. The same effect is observed even with a nonsensical query like

    even if nothing from person2 should be masked. The reason is that as the resultset contains no table information, the values must be masked if the column name matches, as otherwise the masking could easily be circumvented with a query like

    The optional key match makes partial replacement of the original value possible: only the matched part would be replaced with the fill character. The match value must be a valid pcre2 regular expression.

    The obfuscate rule allows the obfuscation of the value by passing it through an obfuscation algorithm. Current solution uses a non-reversible obfuscation approach.

    However, note that although it is in principle impossible to obtain the original value from the obfuscated one, if the range of possible original values is limited, it is straightforward to figure out the possible original values by running all possible values through the obfuscation algorithm and then comparing the results.

    The minimal configuration is:

    Output example for Db field name = 'remo'

    The value of this key is an object that specifies what the value of the matched column should be replaced with for the replace rule. Currently, the object is expected to contain either the key value or the key fill. The value of both must be a string with length greater than zero. If both keys are specified, value takes precedence. If fill is not specified, the default X is used as its value.

    If value is specified, then its value is used to replace the actual value verbatim and the length of the specified value must match the actual returned value (from the server) exactly. If the lengths do not match, the value offill is used to mask the actual value.

    When the value of fill (fill-value) is used for masking the returned value, the fill-value is used as many times as necessary to match the length of the return value. If required, only a part of the fill-value may be used in the end of the mask value to get the lengths to match.

    With this optional key, whose value must be an array of strings, it can be specified what users the rule is applied to. Each string should be a MariaDB account string, that is, % is a wildcard.

    If this key is not specified, then the masking is performed for all users, except the ones exempted using the key exempted.

    With this optional key, whose value must be an array of strings, it can be specified what users the rule is not applied to. Each string should be a MariaDB account string, that is, % is a wildcard.

    Read documentation for details about module commands.

    The masking filter supports the following module commands.

    Reload the rules from the rules file. The new rules are taken into use only if the loading succeeds without any errors.

    MyMaskingFilter refers to a particular filter section in the MariaDB MaxScale configuration file.

    In the following we configure a masking filter MyMasking that should always log a warning if a masking rule matches a column that is of a type that cannot be masked, and that should abort the client connection if a resultset package is larger than 16MB. The rules for the masking filter are in the file masking_rules.json.

    The rules specify that the data of a column whose name is ssn, should be replaced with the string 012345-ABCD. If the length of the data is not exactly the same as the length of the replacement value, then the data should be replaced with as many X characters as needed.

    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
    Definition

    MaxScale MaxGUI

    Navigate the MaxGUI browser-based interface. This reference outlines the dashboard features for visual configuration, cluster monitoring, and query execution in MariaDB MaxScale.

    This tutorial is an overview of what the MaxGUI offers as an alternative solution to .

    1. . i.e. Service, Server, Monitor, Filter, and Listener (Clicking on it will navigate to its detail page)

    2. Create a new MaxScale object.

    MXS-5059
    MXS-5060

    Yes

    Yes

    2 Galera nodes + 2 MaxScales + co-located arbitrator

    4

    Yes

    Yes

    2 databases + 2 MaxScales
    3 databases + 2 MaxScales
    2 databases + 2 MaxScales + co-located tiebreaker
    semisynchronous-replication requirement
    ,
    ENUM
    and
    SET
    . If the type of the column is something else, then no masking will be performed.
    ,
    always
  • Default: never

  • ,
    abort
  • Default: abort

  • Security

    Limitations

    Configuration

    Settings

    rules

    warn_type_mismatch

    large_payload

    prevent_function_usage

    require_fully_parsed

    treat_string_arg_as_field

    check_user_variables

    check_unions

    check_subqueries

    Rules

    replace

    obfuscate

    with

    applies_to

    exempted

    Module commands

    reload

    Example

    Configuration

    masking_rules.json

    prevent_function_usage
    check_user_variables
    check_unions
    check_subqueries
    require_fully_parsed
    enum
    enum
    bool
    bool
    bool
    bool
    bool
    bool
    Module Commands
    spinner
    CREATE TABLE cheat (revealed_ssn TEXT);
    INSERT INTO cheat SELECT ssn FROM users;
    SELECT revealed_ssn FROM cheat;
    mysql> set @@sql_mode = 'ANSI_QUOTES';
    mysql> select concat("ssn") from managers;
    [Mask-SSN]
    type=filter
    module=masking
    rules=...
    
    [SomeService]
    type=service
    ...
    filters=Mask-SSN
    rules=/path/to/rules-file
    warn_type_mismatch=always
    large_payload=ignore
    SELECT CONCAT(masked_column) FROM tbl;
    prevent_function_usage=false
    require_fully_parsed=false
    treat_string_arg_as_field=false
    set @a = (select ssn from customer where id = 1);
    check_user_variables=false
    SELECT a FROM t1 UNION SELECT b FROM t2;
    check_unions=false
    SELECT * FROM (SELECT a AS b FROM t1) AS t2;
    check_subqueries=false
    {
        "rules": [ ... ]
    }
    {
        "rules": [
            {
                "replace": { ... },
                "with": { ... },
                "applies_to": [ ... ],
                "exempted": [ ... ]
            }
        ]
    }
    {
        "rules": [
            {
                "replace": {
                    "database": "db1",
                    "table": "person",
                    "column": "ssn"
                },
                "with": { ... },
                "applies_to": [ ... ],
                "exempted": [ ... ]
            }
        ]
    }
    SELECT ssn FROM person2;
    SELECT ssn FROM person UNION SELECT ssn FROM person2;
    SELECT ssn FROM person2 UNION SELECT ssn FROM person2;
    SELECT ssn FROM person UNION SELECT ssn FROM person;
    "replace": {
                    "column": "ssn",
                    "match": "(123)"
                },
                "with": {
                    "fill": "X#"
                }
    "obfuscate": {
                    "column": "name"
                }
    SELECT name from db1.tbl1;`
    
    +------+
    | name |
    +------+
    | $-~) |
    +------+
    {
        "rules": [
            {
                "replace": {
                    "column": "ssn"
                },
                "with": {
                    "value": "XXX-XX-XXXX"
                },
                "applies_to": [ ... ],
                "exempted": [ ... ]
            },
            {
                "replace": {
                    "column": "age"
                },
                "with": {
                    "fill": "*"
                },
                "applies_to": [ ... ],
                "exempted": [ ... ]
            },
            {
                "replace": {
                    "column": "creditcard"
                },
                "with": {
                    "value": "1234123412341234",
                    "fill": "0"
                },
                "applies_to": [ ... ],
                "exempted": [ ... ]
            },
        ]
    }
    {
        "rules": [
            {
                "replace": { ... },
                "with": { ... },
                "applies_to": [ "'alice'@'host'", "'bob'@'%'" ],
                "exempted": [ ... ]
            }
        ]
    }
    {
        "rules": [
            {
                "replace": { ... },
                "with": { ... },
                "applies_to": [ ... ],
                "exempted": [ "'admin'" ]
            }
        ]
    }
    MaxScale> call command masking reload MyMaskingFilter
    [MyMasking]
    type=filter
    module=masking
    warn_type_mismatch=always
    large_payload=abort
    rules=masking_rules.json
    
    [MyService]
    type=service
    ...
    filters=MyMasking
    {
        "rules": [
            {
                "replace": {
                    "column": "ssn"
                },
                "with": {
                    "value": "012345-ABCD",
                    "fill": "X"
                }
            }
        ]
    }

    upgrade

    • A change from lower-versioned release of MariaDB MaxScale to a higher-versioned release of MariaDB MaxScale.

    Upgrades can move or change configuration files. Before starting an upgrade, always back up your configuration so you can revert to the working system if you encounter any issues during the upgrade.

    A complete backup must include both the static configuration and any configuration MaxScale has persisted at runtime:

    • The main configuration file, /etc/maxscale.cnf.

    • Any auxiliary static configuration files in /etc/maxscale.cnf.d/.

    • The persisted configuration directory. Changes made at runtime through MaxCtrl, the REST API, or the GUI are saved here as individual .cnf files and override the static configuration when MaxScale restarts. This directory defaults to /var/lib/maxscale/maxscale.cnf.d/ and is set by the parameter in the [maxscale] section.

    MariaDB Corporation provides package repositories for YUM (RHEL, CentOS, Rocky Linux), APT (Debian, Ubuntu), and ZYpp (SLES).

    Before upgrading MariaDB MaxScale, first stop the current process.

    For distributions that use systemd (most supported OSes), you can manage the Server process using the systemctl command:

    Upgrade MaxScale following the instructions for your Linux distribution:

    Upgrade via DNF (RHEL)

    1

    Customer Download Token

    Retrieve your Customer Download Token at https://customers.mariadb.com/downloads/token/ and substitute for CUSTOMER_DOWNLOAD_TOKEN in the following directions.

    2

    Configure YUM / DNF package repository

    Pass the version you want to install using the --mariadb-maxscale-version flag to the script. The following directions reference 25.01.

    To configure YUM 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.

    Upgrade via APT (Debian, Ubuntu)

    1

    Customer Download Token

    Retrieve your Customer Download Token at and substitute for CUSTOMER_DOWNLOAD_TOKEN in the following directions.

    2

    Upgrade via ZYpp (SLES)

    1

    Customer Download Token

    Retrieve your Customer Download Token at and substitute for CUSTOMER_DOWNLOAD_TOKEN in the following directions.\

    2

    Configuration parameters can change between releases of MariaDB MaxScale, which can have unexpected results.

    1. Determine which parameters have changed by reviewing all the changes made between your current release and the upgrade release.

    2. Change the specific parameters in maxscale.cnf.

    Changes in MaxScale 23.02

    When upgrading from MaxScale 22.08 and earlier to MaxScale 25.01, the changes introduced in MaxScale 23.02 must be taken into consideration.

    MariaDB MaxScale 22.08 is fully compatible with MariaDB MaxScale 23.02 with the exception that some features have been removed.

    Removed Features

    • The csmon monitor has been removed after previously being deprecated in MaxScale 22.08.2.

    • The auroramon 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

    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

    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

    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:

    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.

    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

    Start

    sudo systemctl start maxscale

    Stop

    sudo systemctl stop maxscale

    Restart

    sudo systemctl restart maxscale

    When you have MariaDB MaxScale up and running, you should test it to ensure that it is working and that weren't any issues during startup.

    Check that MaxScale is running properly by using the MaxCtrl utility:

    This page is licensed: CC BY-SA / Gnu FDL

    MaxScale instance

    Term Definitions

    • MariaDB MaxScale running by itself on a single host.

    • It interacts with other hosts, such as deployments using , , and .

    • It serves as the database proxy and load balancer.

    sudo cp /etc/maxscale.cnf /data/backups/config/maxscale.cnf
    sudo cp -r /etc/maxscale.cnf.d /data/backups/config/maxscale.cnf.d
    sudo cp -r /var/lib/maxscale/maxscale.cnf.d /data/backups/config/persisted.cnf.d
    sudo systemctl stop maxscale
    sudo maxctrl show maxscale
    ┌──────────────┬──────────────────────────────────────────────────────────────────────┐
    │ Version      │ 25.01.2                                                              │
    ├──────────────┼──────────────────────────────────────────────────────────────────────┤
    │ Commit       │ 61b8bbf7f63c38ca9c408674e66f3627a0b2192e                             │
    ├──────────────┼──────────────────────────────────────────────────────────────────────┤
    │ Started At   │ Fri, 03 Jan 2025 18:05:18 GMT                                        │
    ├──────────────┼──────────────────────────────────────────────────────────────────────┤
    │ Activated At │ Fri, 03 Jan 2025 18:05:18 GMT                                        │
    ├──────────────┼──────────────────────────────────────────────────────────────────────┤
    │ Uptime       │ 109                                                                  │
    ├──────────────┼──────────────────────────────────────────────────────────────────────┤
    │ Parameters   │ {                                                                    │
    │              │     "libdir": "/usr/lib/x86_64-linux-gnu/maxscale",                  │
    │              │     "datadir": "/var/lib/maxscale",                                  │
    │              │     "process_datadir": "/var/lib/maxscale/data3850",                 │
    │              │     "cachedir": "/var/cache/maxscale",                               │
    │              │     "configdir": "/etc",                                             │
    │              │     "config_persistdir": "/var/lib/maxscale/maxscale.cnf.d",         │
    │              │     "module_configdir": "/etc/maxscale.modules.d",                   │
    │              │     "piddir": "/var/run/maxscale",                                   │
    │              │     "logdir": "/var/log/maxscale",                                   │
    │              │     "langdir": "/var/lib/maxscale",                                  │
    │              │     "execdir": "/usr/bin",                                           │
    │              │     "connector_plugindir": "/usr/lib/x86_64-linux-gnu/mysql/plugin", │
    │              │     "threads": 1,                                                    │
    │              │     "thread_stack_size": 8388608,                                    │
    │              │     "writeq_high_water": 0,                                          │
    │              │     "writeq_low_water": 0,                                           │
    │              │     "auth_connect_timeout": 3,                                       │
    │              │     "auth_read_timeout": 1,                                          │
    │              │     "auth_write_timeout": 2,                                         │
    │              │     "skip_permission_checks": false,                                 │
    │              │     "admin_auth": true,                                              │
    │              │     "admin_enabled": true,                                           │
    │              │     "admin_log_auth_failures": true,                                 │
    │              │     "admin_host": "127.0.0.1",                                       │
    │              │     "admin_port": 8989,                                              │
    │              │     "admin_ssl_key": "",                                             │
    │              │     "admin_ssl_cert": "",                                            │
    │              │     "admin_ssl_ca_cert": "",                                         │
    │              │     "admin_pam_readwrite_service": "",                               │
    │              │     "admin_pam_readonly_service": "",                                │
    │              │     "passive": false,                                                │
    │              │     "query_classifier": "",                                          │
    │              │     "query_classifier_cache_size": 155008819,                        │
    │              │     "retain_last_statements": 0,                                     │
    │              │     "dump_last_statements": "never",                                 │
    │              │     "session_trace": 0,                                              │
    │              │     "load_persisted_configs": true,                                  │
    │              │     "max_auth_errors_until_block": 10                                │
    │              │ }                                                                    │
    └──────────────┴──────────────────────────────────────────────────────────────────────┘

    Backing Up Configuration

    If you set persistdir to a non-default location in /etc/maxscale.cnf, back up that directory instead of /var/lib/maxscale/maxscale.cnf.d/.

    Upgrade

    Stop the MaxScale Process

    Upgrade MaxScale

    Configuration

    Changes in MaxScale Versions

    Starting the MaxScale Instance

    Testing

    Checking MaxScale Status

    Dashboard Tab Navigation.

  • Search Input. This can be used as a quick way to search for a keyword in tables.

  • Dashboard graphs. Refresh interval is 10 seconds.

    • SESSIONS graph illustrates the total number of current sessions.

    • CONNECTIONS graph shows servers current connections.

    • LOAD graph shows the last second load of thread.

    1. Logout of the app.

    2. Sidebar navigation menu. Access to the following pages: Dashboard, Visualization, Settings, Logs Archive, Query Editor

    3. Expand/Collapse the graphs.

    4. Graph annotation configuration.

    5. Active Operations Bar: This bar chart represents the proportion of active operations on the server relative to the total number of connections. The value displayed is the ratio of active_operations to connections, providing a visual gauge of server activity.

    Clicking on the Create New button (Annotation 2) to open a dialog for creating a new object.

    The replication status of a server monitored by MariaDB-Monitor can be viewed by mousing over the server name. A tooltip will be displayed with the following information: replication_state, seconds_behind_master, slave_io_running, slave_sql_running.

    A session can be killed easily on the "Current Sessions" list which can be found on the Dashboard, Server detail, and Service detail page.

    1. Kill session button. This button is shown on the mouse hover.

    2. Confirm killing the session dialog.

    Sessions created by the "Workspace", such as via the Query Editor can be found in two places:

    Annotation

    1. A session with an icon next to the "CLIENT" column indicates a connection created by the "Workspace".

    This table displays the result set from the PROCESSLIST table, with options to filter processes created by the "Workspace".

    Annotation

    1. Filter option.

    This page shows information on each MaxScale object and allow to edit its parameter, relationships and perform other manipulation operations. Most of the control buttons will be shown on the mouse hover. Below is a screenshot of a Monitor Detail page, other Detail pages also have a similar layout structure so this is used for illustration purpose.

    1. Settings option. Clicking on the gear icon will show icons allowing to do different operations depending on the type of the Detail page.

      • Monitor Detail page, there are icons to Stop, Start, and Destroy monitor.

      • Service Detail page, there are icons to Stop, Start, and Destroy service.

      • Server Detail page, there are icons to Set maintenance mode, Clear server state, Drain and Delete server.

      • Filter and Listener Detail page, there is a delete icon to delete the object.

    2. Switchover button. This button is shown on the mouse hover allowing to swap the running primary server with a designated secondary server.

    3. Edit parameters button. This button is shown on the mouse hover allowing to edit the MaxScale object's parameter. Clicking on it will enable editable mode on the table. After finishing editing the parameters, simply click the Done Editing button.

    4. A Detail page has tables showing "Relationship" between other MaxScale object. This "unlink" icon is shown on the mouse hover allowing to remove the relationship between two objects.

    5. This button is used to link other MaxScale objects to the relationship.

    This page visualizes MaxScale configuration and clusters.

    This page visualizes MaxScale configuration as shown in the figure below.

    1. A MaxScale object (a node graph). The position of the node in the graph can be changed by dragging and dropping it.

    2. Anchor link. The detail page of each MaxScale object can be accessed by clicking on the name of the node.

    3. Filter visualization button. By default, if the number of filters used by a service is larger than 3, filter nodes aren't visualized as shown in the figure. Clicking this button will visualize them.

    4. Hide filter visualization button.

    5. Refresh rate dropdown. The frequency with which the data is refreshed.

    6. Create a new MaxScale object button.

    7. Zoom level control.

    8. Export diagram as jpeg.

    This page shows all monitor clusters using mariadbmon module in a card-like view. Clicking on the card will visualize the cluster into a tree graph as shown in the following figure.

    1. Drag a secondary server on top of a primary server to promote the secondary server as the new primary server.

    2. Server manipulation operations button. Showing a dropdown with the following operations:

      • Set maintenance mode: Setting a server to a maintenance mode.

      • Clear server state: Clear current server state.

      • Drain server: Drain the server of connections.

    3. Quick access to query editor button. Opening the Query Editor page for this server. If the connection is already created for that server, it'll use it. Otherwise, it creates a blank worksheet and shows a connection dialog to connect to that server.

    4. Carousel navigation button. Viewing more information about the server in the next slide.

    5. Collapse the carousel.

    6. Anchor link of the server. Opening the detail page of the server in a new tab.

    7. Collapse its children nodes.

    8. Rejoin node. When the auto_rejoin parameter is disabled, the node can be manually rejoined by dragging it on top of the primary server.

    9. Monitor manipulation operations button. Showing a dropdown with the following operations:

      • Stop monitor.

      • Start monitor.

    10. Refresh rate dropdown. The frequency with which the data is refreshed.

    11. Create a new MaxScale object button.

    This page shows and allows editing of MaxScale parameters.

    1. Edit parameters button. This button is shown on the mouse hover allowing to edit the MaxScale parameter. Clicking on it will enable editable mode on the table.

    2. Editable parameters are visible as it's illustrated in the screenshot.

    3. After finishing editing the parameters, simply click the Done Editing button.

    This page show real-time MaxScale logs with filter options.

    1. Filter by priorities.

    2. Apply filter button.

    On this page, you may add numerous worksheets, each of which can be used for "Run queries", "Data migration", or "Create an ERD" task.

    Clicking on the "Run Queries" card will open a dialog, providing options to establish a connection to different MaxScale object types, including "Listener, Server, Service".

    The Query Editor worksheet will be rendered in the active worksheet after correctly connecting.

    There are various features in the Query Editor worksheet, the most notable ones are listed below.

    Create a new connection

    If the connection of the Query Editor expires, or if you wish to make a new connection for the active worksheet, simply clicking on the button located on the right side of the query tabs navigation bar which features a server icon and an active connection name as a label. This will open the connection dialog and allow you to create a new connection.

    Schemas objects sidebar

    Set the current database

    There are two ways to set the current database:

    • Double-click on the name of the database.

    • Right-click on the name of the database to show the context menu, then select the Use database option.

    Preview table data of the top 1000 rows

    There are two ways to preview data of a table:

    • Click on the name of the table.

    • Right-click on the name of the table to show the context menu, then select the Preview Data (top 1000) option.

    Describe table

    Right-click on the name of the table to show the context menu, then select theView Details option.

    Alter/Drop/Truncate/Create table

    Right-click on the name of the table to show the context menu, then select the desired option.

    Alter/Drop/Create schema

    Right-click on the name of the schema to show the context menu, then select the desired option.

    Alter/Create View, Function, Stored Procedure, Trigger

    Right-click on the group node (e.g., Views, Functions, Stored Procedures, Triggers) to show the context menu, then select the desired option.

    Quickly insert an object into the editor

    There are two ways to quickly insert an object to the editor:

    • Drag the object and drop it in the desire position in the editor.

    • Right-click on the object to show the context menu, then mouse hover the Place to Editor option and select the desired insert option.

    Show object creation statement and insights info

    To view the statement that creates the given object in the Schemas objects sidebar, right-clicking on schema or table node and select the View Insights option. For other objects such as view, stored procedure, function and trigger, select the Show Create option.

    Editor

    The editor is powered by Monaco editor, therefore, its features are similar to those of Visual Studio Code.

    To see the command palette, press F1 while the cursor is active on the editor.

    The editor also comes with various options to assist your querying tasks. To see available options, right-click on the editor to show the context menu.

    How to write compound statements

    By default, all statements in the "Query Tab" are split by semicolons and executed one by one on the server. To write the compound statements, use the DELIMITER command to change the delimiter.

    ####### Annotation

    1. Change the delimiter to //

    2. End of the statement using the new delimiter

    3. Change the delimiter back to the default semicolon.

    Re-execute old queries

    Every executed query will be saved in the browser's storage (IndexedDB). Query history can be seen in the History/Snippets tab. To re-execute a query, follow the same step to insert an object into the editor and click the execute query button in the editor.

    Create query snippet

    Press CTRL/CMD + D to save the current SQL in the editor to the snippets storage. A snippet is created with a prefix keyword, so when that keyword is typed in the editor, it will be suggested in the "code completion" menu.

    Generate an ERD

    To initiate the process, either right-click on the schema name and select the Generate ERD option, or click on the icon button that resembles a line graph, located on the schemas sidebar. This will open a dialog for selecting the tables for the diagram.

    Clicking on the "Data Migration" card will open a dialog, providing an option to name the task. The Data Migration worksheet will be rendered in the active worksheet after clicking the Create button in the dialog.

    MaxScale uses ODBC for extracting and loading from the data source to a server in MaxScale. Before starting a migration, ensure that you have set up the necessary configurations on the MaxScale server. Instruction can be found here and limitations here.

    Connections

    Source connection shows the most common parameter inputs for creating an ODBC connection. For extra parameters, enable the Advanced mode to manually edit the Connection String input.

    After successfully connected to both source and destination servers, click on the Select objects to migrate to navigate to the next stage.

    Objects Selection

    Select the objects you wish to migrate to the MariaDB server.

    After selecting the desired objects, click on the Prepare Migration Script to navigate to the next stage. The migration scripts will be generated differently based on the value selected for the Create mode input. Hover over the question icon for additional information on the modes.

    Migration

    As shown in the screenshot, you can quickly modify the script for each object by selecting the corresponding object in the table and using the editors on the right-hand side to make any necessary changes.

    After clicking the Start Migration button, the script for each object will be executed in parallel.

    Migration report

    If errors are reported for certain objects, review the output messages and adjust the script accordingly. Then, click the Manage button and select Restart.

    To migrate additional objects, click the Manage button and select Migrate other objects. Doing so will replace the current migration report for the current object with a new one.

    To retain the report and terminate open connections after migration, click the Manage button, then select Disconnect, and finally delete the worksheet.

    Deleting the worksheet will not delete the migration task. To clean-up everything after migration, click the Manage button, then selectDelete.

    There are various features in the ERD worksheet, the most notable ones are listed below.

    From an empty new worksheet, clicking on the "Create an ERD" card will open a connection dialog. After connecting successfully, the ERD worksheet will be rendered in the active worksheet. The connection is required to retrieve essential metadata, such as engines, character sets, and collation.

    Generate an ERD from the existing databases

    Click on the icon button featured as a line graph, located on the top toolbar next to the connection button. This will open a dialog for selecting the tables for the diagram.

    Create a new ERD

    New tables can be created by using either of the following methods:

    • Click on the icon button that resembles a line graph, located on the top toolbar.

    • Right-click on the diagram board and select the Create Table option.

    Entity options

    Two options are available: Edit Table and Remove from Diagram. These options can be accessed using either of the following methods:

    • Right-click on the entity and choose the desired option.

    • Hover over the entity, click the gear icon button, and select the desired option.

    For quickly editing or viewing the table definitions, double-clicking on the entity. The entity editor will be shown at the bottom of the worksheet.

    Foreign keys quick common options

    • Edit Foreign Key, this opens an editor for viewing/editing foreign keys.

    • Remove Foreign Key.

    • Change to One To One or Change to One To Many. Toggling the uniqueness of the foreign key column.

    • Set FK Column Mandatory or Set FK Column Optional. Toggling the NOT NULL option of the foreign key column.

    • Set Referenced Column Mandatory or Set Referenced Column Optional Toggling the NOT NULL option of the referenced column.

    To show the above foreign key common options, perform a right-click on the link within the diagram.

    Viewing foreign key constraint SQL

    Hover over the link in the diagram, the constraint SQL of that foreign key will be shown in a tooltip.

    Quickly draw a foreign key link

    As shown in the screenshot, a foreign key can be quickly established by performing the following actions:

    1. Click on the entity that will have the foreign key.

    2. Click on the connecting point of the desired foreign key column and drag it over the desired referenced column.

    Entity editor

    Table columns, foreign keys and indexes can be modified via the entity editor which can be accessed quickly by double-clicking on the entity.

    Export options

    Three options are available: Copy script to clipboard, Export script and Export as jpeg. These options can be accessed using either of the following methods:

    • Right-click on the diagram board and choose the desired option.

    • Click the export icon button, and select the desired option.

    Applying the script

    Click the icon button resembling a play icon to execute the generated script for all tables in the diagram. This action will prompt a confirmation dialog for script execution. If needed, the script can be manually edited using the editor within the dialog.

    Visual Enhancement options

    The first section of the top toolbar, there are options to improve the visual of the diagram as follows:

    • Change the shape of links.

    • Draw foreign keys to columns.

    • Auto-arrange entities.

    • Highlight relationship.

    • Zoom control.

    This page is licensed: CC BY-SA / Gnu FDL

    Introduction

    Dashboard

    Annotation

    MaxCtrl
    MaxScale object

    Create a new MaxScale object

    View Replication Status

    How to kill a session

    Annotation

    View sessions created by the "Workspace"

    Dashboard "Current Sessions" tab

    Query Editor "Processlist"

    Detail

    Annotation

    Visualization

    Configuration

    Annotation

    Clusters

    Annotation

    Settings

    Annotation

    Logs Archive

    Annotation

    Workspace

    Run Queries

    Query Editor worksheet

    Data Migration

    Data Migration worksheet

    Create an ERD

    ERD worksheet

    spinner

    Common Monitor Parameters

    Configure standard settings for all MaxScale monitors. Learn about essential parameters like monitor intervals, backend timeouts, and user credentials for connecting to database servers.

    This document settings supported by all monitors. These should be defined in the monitor section of the configuration file.

    Settings

    module

    • Type: string

    • Mandatory: Yes

    • Dynamic: No

    The monitor module this monitor should use. Typically mariadbmon orgaleramon.

    • Type: string

    • Mandatory: Yes

    • Dynamic: Yes

    Username used by the monitor to connect to the backend servers. If a server defines the monitoruser parameter, that value will be used instead.

    • Type: string

    • Mandatory: Yes

    • Dynamic: Yes

    Password for the user defined with the user parameter. If a server defines the monitorpw parameter, that value will be used instead.

    Note: In older versions of MaxScale this parameter was called passwd. The use of passwd was deprecated in MaxScale 2.3.0.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    the monitor should activate right after connecting to a server. If empty, no role is set. This setting may be useful if the same username is used for both monitors and services. As monitors and services require different privileges, these privileges can be granted to the monitor and the service roles separately instead of granting them all to the same user. MariaDB Monitor and Galera Monitor currently use this setting. If the monitor is configured to use a role, the role is taken into use even if the server uses a .

    • Type: string

    • Mandatory: Yes

    • Dynamic: Yes

    A comma-separated list of servers the monitor should monitor.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 2s

    Defines how often the monitor updates the status of the servers. Choose a lower value if servers should be queried more often. The smallest possible value is 100 milliseconds. If querying the servers takes longer than monitor_interval, the effective update rate is reduced.

    If no explicit unit is provided, the value is interpreted as milliseconds in MaxScale 2.4. In subsequent versions a value without a unit may be rejected.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    Controls the timeout for communicating with a monitored server. The parameter sets the timeout for connecting, writing and reading from a server.

    The timeout is specified as documented . A value without a unit is rejected. The minimum value is 1 second.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 3s

    This parameter controls the timeout for connecting to a monitored server. The timeout is specified as documented A value without a unit is rejected. The minimum value is 1 second.

    This parameter has been deprecated since MaxScale 25.10.0 and is an alias of backend_timeout.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 3s

    Deprecated and ignored since MaxScale 25.10.0.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 3s

    Deprecated and ignored since MaxScale 25.08.0.

    This parameter controls the timeout for reading a query result from a monitored server. The timeout is specified as documented A value without a unit is rejected, as are values specified in milliseconds. The minimum value is 1 second.

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 1

    This parameter defines the maximum times a backend connection is attempted every monitoring loop. Every attempt may take up to backend_connect_timeout seconds to perform. If none of the attempts are successful, the backend is considered to be unreachable and down.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    This parameter duplicates the disk_space_threshold . If the parameter has not been specified for a server, then the one specified for the monitor is applied.

    NOTE: Since MariaDB 10.4.7, MariaDB 10.3.17 and MariaDB 10.2.26, the information will be available only if the monitor user has the FILE privilege.

    That is, if the disk configuration is the same on all servers monitored by the monitor, it is sufficient (and more convenient) to specify the disk space threshold in the monitor section, but if the disk configuration is different on all or some servers, then the disk space threshold can be specified individually for each server.

    For example, suppose server1, server2 and server3 are identical in all respects. In that case we can specify disk_space_threshold in the monitor.

    However, if the servers are heterogeneous with the disk used for the data directory mounted on different paths, then the disk space threshold must be specified separately for each server.

    If most of the servers have the data directory disk mounted on the same path, then the disk space threshold can be specified on the monitor and separately on the server with a different setup.

    Above, server1 has the disk used for the data directory mounted at /DbData while both server2 and server3 have it mounted on/data and thus the setting in the monitor covers them both.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0s

    With this parameter it can be specified the minimum amount of time between disk space checks. If no explicit unit is provided, the value is interpreted as milliseconds in MaxScale 2.4. In subsequent versions a value without a unit may be rejected. The default value is 0, which means that by default the disk space will not be checked.

    Note that as the checking is made as part of the regular monitor interval cycle, the disk space check interval is affected by the value ofmonitor_interval. In particular, even if the value ofdisk_space_check_interval is smaller than that of monitor_interval, the checking will still take place at monitor_interval intervals.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    This command will be executed on a server state change. The parameter should be an absolute path to a command or the command should be in the executable path. The user running MaxScale should have execution rights to the file itself and the directory it resides in. The script may have placeholders which MaxScale will substitute with useful information when launching the script.

    The placeholders and their substitution results are:

    • $INITIATOR -> IP and port of the server which initiated the event

    • $EVENT -> event description, e.g. "server_up"

    • $LIST -> list of IPs and ports of all servers

    The expanded variable value can be an empty string if no servers match the variable's requirements. For example, if no primaries are available $MASTERLIST will expand into an empty string. The list-type substitutions will only contain servers monitored by the current monitor.

    The above script could be executed as:

    See section below for an example script.

    Any output by the executed script will be logged into the MaxScale log. Each outputted line will be logged as a separate log message.

    The log level on which the messages are logged depends on the format of the messages. If the first word in the output line is one of alert:, error:,warning:, notice:, info: or debug:, the message will be logged on the corresponding level. If the message is not prefixed with one of the keywords, the message will be logged on the notice level. Whitespace before, after or between the keyword and the colon is ignored and the matching is case-insensitive.

    Currently, the script must not execute any of the following MaxCtrl calls as they cause a deadlock:

    • alter monitor to the monitor executing the script

    • stop monitor to the monitor executing the script

    • call command to a MariaDB-Monitor that is executing the script

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 90s

    The timeout for the executed script. If no explicit unit is provided, the value is interpreted as seconds in MaxScale 2.4. In subsequent versions a value without a unit may be rejected. Note that since the granularity of the timeout is seconds, a timeout specified in milliseconds will be rejected, even if the duration is longer than a second.

    If the script execution exceeds the configured timeout, it is stopped by sending a SIGTERM signal to it. If the process does not stop, a SIGKILL signal will be sent to it once the execution time is greater than twice the configured timeout.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: master_down

    A list of event names which cause the script to be executed. If this option is not defined, all events cause the script to be executed. The list must contain a comma separated list of event names.

    The following table contains all the possible event types and their descriptions.

    Event Name
    Description
    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 28800s

    The maximum journal file age. If no explicit unit is provided, the value is interpreted as seconds in MaxScale 2.4. In subsequent versions a value without a unit may be rejected. Note that since the granularity of the max age is seconds, a max age specified in milliseconds will be rejected, even if the duration is longer than a second.

    When the monitor starts, it reads any stored journal files. If the journal file is older than the value of journal_max_age, it will be removed and the monitor starts with no prior knowledge of the servers.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    Defines custom SQL that is run on a primary server, i.e. a server with Master-status. The SQL is run on the primary when:

    1. Monitor starts

    2. Server gains Master-status

    3. Server gained Master-status on a previous monitor tick but running the SQL failed due to a network failure

    Use this setting to e.g. change global MariaDB Server settings depending on the server role. Multiple SQL queries can be set by combining them to a multiquery. If the query string spans multiple lines, each line after the first must start with empty space.

    When testing this feature to see exactly when the queries are run, look for a log message like Monitor MyMonitor ran the SQL defined in primary_state_sql on MyServer1.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    Similar to primary_state_sql, but for replica servers, i.e. servers with Slave-status.

    Starting with MaxScale 2.2.0, the monitor modules keep an on-disk journal of the latest server states. This change makes the monitors crash-safe when options that introduce states are used. It also allows the monitors to retain stateful information when MaxScale is restarted.

    For MySQL monitor, options that introduce states into the monitoring process are the detect_stale_master and detect_stale_slave options, both of which are enabled by default. Galeramon has the disable_master_failback parameter which introduces a state.

    The default location for the server state journal is in/var/lib/maxscale/<monitor name>/monitor.dat where <monitor name> is the name of the monitor section in the configuration file. If MaxScale crashes or is shut down in an uncontrolled fashion, the journal will be read when MaxScale is started. To skip the recovery process, manually delete the journal file before starting MaxScale.

    Below is an example monitor configuration which launches a script with all supported substitutions. The example script reads the results and prints it to file and sends it as email.

    File "maxscale_monitor_alert_script.sh":

    This page is licensed: CC BY-SA / Gnu FDL

    Destroy monitor.
  • Reset Replication.

  • Release ownership.

  • Master failover. Manually performing a primary failover. This option is visible only when the auto_failover parameter is disabled.

  • ColumnStore operations:

    • Stop cluster.

    • Start cluster.

    • Set cluster Read-Only.

    • Set cluster Read-Write.

    • Add node to cluster.

    • Remove node from cluster.

    Default: 3s

    $NODELIST -> list of IPs and ports of all running servers

  • $SLAVELIST -> list of IPs and ports of all replica servers

  • $MASTERLIST -> list of IPs and ports of all primary servers

  • $SYNCEDLIST -> list of IPs and ports of all synced Galera nodes

  • $PARENT -> IP and port of the parent of the server which initiated the event. For primary-replica setups, this will be the primary if the initiating server is a replica.

  • $CHILDREN -> list of IPs and ports of the child nodes of the server who initiated the event. For primary-replica setups, this will be a list of replica servers if the initiating server is a primary.

  • ,
    master_up
    ,
    slave_down
    ,
    slave_up
    ,
    server_down
    ,
    server_up
    ,
    lost_master
    ,
    lost_slave
    ,
    new_master
    ,
    new_slave
  • Default: All events

  • slave_up

    A Replica server has come up

    server_down

    A server with no assigned role has gone down

    server_up

    A server with no assigned role has come up

    lost_master

    A server lost Primary status

    lost_slave

    A server lost Replica status

    new_master

    A new Primary was detected

    new_slave

    A new Replica was detected

    master_down

    A Primary server has gone down

    master_up

    A Primary server has come up

    slave_down

    A Replica server has gone down

    user

    password

    role

    servers

    monitor_interval

    backend_timeout

    backend_connect_timeout

    backend_write_timeout

    backend_read_timeout

    backend_connect_attempts

    disk_space_threshold

    disk_space_check_interval

    script

    script_timeout

    events

    journal_max_age

    primary_state_sql

    replica_state_sql

    Monitor Crash Safety

    Script example

    Role
    custom monitor username
    duration
    duration
    here
    duration
    here
    duration
    duration
    here
    server parameter
    duration
    Script example
    duration
    enum
    duration
    spinner
    servers=MyServer1,MyServer2
    monitor_interval=2s
    backend_timeout=3s
    backend_connect_timeout=3s
    backend_read_timeout=3s
    backend_connect_attempts=1
    [server1]
    type=server
    ...
    
    [server2]
    type=server
    ...
    
    [server3]
    type=server
    ...
    
    [monitor]
    type=monitor
    servers=server1,server2,server3
    disk_space_threshold=/data:80
    ...
    [server1]
    type=server
    disk_space_threshold=/data:80
    ...
    
    [server2]
    type=server
    disk_space_threshold=/Data:80
    ...
    
    [server3]
    type=server
    disk_space_threshold=/DBData:80
    ...
    
    [monitor]
    type=monitor
    servers=server1,server2,server3
    ...
    [server1]
    type=server
    disk_space_threshold=/DbData:80
    ...
    
    [server2]
    type=server
    ...
    
    [server3]
    type=server
    ...
    
    [monitor]
    type=monitor
    servers=server1,server2,server3
    disk_space_threshold=/data:80
    ...
    script=/home/user/myscript.sh initiator=$INITIATOR event=$EVENT live_nodes=$NODELIST
    /home/user/myscript.sh initiator=[192.168.0.10]:3306 event=master_down live_nodes=[192.168.0.201]:3306,[192.168.0.121]:3306
    events=master_down,slave_down
    primary_state_sql="set global binlog_commit_wait_count=10;
        set global binlog_commit_wait_usec=1000;"
    replica_state_sql="set global binlog_commit_wait_count=0;
        set global binlog_commit_wait_usec=0;"
    [MyMonitor]
    type=monitor
    module=mariadbmon
    servers=C1N1,C1N2,C1N3
    user=maxscale
    password=password
    monitor_interval=10s
    script=/path/to/maxscale_monitor_alert_script.sh --initiator=$INITIATOR --parent=$PARENT --children=$CHILDREN --event=$EVENT --node_list=$NODELIST --list=$LIST --master_list=$MASTERLIST --slave_list=$SLAVELIST --synced_list=$SYNCEDLIST
    #!/usr/bin/env bash
    
    initiator=""
    parent=""
    children=""
    event=""
    node_list=""
    list=""
    master_list=""
    slave_list=""
    synced_list=""
    
    process_arguments()
    {
    while [ "$1" != "" ]; do
    if [[ "$1" =~ ^--initiator=.* ]]; then
    initiator=${1#'--initiator='}
    elif [[ "$1" =~ ^--parent.* ]]; then
    parent=${1#'--parent='}
    elif [[ "$1" =~ ^--children.* ]]; then
    children=${1#'--children='}
    elif [[ "$1" =~ ^--event.* ]]; then
    event=${1#'--event='}
    elif [[ "$1" =~ ^--node_list.* ]]; then
    node_list=${1#'--node_list='}
    elif [[ "$1" =~ ^--list.* ]]; then
    list=${1#'--list='}
    elif [[ "$1" =~ ^--master_list.* ]]; then
    master_list=${1#'--master_list='}
    elif [[ "$1" =~ ^--slave_list.* ]]; then
    slave_list=${1#'--slave_list='}
    elif [[ "$1" =~ ^--synced_list.* ]]; then
    synced_list=${1#'--synced_list='}
    fi
    shift
    done
    }
    
    process_arguments $@
    read -r -d '' MESSAGE << EOM
    A server has changed state. The following information was provided:
    
    Initiator: $initiator
    Parent: $parent
    Children: $children
    Event: $event
    Node list: $node_list
    List: $list
    Primary list: $master_list
    Replica list: $slave_list
    Synced list: $synced_list
    EOM
    
    # print message to file
    echo "$MESSAGE" > /path/to/script_output.txt
    # email the message
    echo "$MESSAGE" | mail -s "MaxScale received $event event for initiator $initiator." mariadb_admin@domain.com
    Configure APT package repository

    Pass the version you want to install using the --mariadb-maxscale-version flag to the script. The following directions reference 25.01.

    To configure APT package repositories:

    3

    Upgrade MariaDB MaxScale and package dependencies

    sudo apt install --only-upgrade maxscale
    4

    Configure MaxScale

    The upgrade process only loads MaxScale onto the system. MaxScale requires configuration before MaxScale is ready for use.

    Configure ZYpp package repository

    Pass the version you want to install using the --mariadb-maxscale-version flag to the script. The following directions reference 25.01.

    To configure ZYpp package repositories:

    3

    Upgrade MariaDB MaxScale and package dependencies

    sudo zypper update maxscale
    4

    Configure MaxScale

    The upgrade process only loads MaxScale onto the system. MaxScale requires configuration before MaxScale is ready for use.

    --protocol

    protocol

    --tls-ca-cert

    ssl_ca

    --tls-cert

    ssl_cert

    --tls-cert-verify-depth

    ssl_cert_verify_depth

    --tls-crl

    ssl_crl

    --tls-key

    ssl_key

    --tls-verify-peer-certificate

    ssl_verify_peer_certificate

    --tls-verify-peer-host

    ssl_verify_peer_host

    --tls-version

    ssl_version

    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

      • detect_standalone_master

      • detect_stale_master (replaced by master_conditions)

      • detect_stale_slave (replaced by slave_conditions)

    Default Changed for Logging Behavior

    • Prior to MaxScale 22.08.1, by default MaxScale logs to syslog in addition to the MaxScale log.

    • Starting with MaxScale 22.08.1, by default MaxScale only logs to the MaxScale log and no longer logs to syslog.

    • To retain the behavior of prior releases, in your MaxScale configuration, under the [maxscale] section, specify syslog=true:

    REST API Endpoint Removed

    • The /v1/maxscale/tasks/ endpoint has been removed from the REST API.

    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).

    Ensure that the user account has the following privileges:

    MariaDB Monitor

    MaxScale 2.5 includes configuration changes for MariaDB Monitor (mariadbmon):

    • 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:

      [repl-monitor]
      type          = monitor
      module        = mariadbmon
      servers       = server1,server2,server3
      user          = maxscale
      password      = max_passwd
      auto_failover = ON
      auto_rejoin   = ON
      master_conditions = connected_slave,running_slave
    • The detect_stale_slave parameter has been deprecated. It can still be used, but it will be removed in a later version of MaxScale. Users should use the slave_conditions parameter instead.

      For example:

    ColumnStore Monitor

    MaxScale 2.5 includes configuration changes for ColumnStore Monitor (csmon):

    • The version parameter was previously optional, but it is now required.

      For example:

      [col-monitor]
      type          = monitor
      module        = csmon
      servers       = server1,server2,server3
      user          = maxscale
      password      = max_passwd
      version       = 1.2

    Binlog Router

    MaxScale 2.5 includes a completely re-implemented Binlog Router (binlogrouter):

    • Thoroughly test your configuration with the new implementation to ensure that the new version meets your needs.

    sudo yum install curl
    curl -LsSO https://dlm.mariadb.com/enterprise-release-helpers/mariadb_es_repo_setup
    chmod +x mariadb_es_repo_setup
    sudo ./mariadb_es_repo_setup --token="CUSTOMER_DOWNLOAD_TOKEN" --apply \
       --mariadb-maxscale-version="25.01"
    sudo dnf update maxscale
    maxctrl create monitor mdb_monitor mariadbmon \
       --monitor-user mxs \
       --monitor-password 'maxscale_passwd' \
       replication_user='repl_user' \
       replication_password='repl_pass' \
       --servers node1 node2 node3
    maxctrl create monitor mdb_monitor mariadbmon \
       user='mxs' \
       password='maxscale_passwd' \
       replication_user='repl_user' \
       replication_password='repl_pass' \
       --servers node1 node2 node3

    --authenticator

    authenticator

    --authenticator-options

    authenticator_options

    --interface

    interface

    --monitor-password

    password

    --monitor-user

    user

    Enable during startup

    sudo systemctl enable maxscale

    Disable during startup

    sudo systemctl disable maxscale

    Status

    sudo systemctl status maxscale

    persistdir
    https://customers.mariadb.com/downloads/token/
    https://customers.mariadb.com/downloads/token/
    Galera Cluster
    sudo apt install curl
    curl -LsSO https://dlm.mariadb.com/enterprise-release-helpers/mariadb_es_repo_setup
    chmod +x mariadb_es_repo_setup
    sudo ./mariadb_es_repo_setup --token="CUSTOMER_DOWNLOAD_TOKEN" --apply \
       --mariadb-maxscale-version="25.01"
    sudo apt update
    sudo zypper install curl
    curl -LsSO https://dlm.mariadb.com/enterprise-release-helpers/mariadb_es_repo_setup
    echo "4d483b4df193831a0101d3dfa7fb3e17411dda7fc06c31be4f9e089c325403c0  mariadb_es_repo_setup" \
        | sha256sum -c -
    chmod +x mariadb_es_repo_setup
    sudo ./mariadb_es_repo_setup --token="CUSTOMER_DOWNLOAD_TOKEN" --apply \
       --mariadb-maxscale-version="25.01"
    GRANT SHOW DATABASES ON *.*
         TO 'maxscale'@'192.0.2.1';
    GRANT SELECT ON mysql.columns_priv
         TO 'maxscale'@'192.0.2.1';
    GRANT SELECT ON mysql.db
         TO 'maxscale'@'192.0.2.1';
    GRANT SELECT ON mysql.procs_priv
            TO 'mxs'@'192.0.2.1';
    GRANT SELECT ON mysql.proxies_priv
         TO 'maxscale'@'192.0.2.1';
    GRANT SELECT ON mysql.roles_mapping
         TO 'maxscale'@'192.0.2.1';
    GRANT SELECT ON mysql.tables_priv
         TO 'maxscale'@'192.0.2.1';
    GRANT SELECT ON mysql.user
         TO 'maxscale'@'192.0.2.1';

    Failover With Multiple MaxScales

    Compare the ways of coordinating failover between multiple MariaDB MaxScale instances. Walk through how an active/passive pair can diverge a cluster and lose transactions, and how cooperative locking

    When two or more MaxScale instances monitor the same replication cluster, they must agree on which server is the primary. If they disagree, each instance routes writes to a different server. Replication then either breaks or, worse, silently accepts both write streams, and the cluster contents diverge. Divergence is not something MaxScale can undo: recovery means rebuilding a server by hand, and the transactions written to the losing server are lost.

    This page compares the three ways of coordinating failover across MaxScale instances, walks through the failure mode of each, and covers the tuning that cooperative locking needs to be safe.

    The examples use three servers, server1 to server3, with server1 as the initial primary, and two MaxScale instances, MaxScale A and MaxScale B. Both instances run over the same three servers with auto_failover and auto_rejoin

    enabled.
    Mode
    How instances coordinate
    Prevents divergence during a failover
    Prevents divergence during a network partition
    Servers needed

    Active/passive (passive)

    Not at all. You choose which instance is allowed to fail over.

    No

    No

    The short version: majority_of_running is a strict improvement on active/passive and any deployment using auto_failover and auto_rejoin with more than one MaxScale should prefer it. Choose majority_of_all when a network partition is a realistic risk, and pair it with semisynchronous replication. See Choosing a Mode.

    In an active/passive deployment, the global passive setting is false on one instance and true on every other instance. A passive MaxScale still monitors the cluster and still routes queries; it only refrains from performing failover, switchover, and rejoin. The administrator decides which instance is the active one.

    maxscale.cnf
    [maxscale]
    passive=
    maxscale.cnf
    [maxscale]
    passive=

    Nothing in this arrangement makes the two instances agree on which server is the primary. Each one reaches its own conclusion from what it can see, and a failover is exactly the moment when the two views come apart.

    In the initial state both instances see server1 as the primary and route writes there.

    Initial state: both instances agree that server1 is the primary.

    Step 1 — server1 goes down. Both instances lose their connections to it.

    Step 2 — the active MaxScale starts a failover. MaxScale B waits until server1 has been down for failcount monitor intervals, then begins promoting server2. Promotion is not instant: the new primary has to process its relay log first.

    The active instance has started a failover, which takes some time to complete.

    Step 3 — server1 comes back up while the failover is still running. When there are contending primary candidates, MariaDB Monitor keeps the server that was the primary before, so MaxScale A picks server1 again and resumes writing to it. MaxScale A has no way of knowing a failover is in progress, because nothing in an active/passive setup communicates that. MaxScale B does not notice server1 returning either, because it only reconnects to it once the failover finishes.

    The cluster has diverged: writes through MaxScale A land on the old primary, writes through MaxScale B on the new one.

    Step 4 — the failover completes. MaxScale B redirects server3 to replicate from server2 and marks server2 as the primary. Writes through MaxScale B now go to server2 while writes through MaxScale A still go to server1.

    Step 5 — the old primary is demoted. MaxScale B connects to server1 and rejoins it to the cluster. With enforce_read_only_servers=true it also sets read_only on it, which makes server1 an invalid primary candidate from MaxScale A's point of view. Only then does MaxScale A switch to server2.

    Aftermath: both instances agree again, but server1 holds transactions server2 never saw.

    The end result is that server1 contains transactions that are not present in server2. Those transactions were acknowledged to the client and are now effectively lost, and recovery is a manual process.

    Cooperative monitoring makes the MaxScale instances agree on both questions — who performs cluster operations and which server is the primary — by coordinating through the database itself rather than directly with each other.

    Set the same monitor configuration on every instance:

    Coordination uses GET_LOCK(), a user-level advisory lock, to take exclusive ownership of a server:

    • Each monitor tries to acquire a lock named maxscale_mariadbmonitor on every server it can reach. The instance that holds a majority of these locks is the primary monitor; any other instance is a secondary monitor. Only the primary monitor performs failover, switchover, or rejoin.

    • The primary monitor also takes a second lock, maxscale_mariadbmonitor_master, on the server it has selected as the primary. This lock is how it publishes that decision.

    • A secondary monitor only accepts a server as the primary if that server carries the maxscale_mariadbmonitor_master lock, held by the same connection that holds the server's maxscale_mariadbmonitor lock. If no server carries the lock, a secondary monitor marks no server as [Master] and writes through it fail rather than landing on a stale primary. Replicas keep their [Slave] status under the default slave_conditions, so reads continue to work.

    • When a MaxScale loses lock majority it releases every lock it holds, including the master lock, so that another instance can take over.

    With majority_of_running, majority is counted over the servers the instance can currently reach and lock. In a three-server cluster with all three running, that is two locks.

    Take the sequence from the previous section again, with MaxScale B as the primary monitor holding the locks.

    Step 1 — server1 goes down. Its locks disappear with it, including the master lock that marked it as the primary.

    Step 2 — MaxScale B starts the failover after failcount monitor intervals and begins promoting server2.

    Step 3 — server1 comes back up while the failover is still running. This time MaxScale A does not resume writing to it. The restart cleared the master lock, so from MaxScale A's point of view no server is the primary. Connections through MaxScale A can only read.

    No server carries the master lock, so the old primary takes no writes and nothing diverges.

    Step 4 — the failover completes. MaxScale B redirects server3, marks server2 as the primary, and takes the master lock on it. Writes through MaxScale B resume.

    Step 5 — MaxScale A follows. It sees the master lock on server2 and starts routing writes there. server1 is rejoined as a replica.

    Both instances end up on the new primary, and no acknowledged transaction was lost.

    The cost of this protection is a short read-only window: between the moment the primary is lost and the moment the new primary is marked, no instance accepts writes. That is the trade for not diverging.

    A network partition happens when the network splits into subnetworks, whether from an outage or a degraded link. To the MaxScale instances it looks like connection errors and timeouts, which is indistinguishable from servers going down.

    Start from a healthy cluster where both instances route writes to server1, then partition it so that MaxScale A, server1, and server2 end up on one side and MaxScale B and server3 on the other.

    The partition: MaxScale A keeps the old primary, MaxScale B is left with a single replica.

    What happens next depends entirely on the mode.

    If the active instance lands in the minority partition, it promotes what it can see. MaxScale B promotes server3 and writes there, while the passive MaxScale A keeps writing to the old primary server1. The cluster has diverged, exactly as in the failover case.

    When connectivity returns, MaxScale B tries to rejoin server1 and server2 under server3. Either they refuse to join because their GTID positions are incompatible, or — the worse outcome — they join successfully and the divergence becomes silent. Transactions are lost either way.

    Active/passive after the partition heals: two write streams, one of which has to be discarded.

    majority_of_running does not help here, because each instance counts majority only over the servers it can see, and each side of a partition can reach a local majority.

    MaxScale A acquires the locks on server1 and server2, sees two running servers out of two, and considers itself the primary monitor. It still sees the old primary, so it keeps writing to server1. MaxScale B does the same on its side: it locks server3, counts one running server out of one, declares itself the primary monitor too, promotes server3, and starts writing there. Both instances believe they own the cluster.

    Once connectivity returns, one instance ends up with a genuine lock majority and picks either server1 or server3 as the primary. The other side's writes then have to be reconciled, and the rejoin fails or silently diverges exactly as in the active/passive case.

    majority_of_all counts majority over all configured servers rather than only the reachable ones. In a three-server cluster that is always two locks, whether or not the third server is up. Only one side of a partition can reach that count, so only one side can act.

    MaxScale A holds locks on two of three servers and therefore has majority. It keeps server1 as the primary and keeps writing there, safely. MaxScale B holds one lock out of the two it needs, so it releases its locks, marks no server as [Master], and allows only reads on server3.

    Only the majority side is writable, so there is only ever one write stream.

    When connectivity returns, MaxScale B sees the master lock on server1 and starts accepting writes again. Nothing diverged, because the writes that would have diverged were refused.

    Now suppose the partition leaves server1 alone with MaxScale A while MaxScale B keeps server2 and server3.

    MaxScale A briefly continues writing to server1 — it takes a monitor tick or two to establish that it can no longer reach a majority. Once it does, it releases its locks and stops marking any server as [Master], so writes through MaxScale A start failing.

    On the other side, MaxScale B holds two of three locks, so it is the primary monitor. After failcount monitor intervals it promotes server2 and begins accepting writes there.

    The minority side goes read-only; the majority side promotes a new primary.

    When connectivity returns, MaxScale A sees the master lock on server2 and starts writing there.

    That leaves one question. If writes were briefly allowed on server1, and server2 was promoted without those writes ever reaching it, how is consistency preserved?

    • Do not use active/passive with auto_failover and more than one MaxScale. Any of the alternatives is safer, and switching costs nothing but a configuration change.

    • Use majority_of_running as the default choice. It avoids divergence whenever the trouble is servers failing rather than the network splitting, and it works with as few as two servers, since majority is counted over what is running.

    • Use majority_of_all when a network partition is a realistic risk, such as MaxScale instances and servers spread across datacenters. It needs at least three servers to survive one server going down, and it needs semisynchronous replication to make its guarantee real. The third server does not have to be a full production node — a small MariaDB instance co-located on a MaxScale server can supply the third vote, as described in . majority_of_all also stops the cluster when too many servers are down at once: with three configured servers, two locks are always required, so the cluster goes read-only as soon as fewer than two servers are reachable, even though the surviving server could still serve traffic.

    To check which instance is the primary monitor, run maxctrl show monitors and read the primary field. Per-server lock state is in the server-specific lock_held field.

    Cooperative locking works because the locks vanish when their holder does. That is immediate for a clean shutdown, where the monitor closes its connections and MariaDB Server releases the locks. It is not immediate when a MaxScale disappears into a network outage: its connections merely look idle, and the locks stay held until MariaDB Server closes them.

    To bound that, the monitor sets the session wait_timeout on every connection where it holds a lock:

    The value is rounded up to whole seconds, clamped to the range 5 to 28800 seconds, and logged when MaxScale starts.

    A stale lock is a problem if the surviving MaxScale reaches the point of starting a failover while a vanished instance's locks are still held. To rule that out, the failover delay has to outlast wait_timeout. Since the monitor waits failcount * monitor_interval before failing over, that means failcount must be at least 1 + (2 * backend_timeout) / monitor_interval. Adding one monitor interval of margin for the tick that detects the situation gives the value to configure:

    monitor_interval

    backend_timeout

    Resulting wait_timeout

    Smallest safe failcount

    Failover starts after

    2s (default)

    3s (default)

    8s

    5 (the default)

    The default settings are already safe. Check the arithmetic again whenever you raise backend_timeout or lower monitor_interval or failcount.

    This page is licensed: CC BY-SA / Gnu FDL

    MariaDB Monitor
    maxscale.cnf
    [TheMonitor]
    type=monitor
    module=mariadbmon
    servers=server1,server2,server3
    cooperative_monitoring_locks=majority_of_running
    auto_failover=true
    auto_rejoin=true
    wait_timeout = monitor_interval + 2 * backend_timeout
    failcount = (2 * backend_timeout) / monitor_interval + 2

    This page assumes you are familiar with GTID-based replication, , and .

    Comparing the Coordination Modes

    Active/Passive Configuration

    How an Active/Passive Pair Diverges a Cluster

    The window in which this happens is the failover itself, so it is not rare: a primary that restarts, or a primary whose network drops out and returns, is enough to trigger it. Do not run more than one MaxScale over the same cluster with auto_failover unless the instances coordinate through cooperative locking.

    Cooperative Locking With majority_of_running

    How Cooperative Locking Works

    cooperative_monitoring_locks is independent of passive. If passive=true, cluster operations stay disabled even when the monitor holds the locks. Do not mix the two: set passive=false or leave it unset.

    The Same Failover, With Cooperative Locking

    Network Partitions and Split Brain

    Active/Passive During a Partition

    majority_of_running During a Partition

    majority_of_running protects against divergence when servers fail, not when the network splits. Two instances can each claim a local majority and both act as the primary monitor.

    majority_of_all During a Partition

    Old Primary in the Majority Partition

    Old Primary in the Minority Partition

    It is preserved only if the cluster uses semisynchronous replication configured so that the primary never falls back to asynchronous replication — no transaction may commit without an acknowledgment from at least one other server. There is no infinite setting for rpl_semi_sync_master_timeout, so set it to its maximum value. At lower values (the default is 10 seconds), the primary reverts to asynchronous replication when the timeout expires, and transactions can then commit on the minority partition and are lost when the partition heals. Set up semisynchronous replication before relying on majority_of_all — see .

    Choosing a Mode

    Tuning failcount for Stale Locks

    Do not confuse this with the worst-case failover delay estimate, (monitor_interval + backend_timeout) * failcount, on the reference. That formula answers "how long before a failover starts?" for a given failcount. The formula here answers "how small can failcount be and still be safe?" when cooperative locking is enabled.

    backend_connect_timeout is deprecated and is now an alias of backend_timeout. Use backend_timeout in new configurations.

    See Also

    Deployment Topologies for Multiple MaxScales
    Automatic Failover With MariaDB Monitor
    Failure-tolerant replication and failover
    MariaDB Monitor
    [maxscale]
    syslog=true
    [repl-monitor]
    type          = monitor
    module        = mariadbmon
    servers       = server1,server2,server3
    user          = maxscale
    password      = max_passwd
    auto_failover = ON
    auto_rejoin   = ON
    slave_conditions  = running_master,writable_master
    false
    true

    Not applicable

    cooperative_monitoring_locks=majority_of_running

    Locks on a majority of the servers each instance can currently reach

    Yes

    No

    2

    cooperative_monitoring_locks=majority_of_all

    Locks on a majority of all configured servers

    Yes

    Yes, with semisynchronous replication

    3

    10s

    5s

    10s

    25s

    6

    30s

    Deployment Topologies for Multiple MaxScales
    automatic failover
    MariaDB Monitor
    Failure-tolerant replication and failover
    failcount

    Upgrading MaxScale

    Review critical information and procedures for upgrading MariaDB MaxScale versions. Learn about new features deprecated functionality and specific steps for each version transition.

    Before upgrading to MariaDB MaxScale, it is critical to review the changes. This guide outlines new features, altered parameters, and deprecated functionality to ensure a smooth transition.

    For more information about what has changed, please refer to the ChangeLog and release notes of the releases you are upgrading from and upgrading to.

    Before starting the upgrade, any existing configuration files should be backed up.

    Upgrading From Versions Affected by

    If configuration synchronization is used and you are upgrading from versions 23.02.17, 23.08.13, 24.02.9, 25.01.6 or 25.10.2 or any older release that is affected by MXS-6366, you must first upgrade to the latest patch version of that MaxScale series, do a configuration change that is synchronized into the cluster and only then upgrade the major version.

    For example, when upgrading from 23.08.9 to 25.10.3 and you have configured config_sync_cluster, the following steps need to be followed:

    • Upgrade MaxScale from 23.08.9 to 23.08.14

    • Enable and then disable log_info with maxctrl alter maxscale log_info=true followed by maxctrl alter maxscale log_info=false

    • Upgrade MaxScale from 23.08.14 to 25.10.3

    The service users now require a SELECT grant on the mysql.global_priv table in order to be able to support authentication of users with multiple authentication mechanisms. If this grant is not given to the service users, a warning is logged. The following SQL shows how the grant is given to a user:

    In MaxScale 25.10, only one monitor backend timeout remains: . This replaces the old backend_connect_timeout, backend_write_timeout and backend_read_timeout, using the same value for all underlying timeouts. backend_connect_timeout is still supported as an alias for backend_timeout, but any values given to backend_write_timeout and backend_read_timeout are ignored.

    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:

    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:

    The MaxScale packaging has been modified in 24.02 to include all of the necessary files in the package itself. This removes the need for a post-installation script that installs them while also clearly stating what's included in the package.

    However, as a result of this change, downgrades from 24.02 to older major versions may cause the removal of necessary directories, namely the /var/cache/maxscale/ directory.

    To downgrade from MaxScale 24.02 to an older MaxScale major release:

    • Remove MaxScale 24.02 (e.g. dnf remove maxscale or apt -y remove maxscale)

    • Install the older MaxScale version

    MariaDB Monitor switchover requires an additional grant on MariaDB Server 10.5 and later. See for more information.

    • The csmon and auroramon monitors have been removed.

    • The obsolete maxctrl drain command has been removed.

    • The maxctrl cluster

    • The support for legacy encryption keys generated with maxkeys from pre-2.5 versions has been removed. This feature was deprecated in MaxScale 2.5 when the new key storage format was introduced. To migrate to the new key storage format, create a new key file with maxkeys and re-encrypt the passwords withmaxpasswd.

    • The deprecated Database Firewall filter has been removed.

    Using duration type parameters without an explicit suffix has been deprecated in MaxScale 2.4. In MaxScale 6 they are no longer allowed when used with the REST API or MaxCtrl. This means that any create or alter commands in MaxCtrl that use a duration type parameter must explicitly specify the suffix of the unit.

    For example, the following command:

    should be replaced with:

    Duration type parameters can still be defined in the configuration file without an explicit suffix but this behavior is deprecated. The recommended approach is to add explicit suffixes to all duration type parameters when upgrading to MaxScale 6.

    The default value of threads was changed to auto.

    The following deprecated core parameters have been removed:

    • thread_stack_size

    The deprecated aliases for the schemarouter parameters ignore_databases andignore_databases_regex have been removed. They can be replaced withignore_tables and ignore_tables_regex.

    In addition, the preferred_server parameter that was deprecated in 2.5 has also been removed.

    • 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.

    The prune_sescmd_history, max_sescmd_history and disable_sescmd_history have been made into generic service parameters that are shared between all routers that support it.

    The default value of prune_sescmd_history was changed from false totrue. This was done as most MaxScale installations either benefit from it being enabled or are not affected by it.

    The deprecated MaxAdmin interface has been removed in 2.5.0 in favor of the REST API and the MaxCtrl command line client. The cli and maxscaled modules can no longer be used.

    The credentials used by services now require additional grants. For a full list of required grants, refer to the .

    The settings detect_stale_master, detect_standalone_master anddetect_stale_slave are replaced by master_conditions andslave_conditions. The old settings may still be used, but will be removed in a later version.

    The encrypted passwords feature has been updated to be more secure. Users are recommended to generate a new encryption key and re-encrypt their passwords using the maxkeys and maxpasswd utilities. Old passwords still work.

    The default state of servers in 2.4 was Running and in 2.5 it is nowDown. This was done to prevent newly added servers from being accidentally used before they were monitored.

    It is now mandatory to specify in the configuration what version the monitored Columnstore cluster is.

    The binlog router delivered with MaxScale 2.5 is completely new and not 100% backward compatible with the binlog router delivered with earlier MaxScale versions. If you use the binlog router, carefully assess whether the functionality provided by the new one fulfills your requirements, before upgrading MaxScale.

    The tee filter parameter service has been deprecated in favor of the target parameter. All usages of service can be replaced with target.

    Section and object names starting with @@ are now reserved for internal use by MaxScale.

    In case such names have been used, they must manually be changed in all configuration files of MaxScale, before MaxScale 2.4 is started.

    Those files are:

    • The main configuration file; typically /etc/maxscale.cnf.

    • All nested configuration files; typically /etc/maxscale.cnf.d/*.

    • All dynamic configuration files; typically /var/lib/maxscale/maxscale.cnd.d/*

    Whitespace in section names that was deprecated in MaxScale 2.2 will now be rejected, which will cause the startup of MaxScale to fail.

    To prevent that, section names like

    must be changed, for instance, to

    Durations can now be specified using one of the suffixes h, m, s and ms for specifying durations in hours, minutes, seconds and milliseconds, respectively.

    Not providing an explicit unit has been deprecated in MaxScale 2.4, so it is advisable to add suffixes to durations. For instance,

    MaxScale 2.4 will use a SHA2-512 hash for new admin user passwords. To upgrade a user to use the better hashing algorithm, either recreate the user or use themaxctrl alter user command.

    The following settings have been removed and cause a startup error if defined:

    • mysql51_replication

    • multimaster

    • allow_cluster_recovery.

    • If multiple masters are available for a readwritesplit service, the one with the lowest connection count is selected.

    • If a master server is placed into maintenance mode, all open transactions are allowed to gracefully finish before the session is closed. To forcefully close the connections, use the --force option for maxctrl set server.

    • The lazy_connect

    Starting with MaxScale 2.3.0 up to 40% of the memory can be used for caching parsed queries. The most noticeable change is that it improves performance in almost all cases where queries need to be parsed. Most of the time this happens when the readwritesplit router or filters are used.

    The amount of memory that MaxScale uses can be controlled with thequery_classifier_cache_size parameter. For example, to limit the total memory to 1GB, add query_classifier_cache_size=1G to your configuration. To disable it, set the value to 0.

    In addition to the aforementioned query classifier caching, the readwritesplit session command history is enabled by default in 2.3 but is limited to a maximum of 50 commands after which the history is disabled. This is unlikely to show in any metrics but it contributes to the increased memory footprint of MaxScale.

    All unknown parameters are now treated as errors. Check your configuration for errors if MaxScale fails to start after upgrading to 2.3.1.

    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 are now only used with listeners.

    The file format for the administrative users used by MaxScale has been changed. Old style files are automatically upgraded and a backup of the old file is stored in /var/lib/maxscale/passwd.backup.

    Modules may now use a built-in regular expression string parameter type instead of a normal string when accepting patterns. The modules that use the new regex parameter type are qlafilter and tee. When inputting pattern, enclose the string in slashes, e.g. match=/^select/ defines the pattern ^select.

    Binlog server automatically accepts GTID connection from MariaDB 10 slave servers by saving all incoming GTIDs into a SQLite map database.

    In the 2.2.1 beta version MaxCtrl was in its own package whereas in 2.2.2 it is in the main maxscale package. If you have a previous installation of MaxCtrl, please remove it before upgrading to MaxScale 2.2.2.

    MaxScale 2.1.2 added support for IPv6 addresses. The default interface that listeners bind to was changed from the IPv4 address 0.0.0.0 to the IPv6 address ::. To bind to the old IPv4 address, add address=0.0.0.0 to the listener definition.

    Starting with MaxScale 2.1, any changes made with the newly added runtime configuration change will be persisted in a configuration file. These files are located in /var/lib/maxscale/maxscale.cnf.d/.

    The name of the log file was changed from maxscaleN.log to maxscale.log. The default location for the log file is /var/log/maxscale/maxscale.log.

    Rotating the log files will cause MaxScale to reopen the file instead of renaming them. This makes the MaxScale logging facility logrotate compatible.

    The disable_sescmd_history option is now enabled by default. This means that slaves will not be recovered mid-session even if a replacement slave is available. To enable the legacy behavior, add the disable_sescmd_history=true parameter to the service definition.

    The MariaDB session state is reset in MaxScale 2.1 for persistent connections. This means that any modifications to the session state (default database, user variable etc.) will not survive if the connection is put into the connection pool. For most users, this is the expected behavior.

    The location of the MariaDB user data cache was moved from/var/cache/maxscale/<Service> to /var/cache/maxscale/<Service>/<Listener>.

    Galeramon will assign the master status only to the node which has a_wsrep_local_index_ value of 0. This will guarantee consistent writes with multiple MaxScales but it also causes slower changes of the master node.

    To enable the legacy behavior, add root_node_as_master=false to the Galera monitor configuration.

    The default editing mode was changed from vim to emacs mode. To start maxadmin in the legacy mode, use the -i option.

    The default way the communication between MaxAdmin and MariaDB MaxScale is handled has been changed from an internet socket to a Unix domain socket. The former alternative is still available but has been deprecated.

    If no arguments are given to MaxAdmin, it will attempt to connect to MariaDB MaxScale using a Unix domain socket. After the upgrade you will need to provide at least one internet socket related flag - -h, -P,-u or -p - to force MaxAdmin to use the internet socket approach.

    E.g.

    The MySQL Monitor now assigns the stale state to the master server by default. In addition to this, the slave servers receive the stale slave state when they lose the connection to the master. This should not cause changes in behavior but the output of MaxAdmin will show new states when replication is broken.

    The service users now also need SELECT privileges on mysql.tables_priv. This is required for the resolution of table level grants. To grant SELECT privileges for the service user, replace the user and hostname in the following example.

    MaxScale 1.4 upgrades the used password encryption algorithms to more secure ones. This requires that the password files are recreated with the maxkeys tool.

    The SSL configuration parameters are now a part of the listeners. If a service used the old style SSL configuration parameters, the values should be moved to the listener which is associated with that service.

    Here is an example of an old style configuration.

    And here is the new, 1.4 compatible configuration style.

    Please also note that the enabled SSL mode is no longer supported due to the inherent security issues with allowing SSL and non-SSL connections on the same port. In addition to this, SSLv3 is no longer supported due to vulnerabilities found in it.

    The master server details are now provided with a master.ini file located in the binlog directory and it can be changed using a CHANGE MASTER TO command issued via a MySQL connection to MaxScale.

    This file, properly filled, is now mandatory and without it the binlog router cannot connect to the master database.

    Before starting binlog router after MaxScale 1.3 upgrade, please add relevant information to master.ini, example:

    Additionally, the option servers=masterdb in the service definition is no longer required.

    This document describes upgrading MaxScale from version 1.1.1 to 1.2 and the major differences in the new version compared to the old version. The major changes can be found in the Changelog.txt file in the installation directory and the official release notes in the ReleaseNotes.txt file.

    Upgrading MaxScale will copy the MaxScale.cnf file in/usr/local/mariadb-maxscale/etc/ to /etc/ and renamed to maxscale.cnf. Binary log files are not automatically copied and should be manually moved from /usr/local/mariadb-maxscale to /var/lib/maxscale/.

    MaxScale 1.2 follows the and installs to /usr/ and /var/ subfolders. Here are the major changes and file locations.

    • Configuration files are located in /etc/ and use lowercase letters: /etc/maxscale.cnf

    • Binary files are in /usr/bin/

    • Libraries and modules are in /usr/lib64/maxscale/

    MaxScale can run as a non-root user with the 1.2 version. RPM and DEB packages install the maxscale user and maxscale group which are used by the init scripts and systemd configuration files. If you are installing from a binary tarball, you can run the postinst script included in it to manually create these groups.

    This document describes upgrading MaxScale from version 1.0.5 to 1.1.0 and the major differences in the new version compared to the old version. The major changes can be found in the Changelog.txt file in the installation directory and the official release notes in the ReleaseNotes.txt file.

    If you are installing MaxScale from a RPM package, we recommend you back up your configuration and log files and that you remove the old installation of MaxScale completely. If you choose to upgrade MaxScale instead of removing it and re-installing it afterwards, the init scripts in /etc/init.d folder will be missing. This is due to the RPM packaging system but the script can be re-installed by running the postinst script found in the/usr/local/mariadb-maxscale folder.

    The 1.1.0 version of MaxScale installs into /usr/local/mariadb-maxscale instead of /usr/local/skysql/maxscale. This will cause external references to MaxScale's home directory to stop working so remember to update all paths with the new version.

    The MaxAdmin client's default password in MaxScale 1.1.0 is mariadb instead of skysql.

    This page is licensed: CC BY-SA / Gnu FDL

    commands have been removed.
    .
    feature can be used as a workaround to
    . 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/

  • GRANT SELECT ON mysql.global_priv TO 'maxscale_user'@'%';
    [My-Readwritesplit]
    type=service
    router=readwritesplit
    reuse_prepared_statements=true
    [PsReuse]
    type=filter
    module=psreuse
    
    [My-Readwritesplit]
    type=service
    router=readwritesplit
    filters=PsReuse
    [My-Readwritesplit]
    type=service
    router=readwritesplit
    optimistic_trx=true
    [OptimisticTrx]
    type=filter
    module=optimistictrx
    
    [My-Readwritesplit]
    type=service
    router=readwritesplit
    transaction_replay=true
    filters=OptimisticTrx
    maxctrl alter service My-Service connection_keepalive 30000
    maxctrl alter service My-Service connection_keepalive 30000ms
    [CSMonitor]
    type=monitor
    module=csmon
    version=1.5
    ...
    [My Server]
    ...
    
    [My Service]
    ...
    servers=My Server
    [MyServer]
    ...
    
    [MyService]
    ...
    servers=MyServer
    some_param=60s
    some_param=60000ms
    [The-Service]
    type=service
    passwd=some-service-password
    ...
    
    [The-Monitor]
    type=monitor
    passwd=some-monitor-password
    ...
    [The-Service]
    type=service
    password=some-service-password
    ...
    
    [The-Monitor]
    type=monitor
    password=some-monitor-password
    ...
    user@host $ maxadmin -u admin
    GRANT SELECT ON mysql.tables_priv TO 'username'@'maxscalehost';
    [RW-Split-Router]
    type=service
    router=readwritesplit
    servers=server1,server2,server3,server4
    user=jdoe
    passwd=BD26E4139A15280CA882264AA1551C70
    ssl=required
    ssl_cert=/home/user/certs/server-cert.pem
    ssl_key=/home/user/certs/server-key.pem
    ssl_ca_cert=/home/user/certs/ca.pem
    ssl_version=TLSv12
    
    [RW-Split-Listener]
    type=listener
    service=RW-Split-Router
    port=3306
    [RW-Split-Router]
    type=service
    router=readwritesplit
    servers=server1,server2,server3,server4
    user=jdoe
    passwd=BD26E4139A15280CA882264AA1551C70
    
    [RW-Split-Listener]
    type=listener
    service=RW-Split-Router
    port=3306
    ssl=required
    ssl_cert=/home/user/certs/server-cert.pem
    ssl_key=/home/user/certs/server-key.pem
    ssl_ca_cert=/home/user/certs/ca.pem
    ssl_version=TLSv12
    [binlog_configuration]
    master_host=127.0.0.1
    master_port=3308
    master_user=repl
    master_password=somepass
    filestem=repl-bin
    # Re-install init scripts
    cd /usr/local/mariadb-maxscale
    ./postinst

    WEBINAR

    New innovations in MaxScale 25.01 and Enterprise Platform

    Upgrading MariaDB MaxScale from 25.01 to 25.10

    Service User Grants

    Monitor timeouts

    Upgrading MariaDB MaxScale from 24.02 to 25.01

    Readwritesplit

    reuse_prepared_statements

    optimistic_trx

    Upgrading MariaDB MaxScale from 23.08 to 24.02

    Downgrading to older major versions

    Upgrading MariaDB MaxScale from 23.02 to 23.08

    Upgrading MariaDB MaxScale from 22.08 to 23.02

    Removed Features

    Upgrading MariaDB MaxScale from 21.06 to 22.08

    Removed Features

    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

    Changed Parameters

    threads

    Removed Parameters

    Core Parameters

    Schemarouter

    mariadbmon

    Session Command History

    Upgrading MariaDB MaxScale from 2.4 to 2.5

    MaxAdmin

    Authentication

    MariaDB-Monitor

    Password encryption

    Default Server State

    Columnstore Monitor

    New binlog router

    Tee Filter

    Upgrading MariaDB MaxScale from 2.3 to 2.4

    Section Names

    Reserved Names

    Whitespace in Names

    Durations

    Improved Admin User Encryption

    MariaDB-Monitor

    ReadWriteSplit

    Upgrading MariaDB MaxScale from 2.2 to 2.3

    Increased Memory Use

    Unknown Global Parameters

    passwd is deprecated

    authenticator_options for servers is ignored

    Upgrading MariaDB MaxScale from 2.1 to 2.2

    Administrative Users

    Regular Expression Parameters

    Binlog Server

    MaxCtrl Included in Main Package

    Upgrading MariaDB MaxScale from 2.0 to 2.1

    IPv6 Support

    Persisted Configuration Files

    MaxScale Log Files

    ReadWriteSplit

    Persistent Connections

    User Data Cache

    Galeramon Monitoring Algorithm

    MaxAdmin Editing Mode

    Upgrading MariaDB MaxScale from 1.4 to 2.0

    MaxAdmin

    MySQL Monitor

    Upgrading MaxScale from 1.3 to 1.4

    Service user permissions

    Password encryption

    SSL

    Upgrading MaxScale from 1.2 to 1.3

    Binlog Router

    Upgrading MaxScale from 1.1 to 1.2

    Installation

    File location changes

    Running MaxScale without root permissions

    Upgrading MaxScale from 1.0 to 1.1

    Installation

    MaxAdmin changes

    backend_timeout
    PsReuse
    OptimisticTrx
    Cluster Manipulation Grants
    protocol documentation
    FHS-standard
    MXS-6366
    MXS-619
    Watch Now
    spinner

    MaxScale Cache

    Improve query performance by caching SELECT statement results. This filter stores result sets in memory, serving identical subsequent queries directly from MaxScale.

    Overview

    The cache filter is a simple cache that is capable of caching the result of SELECTs, so that subsequent identical SELECTs are served directly by MaxScale, without the queries being routed to any server.

    By default the cache will be used and populated in the following circumstances:

    • There is no explicit transaction active, that is, autocommit is used,

    • there is an explicitly read-only transaction (that is,START TRANSACTION READ ONLY) active, or

    • there is a transaction active and no statement that modifies the database has been performed.

    In practice, the last bullet point basically means that if a transaction has been started with BEGIN, START TRANSACTION or START TRANSACTION READ WRITE, then the cache will be used and populated until the first UPDATE, INSERT or DELETE statement is encountered.

    That is, in default mode the cache effectively causes the system to behave as if the isolation level would be READ COMMITTED, irrespective of what the isolation level of the backends actually is.

    The default behaviour can be altered using the configuration parameter .

    By default it is assumed that all SELECT statements are cacheable, which means that also statements like SELECT LOCALTIME are cached. Please check for how to change the default behaviour.

    All of these limitations may be addressed in forthcoming releases.

    Resultsets of prepared statements are not cached.

    Multi-statements are always sent to the backend and their result is not cached.

    The cache is not aware of grants.

    The implication is that unless the cache has been explicitly configured who the caching should apply to, the presence of the cache may provide a user with access to data he should not have access to.

    Please read the section for more detailed information.

    However, it is possible to configure the cache to cache the data of each user separately, which effectively means that there can be no unintended sharing. Please see for how to change the default behaviour.

    When is enabled, SELECTs targeting tables in information_schema are not cached. The reason is that as the content of the tables changes as the side-effect of something else, the cache would not know when to invalidate the cache-entries.

    The cache is capable of invalidating entries in the cache when a modification (UPDATE, INSERT or DELETE) that may affect those entries is made. However, the invalidation depends upon the used storage also supporting invalidation.

    Storage
    Invalidation

    The cache invalidation works on the table-level, that is, a modification made to a particular table will cause all cache entries that refer to that table to be invalidated, irrespective of whether the modification actually has an impact on the cache entries or not. In practice this means that updates should occur relatively rarely, as otherwise the cache will never have time to become warm, before it is made cold again.

    For instance, suppose the result of the following SELECT has been cached

    An insert like

    will cause the cache entry containing the result of that SELECT to be invalidated even if the INSERT actually does not affect it. Please see for how to enable the invalidation.

    When invalidation has been enabled MaxScale must be able to completely parse a SELECT statement for its results to be stored in the cache. The reason is that in order to be able to invalidate cache entries, MaxScale must know what tables a SELECT statement depends upon. Consequently, if (and only if) invalidation has been enabled and MaxScale fails to parse a statement, the result of that particular statement will not be cached.

    When invalidation has been enabled, MaxScale will also parse all UPDATE, INSERT and DELETE statements, in order to find out what tables are modified. If that parsing fails, MaxScale will by default clear the entire cache. The reason is that unless MaxScale can completely parse the statement it cannot know what tables are modified and hence not what cache entries should be invalidated. Consequently, to prevent stale data from being returned, the entire cache is cleared. The default behaviour can be changed using the configuration parameter .

    Note that what threading approach is used has a big impact on the invalidation. Please see for how the threading approach affects the invalidation.

    Note also that since the invalidation may not, depending on how the cache has been configured, be visible to all sessions of all users, it is still important to configure a reasonable and TTL.

    The invalidation offered by the MaxScale cache can be said to be of best efforts quality. The reason is that in order to ensure that the cache in all circumstances reflects the state in the actual database, would require that the operations involving the cache and the MariaDB server are synchronized, which would cause an unacceptable overhead.

    What best efforts means in this context is best illustrated using an example.

    Suppose a client executes the statement SELECT * FROM tbl and that the result is cached. Next time that or any other client executes the same statement, the result is returned from the cache and the MariaDB server will not be accessed at all.

    If a client now executes the statement INSERT INTO tbl VALUES (...), the cached value for the SELECT statement above and all other statements that are dependent upon tbl will be invalidated. That is, the next time someone executes the statement SELECT * FROM tbl the result will again be fetched from the MariaDB server and stored to the cache.

    However, suppose some client executes the statement SELECT COUNT(*) FROM tbl at the same time someone else executes the INSERT ... statement. A possible chain of events is as follows:

    That is, the SELECT is performed in the database server before theINSERT. However, since the timelines are proceeding independently of each other, the events may be re-ordered as far as the cache is concerned.

    That is, the cached value for SELECT COUNT(*) FROM tbl will reflect the situation before the insert and will thus not be correct.

    The stale result will be returned until the value has reached its time-to-live or its invalidation is caused by some update operation.

    The cache is simple to add to any existing service. However, some experimentation may be required in order to find the configuration settings that provide the maximum benefit.

    Each configured cache filter uses a storage of its own. That is, if there are two services, each configured with a specific cache filter, then, even if queries target the very same servers the cached data will not be shared.

    Two services can use the same cache filter, but then either the services should use the very same servers or a completely different set of servers, where the used table names are different. Otherwise there can be unintended sharing.

    The cache filter has no mandatory parameters but a range of optional ones. Note that it is advisable to specify max_size to prevent the cache from using up all memory there is, in case there is very little overlap among the queries.

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: storage_inmemory

    The name of the module that provides the storage for the cache. That module will be loaded and provided with the value of storage_options as argument. For instance:

    See for what storage modules are available.

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default:

    NOTE Deprecated in 23.02.

    A string that is provided verbatim to the storage module specified in storage, when the module is loaded. Note that the needed arguments and their format depend upon the specific module.

    From 23.02 onwards, the storage module configuration should be provided using nested parameters.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: 0s

    Hard time to live; the maximum amount of time the cached result is used before it is discarded and the result is fetched from the backend (and cached). See also .

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: 0s

    Soft time to live; the amount of time - in seconds - the cached result is used before it is refreshed from the server. When soft_ttl has passed, the result will be refreshed when the first client requests the value.

    However, as long as has not passed, all other clients requesting the same value will use the result from the cache while it is being fetched from the backend. That is, as long as soft_ttl but not hard_ttl has passed, even if several clients request the same value at the same time, there will be just one request to the backend.

    If the value of soft_ttl is larger than hard_ttl it will be adjusted down to the same value.

    • Type: count

    • Mandatory: No

    • Dynamic: No

    • Default: 0

    Specifies the maximum number of rows a resultset can have in order to be stored in the cache. A resultset larger than this, will not be stored.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: 0

    Specifies the maximum size of a resultset, for it to be stored in the cache. A resultset larger than this, will not be stored.

    Note that the value of max_resultset_size should not be larger than the value of max_size.

    • Type: count

    • Mandatory: No

    • Dynamic: No

    • Default: 0

    The maximum number of items the cache may contain. If the limit has been reached and a new item should be stored, then an older item will be evicted.

    Note that if cached_data is thread_specific then this limit will be applied to each cache separately. That is, if a thread specific cache is used, then the total number of cached items is #threads * the value of max_count.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: 0

    The maximum size the cache may occupy. If the limit has been reached and a new item should be stored, then some older item(s) will be evicted to make space.

    Note that if cached_data is thread_specific then this limit will be applied to each cache separately. That is, if a thread specific cache is used, then the total size is #threads * the value of max_size.

    • Type: path

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    Specifies the path of the file where the caching rules are stored. A relative path is interpreted relative to the data directory of MariaDB MaxScale.

    Note that the rules will be reloaded, and applied if different, every time a dynamic configuration change is made. Thus, to cause a reloading of the rules, alter the rules parameter to the same value it has.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: shared

    An enumeration option specifying how data is shared between threads. The allowed values are:

    • shared: The cached data is shared between threads. On the one hand it implies that there will be synchronization between threads, on the other hand that all threads will use data fetched by any thread.

    • thread_specific: The cached data is specific to a thread. On the one hand it implies that no synchronization is needed between threads, on the other hand that the very same data may be fetched and stored multiple times.

    Default is thread_specific. See max_count and max_size what implication changing this setting to shared has.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: assume_cacheable

    An enumeration option specifying what approach the cache should take with respect to SELECT statements. The allowed values are:

    • assume_cacheable: The cache can assume that all SELECT statements, without exceptions, are cacheable.

    • verify_cacheable: The cache can not assume that all SELECT statements are cacheable, but must verify that.

    Default is assume_cacheable. In this case, all SELECT statements are assumed to be cacheable and will be parsed only if some specific rule requires that.

    If verify_cacheable is specified, then all SELECT statements will be parsed and only those that are safe for caching - e.g. do not call any non-cacheable functions or access any non-cacheable variables - will be subject to caching.

    If verify_cacheable has been specified, the cache will not be used in the following circumstances:

    • The SELECT uses any of the following functions: BENCHMARK,CONNECTION_ID, CONVERT_TZ, CURDATE, CURRENT_DATE, CURRENT_TIMESTAMP,CURTIME, DATABASE, ENCRYPT

    Note that parsing all SELECT statements carries a performance cost. Please read for more details.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: never

    An enumeration option specifying how the cache should behave when there are active transactions:

    • never: When there is an active transaction, no data will be returned from the cache, but all requests will always be sent to the backend. The cache will be populated inside explicitly read-only transactions. Inside transactions that are not explicitly read-only, the cache will be populated until the first non-SELECT statement.

    • read_only_transactions: The cache will be used and populated inside explicitly read-only transactions. Inside transactions that are not explicitly read-only, the cache will be populated, but not used until the first non-SELECT statement.

    Default is all_transactions.

    The values read_only_transactions and all_transactions have roughly the same effect as changing the isolation level of the backend to read_committed.

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0

    An integer value, using which the level of debug logging made by the cache can be controlled. The value is actually a bitfield with different bits denoting different logging.

    • 0 (0b00000) No logging is made.

    • 1 (0b00001) A matching rule is logged.

    Default is 0. To log everything, give debug a value of 31.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: true

    Specifies whether the cache is initially enabled or disabled.

    The value affects the initial state of the MaxScale user variables using which the behaviour of the cache can be modified at runtime. Please see for details.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: never

    An enumeration option specifying how the cache should invalidate cache entries.

    The effect of current depends upon the value of cached_data. If the value is shared, that is, all threads share the same cache, then the effect of an invalidation is immediately visible to all sessions, as there is just one cache. However, if the value is thread_specific, then an invalidation will affect only the cache that the session happens to be using.

    If it is important and sufficient that an application immediately sees a change that it itself has caused, then a combination of invalidate=current and cached_data=thread_specific can be used.

    If it is important that an application immediately sees all changes, irrespective of who has caused them, then a combination of invalidate=current and cached_data=shared must be used.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: true

    This boolean option specifies how the cache should behave in case of parsing errors when invalidation has been enabled.

    • true: If the cache fails to parse an UPDATE/INSERT/DELETE statement then all cached data will be cleared.

    • false: A failure to parse an UPDATE/INSERT/DELETE statement is ignored and no invalidation will take place due that statement.

    The default value is true.

    Changing the value to false may mean that stale data is returned from the cache, if an UPDATE/INSERT/DELETE cannot be parsed and the statement affects entries in the cache.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: mixed

    An enumeration option specifying how the cache should cache data for different users.

    Note that if isolated has been specified, then each user will conceptually have a cache of his own, which is populated independently from each other. That is, if two users make the same query, then the data will be fetched twice and also stored twice. So, a isolated cache will in general use more memory and cause more traffic to the backend compared to a mixed cache.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: 5s

    The timeout used when performing operations to distributed storages such as redis or memcached.

    The cache filter can be configured at runtime by executing SQL commands. If there is more than one cache filter in a service, only the first cache filter will be able to process the variables. The remaining filters will not see them and thus configuring them at runtime is not possible.

    Using the variable @maxscale.cache.populate it is possible to specify at runtime whether the cache should be populated or not. Its initial value is the value of the configuration parameter enabled. That is, by default the value is true.

    The purpose of this variable is make it possible for an application to decide statement by statement whether the cache should be populated.

    In the example above, the first SELECT will always be sent to the server and the result will be cached, provided the actual cache rules specifies that it should be. The second SELECT may be served from the cache, depending on the value of @maxscale.cache.use (and the cache rules).

    The value of @maxscale.cache.populate can be queried

    but only after it has been explicitly set once.

    Using the variable @maxscale.cache.use it is possible to specify at runtime whether the cache should be used or not. Its initial value is the value of the configuration parameter enabled. That is, by default the value is true.

    The purpose of this variable is make it possible for an application to decide statement by statement whether the cache should be used.

    The first SELECT will be served from the cache, providing the rules specify that the statement should be cached, the cache indeed contains the result and the date is not stale (as specified by the TTL).

    If the data is stale, the SELECT will be sent to the server and the cache entry will be updated, irrespective of the value of@maxscale.cache.populate.

    If @maxscale.cache.use is true but the result is not found in the cache, and the result is subsequently fetched from the server, the result will not be added to the cache, unless@maxscale.cache.populate is also true.

    The value of @maxscale.cache.use can be queried

    but only after it has explicitly been set once.

    Using the variable @maxscale.cache.soft_ttl it is possible at runtime to specify in seconds what soft ttl should be applied. Its initial value is the value of the configuration parameter soft_ttl. That is, by default the value is 0.

    The purpose of this variable is make it possible for an application to decide statement by statement what soft ttl should be applied.

    When data is SELECTed from the unimportant table unimportant, the data will be returned from the cache provided it is no older than 10 minutes, but when data is SELECTed from the important table important, the data will be returned from the cache provided it is no older than 1 minute.

    Note that @maxscale.cache.hard_ttl overrules @maxscale.cache.soft_ttl in the sense that if the former is less that the latter, then soft ttl will, when used, be adjusted down to the value of hard ttl.

    The value of @maxscale.cache.soft_ttl can be queried

    but only after it has explicitly been set once.

    Using the variable @maxscale.cache.hard_ttl it is possible at runtime to specify in seconds what hard ttl should be applied. Its initial value is the value of the configuration parameter hard_ttl. That is, by default the value is 0.

    The purpose of this variable is make it possible for an application to decide statement by statement what hard ttl should be applied.

    Note that as @maxscale.cache.hard_ttl overrules @maxscale.cache.soft_ttl, is important to ensure that the former is at least as large as the latter and for best overall performance that it is larger.

    The value of @maxscale.cache.hard_ttl can be queried

    but only after it has explicitly been set once.

    With @maxscale.cache.populate and @maxscale.cache.use is it possible to make the caching completely client driven.

    Provide no rules file, which means that all SELECT statements are subject to caching and that all users receive data from the cache. Set the startup mode of the cache to disabled.

    Now, in order to mark statements that should be cached, set@maxscale.cache.populate to true, and perform those SELECTs.

    Note that those SELECTs must return something in order for the statement to be marked for caching.

    After this, the value of @maxscale.cache.use will decide whether or not the cache is considered.

    With @maxscale.cache.use being true, the cache is considered and the result returned from there, if not stale. If it is stale, the result is fetched from the server and the cached entry is updated.

    By setting a very long TTL it is possible to prevent the cache from ever considering an entry to be stale and instead manually cause the cache to be updated when needed.

    What caching approach is used and how different users are treated has a significant impact on the behaviour of the cache. In the following the implication of different combinations is explained.

    cached_data/users
    mixed
    isolated

    Invalidation takes place only in the current cache, so how visible the invalidation is, depends upon the configuration value ofcached_data.

    The invalidation is visible only to the sessions that are handled by the same worker thread where the invalidation occurred. Sessions of the same or other users that are handled by different worker threads will not see the new value before the TTL causes the value to be refreshed.

    The invalidation is immediately visible to all sessions of all users.

    The caching rules are expressed as a JSON object or as an array of JSON objects.

    There are two decisions to be made regarding the caching; in what circumstances should data be stored to the cache and in what circumstances should the data in the cache be used.

    Expressed in JSON this looks as follows

    or, in case an array is used, as

    The store field specifies in what circumstances data should be stored to the cache and the use field specifies in what circumstances the data in the cache should be used. In both cases, the value is a JSON array containing objects.

    If an array of rule objects is specified, then, when looking for a rule that matches, the store field of each object are evaluated in sequential order until a match is found. Then, the use field of that object is used when deciding whether data in the cache should be used.

    By default, if no rules file have been provided or if the store field is missing from the object, the results of all queries will be stored to the cache, subject to max_resultset_rows and max_resultset_size cache filter parameters.

    By providing a store field in the JSON object, the decision whether to store the result of a particular query to the cache can be controlled in a more detailed manner. The decision to cache the results of a query can depend upon

    • the database,

    • the table,

    • the column, or

    • the query itself.

    Each entry in the store array is an object containing three fields,

    where,

    • the attribute can be database, table, column or query,

    • the op can be =, !=, like

    If op is = or != then value is used as a string; if it is like or unlike, then value is interpreted as a pcre2 regular expression. Note though that if attribute is database, table or column, then the string is interpreted as a name, where a dot . denotes qualification or scoping.

    The objects in the store array are processed in order. If the result of a comparison is true, no further processing will be made and the result of the query in question will be stored to the cache.

    If the result of the comparison is false, then the next object is processed. The process continues until the array is exhausted. If there is no match, then the result of the query is not stored to the cache.

    Note that as the query itself is used as the key, although the following queries

    and

    target the same table and produce the same results, they will be cached separately. The same holds for queries like

    and

    as well. Although they conceptually are identical, there will be two cache entries.

    Note that if a column has been specified in a rule, then a statement will match irrespective of where that particular column appears. For instance, if a rule specifies that the result of statements referring to the column a should be cached, then the following statement will match

    and so will

    When using = or != in the rule object in conjunction with database,table and column, the provided string is interpreted as a name, that is, dot (.) denotes qualification or scope.

    In practice that means that if attribute is database then value may not contain a dot, if attribute is table then value may contain one dot, used for separating the database and table names respectively, and if attribute is column then value may contain one or two dots, used for separating table and column names, or database, table and column names.

    Note that if a qualified name is used as a value, then all parts of the name must be available for a match. Currently Maria DB MaxScale may not always be capable of deducing in what table a particular column is. If that is the case, then a value like tbl.field may not necessarily be a match even if the field is field and the table actually is tbl.

    If the rules concerns the database, then only if the statement refers to no specific database, will the default database be considered.

    The string used for matching the regular expression contains as much information as there is available. For instance, in a situation like

    the string matched against the regular expression will be somedb.tbl.fld.

    Cache all queries targeting a particular database.

    Cache all queries not targeting a particular table

    That will exclude queries targeting table tbl1 irrespective of which database it is in. To exclude a table in a particular database, specify the table name using a qualified name.

    Cache all queries containing a WHERE clause

    Note that this will actually cause all queries that contain WHERE anywhere, to be cached.

    By default, if no rules file have been provided or if the use field is missing from the object, all users may be returned data from the cache.

    By providing a use field in the JSON object, the decision whether to use data from the cache can be controlled in a more detailed manner. The decision to use data from the cache can depend upon

    • the user.

    Each entry in the use array is an object containing three fields,

    where,

    • the attribute can be user,

    • the op can be =, !=, like or unlike, and

    If op is = or != then value is interpreted as a MariaDB account string, that is, % means indicates wildcard, but if op is like orunlike it is simply assumed value is a pcre2 regular expression.

    For instance, the following are equivalent:

    Note that if op is = or != then the usual assumptions apply, that is, a value of bob is equivalent with 'bob'@'%'. If like or unlike is used, then no assumptions apply, but the string is used verbatim as a regular expression.

    The objects in the use array are processed in order. If the result of a comparison is true, no further processing will be made and the data in the cache will be used, subject to the value of ttl.

    If the result of the comparison is false, then the next object is processed. The process continues until the array is exhausted. If there is no match, then data in the cache will not be used.

    Note that use is relevant only if the query is subject to caching, that is, if all queries are cached or if a query matches a particular rule in the store array.

    Use data from the cache for all users except admin (actually 'admin'@'%'), regardless of what host the admin user comes from.

    As the cache is not aware of grants, unless the cache has been explicitly configured who the caching should apply to, the presence of the cache may provide a user with access to data he should not have access to. Note that the following applies only if users=mixed has been configured. If users=isolated has been configured, then there can never be any unintended sharing between users.

    Suppose there is a table access that the user alice has access to, but the user bob does not. If bob tries to access the table, he will get an error as reply:

    If we now setup caching for the table, using the simplest possible rules file, bob will get access to data from the table, provided he executes a select identical with one alice has executed.

    For instance, suppose the rules look as follows:

    If alice now queries the table, she will get the result, which also will be cached:

    If bob now executes the very same query, and the result is still in the cache, it will be returned to him.

    That can be prevented, by explicitly declaring in the rules that the caching should be applied to alice only.

    With these rules in place, bob is again denied access, since queries targeting the table access will in his case not be served from the cache.

    There are two types of storages that can be used; local and shared.

    The only local storage implementation is storage_inmemory that simply stores the cache values in memory. The storage is not persistent and is destroyed when MaxScale terminates. Since the storage exists in the MaxScale process, it is very fast and provides almost always a performance benefit.

    Currently there are three shared storages; storage_memcached, storage_redis and storage_gridgain that are implemented using , and respectively.

    The shared storages are accessed across the network and consequently it is not self-evident that their use will provide any performance benefit. Namely, irrespective of whether the data is fetched from the cache or from the server there will be a network hop and often that network hop is, as far as the performance goes, what costs the most.

    The presence of a shared cache may provide a performance benefit

    • if the network between MaxScale and the storage server (memcached, Redis or GridGain) is faster than the network between MaxScale and the database server,

    • if the used SELECT statements are heavy (that is, take a significant amount of time) to process for the database server, or

    • if the presence of the cache reduces the overall load of an otherwise overloaded database server.

    As a general rule a shared storage should not be used without first assessing its value using a realistic workload.

    This simple storage module uses the standard memory allocator for storing the cached data.

    This storage module takes no arguments.

    Available since MaxScale 25.10.3.

    This storage module uses for storing the cache data. This storage can only be used with specified as thread_specific, which is the default, so it need not explicitly be specified.

    Multiple MaxScale instances can share the same gridgain server and items cached by one MaxScale instance will be used by the other. Note that all MaxScale instances should have exactly the same configuration, as otherwise there can be unintended sharing.

    Storage specific settings are configured using nested parameters.

    storage_gridgain has the following parameters:

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: 127.0.0.1:10800

    An endpoint is specified as <host>[:<port>[..<port_range>]] and several endpoints can be specified, separated by a comma.

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    The user to be used when authenticating with GridGain.

    • Type: password

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    The password to be used when authenticating with GridGain.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: false

    If true, SSL will be used in the communication with GridGain in which case the ssl_ settings should be specified as well.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    The SSL client certificate that MaxScale should use with the GridGain server. The certificate must match the key defined in ssl_key.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    The SSL client private key MaxScale should use with the GridGain server.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    The Certificate Authority (CA) certificate for the CA that signed the certificate specified with ssl_cert.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: 1Mi

    The default maximum size of a value to be stored in GridGain.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: true

    allows a thin GridGain client to send query requests directly to the node that owns the queried data and should usually be enabled.

    • Invalidation is not supported.

    • Configuration values given to max_size and max_count are ignored.

    The data in the GridGain server is not encrypted.

    This storage module uses for storing the cached data.

    Multiple MaxScale instances can share the same memcached server and items cached by one MaxScale instance will be used by the other. Note that all MaxScale instances should have exactly the same configuration, as otherwise there can be unintended sharing.

    storage_memcached has the following parameters:

    • Type: The Memcached server address specified as host[:port]

    • Mandatory: Yes

    • Dynamic: No

    If no port is provided, then the default port 11211 will be used.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: 1Mi

    By default, the maximum size of a value stored to memcached is 1MiB, but that can be configured to something else, in which case this parameter should be set accordingly.

    The value of max_value_size will be used for capping max_resultset_size, that is, if memcached has been configured to allow larger values than 1MiB but max_value_size has not been set accordingly, only resultsets up to 1MiB in size will be cached.

    From MaxScale 23.02 onwards, the storage configuration should be provided as nested parameters.

    Although deprecated in 23.02, the configuration can also be provided using storage_options:

    • Invalidation is not supported.

    • Configuration values given to max_size and max_count are ignored.

    Neither the data in the memcached server nor the traffic between MaxScale and the memcached server is encrypted. Consequently, anybody with access to the memcached server or to the network have access to the cached data.

    This storage module uses for storing the cached data.

    Note that Redis should be configured with no idle timeout or with a timeout that is very large. Otherwise MaxScale may have to repeatedly connect to Redis, which will hurt both the functionality and the performance.

    Multiple MaxScale instances can share the same redis server and items cached by one MaxScale instance will be used by the other. Note that all MaxScale instances should have exactly the same configuration, as otherwise there can be unintended sharing.

    If storage_redis cannot connect to the Redis server, caching will silently be disabled and a connection attempt will be made after a interval.

    If a timeout error occurs during an operation, reconnecting will be attempted after a delay, which will be an increasing multiple of timeout. For example, if timeout is the default 5 seconds, then reconnection attempts will first be made after 10 seconds, then after 15 seconds, then 20 and so on. However, once 60 seconds have been reached, the delay will no longer be increased but the delay will stay at one minute. Note that each time a reconnection attempt is made, unless the reason for the timeout has disappeared, the client will be stalled for timeout seconds.

    storage_redis has the following parameters:

    • Type: The Redis server address specified as host[:port]

    • Mandatory: Yes

    • Dynamic: No

    If no port is provided, then the default port 6379 will be used.

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    Please see for more information.

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    Please see for more information.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: false

    Please see for more information.

    • Type: Path to existing readable file.

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    The SSL client certificate that MaxScale should use with the Redis server. The certificate must match the key defined in ssl_key.

    Please see for more information.

    • Type: Path to existing readable file.

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    The SSL client private key MaxScale should use with the Redis server.

    Please see for more information.

    • Type: Path to existing readable file.

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    The Certificate Authority (CA) certificate for the CA that signed the certificate specified with ssl_cert.

    Please see for more information.

    If password is provided, MaxScale will authenticate against Redis when a connection has been created. The authentication is performed using the command, with only the password as argument, if no username was provided in the configuration, or username and password as arguments, if both were.

    Note that if the authentication is in the Redis configuration file specified using requirepass, then only the password should be provided. If the Redis server version is 6 or higher and the Redis ACL system is used, then both username and password must be provided.

    If ssl_key, ssl_cert and ssl_ca are provided, then SSL/TLS will be used in the communication with the Redis server, if ssl is set to true.

    Note that the SSL/TLS support is only available in Redis from version 6 onwards and that the support is not by default built into Redis, but has to be specifically enabled at compile time as explained .

    From MaxScale 23.02 onwards, the storage configuration should be provided as nested parameters.

    Although deprecated in 23.02, the configuration can also be provided using storage_options:

    • There is no distinction between soft and hard ttl, but only hard ttl is used.

    • Configuration values given to max_size and max_count are ignored.

    storage_redis supports invalidation, but the caveats documented are of greater significance since also the communication between the cache and the cache storage is asynchronous and takes place over the network.

    NOTE If invalidation is turned on after caching has been used (in non-invalidation mode), redis must be flushed as otherwise there will be entries in the cache that will not be affected by the invalidation.

    The data in the redis server is not encrypted. Consequently, anybody with access to the redis server has access to the cached data.

    Unless has been enabled, anybody with access to the network has access to the cached data.

    In the following we define a cache MyCache that uses the cache storage modulestorage_inmemory and whose soft ttl is 30 seconds and whose hard ttl is45 seconds. The cached data is shared between all threads and the maximum size of the cached data is 50 mebibytes. The rules for the cache are in the filecache_rules.json.

    The rules specify that the data of the table sbtest should be cached.

    When the cache filter was introduced, the most significant factor affecting the performance of the cache was whether the statements needed to be parsed. Initially, all statements were parsed in order to exclude SELECT statements that use non-cacheable functions, access non-cacheable variables or refer to system or user variables. Later, the default value of the selects parameter was changed to assume_cacheable, to maximize the default performance.

    With the default configuration, the cache itself will not cause the statements to be parsed. However, even with assume_cacheable configured, a rule referring specifically to a database, table or column will still cause the statement to be parsed.

    For instance, a simple rule like

    cannot be fulfilled without parsing the statement.

    If the rule is instead expressed using a regular expression

    then the statement will not be parsed.

    However, when the was introduced, the parsing cost was significantly reduced and currently the cost for parsing and regular expression matching is roughly the same.

    In the following is a table with numbers giving a rough picture of the relative cost of different approaches.

    In the table, regexp match means that the cacheable statements were picked out using a rule like

    while exact match means that the cacheable statements were picked out using a rule like

    The exact match rule requires all statements to be parsed.

    As the purpose of the test is to illustrate the overhead of different approaches, the rules were formulated so that all SELECT statements would match.

    Note that these figures were obtained by running sysbench, MaxScale and the server in the same computer, so they are only indicative.

    selects
    Rule
    qps

    For comparison, without caching, the qps is 33.

    As can be seen, due to the query classifier cache there is no difference between exact and regex based matching.

    For maximum performance:

    • Arrange the situation so that the default selects=assume_cacheable can be used, and use no rules.

    Otherwise it is mostly a personal preference whether exact or regex based rules are used. However, one should always test with real data and real queries before choosing one over the other.

    This page is licensed: CC BY-SA / Gnu FDL

    Yes

    (no limit)
    (no limit)
    (no limit)
    (no limit)
    (no limit)
    (no limit)
    (no rules)
    ,
    thread_specific
  • Default: thread_specific

  • ,
    verify_cacheable
  • Default: assume_cacheable

  • ,
    FOUND_ROWS
    ,
    GET_LOCK
    ,
    IS_FREE_LOCK
    ,
    IS_USED_LOCK
    ,
    LAST_INSERT_ID
    ,
    LOAD_FILE
    ,
    LOCALTIME
    ,
    LOCALTIMESTAMP
    ,
    MASTER_POS_WAIT
    ,
    NOW
    ,
    RAND
    ,
    RELEASE_LOCK
    ,
    SESSION_USER
    ,
    SLEEP
    ,
    SYSDATE
    ,
    SYSTEM_USER
    ,
    UNIX_TIMESTAMP
    ,
    USER
    ,
    UUID
    ,
    UUID_SHORT
    .
  • The SELECT accesses any of the following fields: CURRENT_DATE,CURRENT_TIMESTAMP, LOCALTIME, LOCALTIMESTAMP

  • The SELECT uses system or user variables.

  • ,
    read_only_transactions
    ,
    all_transactions
  • Default: all_transactions

  • all_transactions: The cache will be used and populated inside explicitly read-only transactions. Inside transactions that are not explicitly read-only, the cache will be used and populated until the first non-SELECT statement.
    2 (0b00010) A non-matching rule is logged.
  • 4 (0b00100) A decision to use data from the cache is logged.

  • 8 (0b01000) A decision not to use data from the cache is logged.

  • 16 (0b10000) Higher level decisions are logged.

  • ,
    current
  • Default: never

  • ,
    isolated
  • Default: mixed

  • or
    unlike
    , and
  • the value a string.

  • the value a string.

    assume_cacheable

    exact match

    83

    verify_cacheable

    none

    80

    verify_cacheable

    regexp match

    80

    verify_cacheable

    exact match

    80

    storage_gridgain

    No

    storage_inmemory

    Yes

    storage_memcached

    No

    SELECT * FROM t WHERE a=1;
    INSERT INTO t SET a=42;
    Timeline 1                 Timeline 2
    
    Clients execute       INSERT ...                 SELECT COUNT(*) FROM tbl
    MaxScale -> DB                                   SELECT COUNT(*) FROM tbl
    MaxScale -> DB        INSERT ...
    MaxScale -> Cache     Delete invalidated values
    MaxScale -> Cache                                Store result and invalidation key
    [Cache]
    type=filter
    module=cache
    hard_ttl=30
    soft_ttl=20
    rules=...
    ...
    
    [Cached-Routing-Service]
    type=service
    ...
    filters=Cache
    storage=storage_redis
    hard_ttl=60s
    soft_ttl=60s
    max_resultset_rows=1000
    max_resultset_size=128Ki
    max_count=1000
    max_size=100Mi
    rules=/path/to/rules-file
    maxctrl alter filter MyCache rules='/path/to/rules-file'
    cached_data=shared
    selects=verify_cacheable
    cache_in_transactions=never
    debug=31
    enabled=false
    * `never`: No invalidation is performed. This is the default.
    * `current`: When a modification is made, entries in the cache used by
      the current session are invalidated. Other sessions that use the same
      cache will also be affected, but sessions that use another cache will
      not.
    * `mixed`: The data of different users is stored in the same
      cache. This is the default and may cause that a user can
      access data he should not have access to.
    * `isolated`: Each user has a unique cache and there can be
      no unintended sharing.
    timeout=7000ms
    SET @maxscale.cache.populate=TRUE;
    SELECT a, b FROM tbl;
    SET @maxscale.cache.populate=FALSE;
    SELECT a, b FROM tbl;
    SELECT @maxscale.cache.populate;
    SET @maxscale.cache.use=TRUE;
    SELECT a, b FROM tbl;
    SET @maxscale.cache.use=FALSE;
    SELECT a, b FROM tbl;
    SELECT @maxscale.cache.use;
    SET @maxscale.cache.soft_ttl=600;
    SELECT a, b FROM unimportant;
    SET @maxscale.cache.soft_ttl=60;
    SELECT c, d FROM important;
    SELECT @maxscale.cache.soft_ttl;
    SET @maxscale.cache.soft_ttl=600, @maxscale.cache.hard_ttl=610;
    SELECT a, b FROM unimportant;
    SET @maxscale.cache.soft_ttl=60, @maxscale.cache.hard_ttl=65;
    SELECT c, d FROM important;
    SELECT @maxscale.cache.hard_ttl;
    [TheCache]
    type=filter
    module=cache
    enabled=false
    SET @maxscale.cache.populate=TRUE;
    SELECT a, b FROM tbl1;
    SELECT c, d FROM tbl2;
    SELECT e, f FROM tbl3;
    SET @maxscale.cache.populate=FALSE;
    SET @maxscale.cache.use=TRUE;
    SELECT a, b FROM tbl1;
    SET @maxscale.cache.use=FALSE;
    UPDATE tbl1 SET a = ...;
    SET @maxscale.cache.populate=TRUE;
    SELECT a, b FROM tbl1;
    SET @maxscale.cache.populate=FALSE;

    thread_specific

    No thread contention. Data/work duplicated across threads. May cause unintended sharing.

    No thread contention. Data/work duplicated across threads and users. No unintended sharing. Requires the most amount of memory.

    shared

    Thread contention under high load. No duplicated data/work. May cause unintended sharing. Requires the least amount of memory.

    Thread contention under high load. Data/work duplicated across users. No unintended sharing.

    {
        store: [ ... ],
        use: [ ... ]
    }
    [
        {
            store: [ ... ],
            use: [ ... ]
        },
        { ... }
    ]
    {
        "attribute": <string>,
        "op": <string>
        "value": <string>
    }
    SELECT * FROM db1.tbl
    USE db1;
    SELECT * FROM tbl
    SELECT * FROM tbl WHERE a = 2 AND b = 3;
    SELECT * FROM tbl WHERE b = 3 AND a = 2;
    SELECT a FROM tbl;
    SELECT b FROM tbl WHERE a > 5;
    USE somedb;
    SELECT fld FROM tbl;
    {
        "store": [
            {
                "attribute": "database",
                "op": "=",
                "value": "db1"
            }
        ]
    }
    {
        "store": [
            {
                "attribute": "table",
                "op": "!=",
                "value": "tbl1"
            }
        ]
    }
    {
        "store": [
            {
                "attribute": "table",
                "op": "!=",
                "value": "db1.tbl1"
            }
        ]
    }
    {
        "store": [
            {
                "attribute": "query",
                "op": "like",
                "value": ".*WHERE.*"
            }
        ]
    }
    {
        "attribute": <string>,
        "op": <string>
        "value": <string>
    }
    {
        "attribute": "user",
        "op": "=",
        "value": "'bob'@'%'"
    }
    
    {
        "attribute": "user",
        "op": "like",
        "value": "bob@.*"
    }
    {
        "use": [
            {
                "attribute": "user",
                "op": "!=",
                "value": "admin"
            }
        ]
    }
    MySQL [testdb]> select * from access;
    ERROR 1142 (42000): SELECT command denied to user 'bob'@'localhost' for table 'access'
    {
        "store": [
            {
                "attribute": "table",
                "op": "=",
                "value": "access"
            }
        ]
    }
    MySQL [testdb]> select * from access;
    +------+------+
    | a    | b    |
    +------+------+
    |   47 |   11 |
    +------+------+
    MySQL [testdb]> select current_user();
    +----------------+
    | current_user() |
    +----------------+
    | bob@127.0.0.1  |
    +----------------+
    1 row in set (0.00 sec)
    
    MySQL [testdb]> select * from access;
    +------+------+
    | a    | b    |
    +------+------+
    |   47 |   11 |
    +------+------+
    {
        "store": [
            {
                "attribute": "table",
                "op": "=",
                "value": "access"
            }
        ],
        "use": [
            {
                "attribute": "user",
                "op": "=",
                "value": "'alice'@'%'"
            }
        ]
    }
    storage=storage_inmemory
    storage=storage_gridgain
    [MyCache]
    ...
    storage=storage_gridgain
    storage_gridgain.endpoints=127.0.0.1
    storage=storage_memcached
    [Cache-Filter]
    type=filter
    module=cache
    storage=storage_memcached
    storage_memcached.server=192.168.1.31
    storage_memcached.max_value_size=10M
    storage_options="server=192.168.1.31,max_value_size=10M"
    storage=storage_redis
    [Cache-Filter]
    type=filter
    module=cache
    storage=storage_redis
    storage_redis.server=192.168.1.31
    storage_redis.username=hello
    storage_redis.password=world
    storage_options="server=192.168.1.31,username=hello,password=world"
    $ redis-cli flushall
    [MyCache]
    type=filter
    module=cache
    storage=storage_inmemory
    soft_ttl=30
    hard_ttl=45
    cached_data=shared
    max_size=50Mi
    rules=cache_rules.json
    
    [MyService]
    type=service
    ...
    filters=MyCache
    {
        "store": [
            {
                "attribute": "table",
                "op": "=",
                "value": "sbtest"
            }
        ]
    }
    {
        "store": [
            {
                "attribute": "database",
                "op": "=",
                "value": "db1"
            }
        ]
    }
    {
        "store": [
            {
                "attribute": "query",
                "op": "like",
                "value": "FROM db1\\..*"
            }
        ]
    }
    {
        "attribute": "query",
        "op": "unlike",
        "value": "FROM nomatch"
    }
    {
        "attribute": "database",
        "op": "!=",
        "value": "nomatch"
    }

    assume_cacheable

    none

    100

    assume_cacheable

    regexp match

    83

    Limitations

    Prepared Statements

    Multi-statements

    Security

    information_schema

    Invalidation

    Best Efforts

    Configuration

    Settings

    storage

    storage_options

    hard_ttl

    soft_ttl

    max_resultset_rows

    max_resultset_size

    max_count

    max_size

    rules

    cached_data

    selects

    cache_in_transactions

    debug

    enabled

    invalidate

    clear_cache_on_parse_errors

    users

    timeout

    Runtime Configuration

    @maxscale.cache.populate

    @maxscale.cache.use

    @maxscale.cache.soft_ttl

    @maxscale.cache.hard_ttl

    Client Driven Caching

    Threads, Users and Invalidation

    Invalidation

    cached_data=thread_specific

    cache_data=shared

    Rules

    When to Store

    Qualified Names

    Implication of the default database

    Regexp Matching

    Examples

    When to Use

    Examples

    Security

    Storage

    storage_inmemory

    storage_gridgain

    endpoints

    user

    password

    ssl

    ssl_cert

    ssl_key

    ssl_ca

    max_value_size

    partition_awareness

    Limitations

    Security

    storage_memcached

    server

    max_value_size

    Example

    Limitations

    Security

    storage_redis

    server

    username

    password

    ssl

    ssl_cert

    ssl_key

    ssl_ca

    Authentication

    SSL

    Example

    Limitations

    Invalidation

    Security

    Example

    Configuration

    cache_rules.json

    Performance

    Summary

    cache_in_transactions
    selects
    Security
    users
    invalidation
    invalidate
    clear_cache_on_parse_errors
    Threads, Users and Invalidation
    soft
    hard
    Storage
    duration
    soft_ttl
    duration
    hard_ttl
    size
    size
    enum
    enum
    performance
    enum
    boolean
    Runtime Configuration
    enum
    boolean
    enum
    duration
    memcached
    redis
    gridgain
    gridgain
    cached_data
    boolean
    size
    boolean
    Partition awareness
    memcached
    size
    redis
    timeout
    authentication
    authentication
    boolean
    ssl
    ssl
    ssl
    ssl
    auth
    here
    here
    SSL
    query classifier cache
    spinner
    storage_redis

    MariaDB Monitor

    Manage primary-replica clusters with the mariadbmon module. Learn to configure automatic failover, perform switchovers, and monitor replication lag to maintain database availability.

    Overview

    MariaDB Monitor monitors a Primary-Replica replication cluster. It probes the state of the backends and assigns server roles such as primary and replica, which are used by the routers when deciding where to route a query. It can also modify the replication cluster by performing failover, switchover and rejoin.

    Required Grants

    The monitor user requires the following grant:

    CREATE USER 'mariadbmon'@'maxscalehost' IDENTIFIED BY
    
    CREATE USER 'mariadbmon'@'maxscalehost' IDENTIFIED BY
    

    If the monitor needs to query server disk space (for instance, disk_space_threshold is set), it needs the FILE privilege:

    GRANT FILE ON *.* TO 'mariadbmon'@'maxscalehost';

    The CONNECTION ADMIN privilege is recommended since it allows the monitor to log in even if the server connection limit has been reached.

    , and require the following privilege:

    If are used, the monitor requires several additional privileges. These privileges allow the monitor to set the read-only flag, modify replication connections and kill connections from clients that could interfere with an ongoing operation.

    If is enabled, the monitor requires the EVENT privilege. SHOW DATABASES is also recommended to ensure monitors can see events for all databases.

    If a separate replication user is defined (with replication_user andreplication_password), it requires the following grant:

    Only one backend can be primary at any given time. A primary must be running (successfully connected to by the monitor) and its read_only-setting must be off. A primary may not be replicating from another server in the monitored cluster unless the primary is part of a multiprimary group. Primary selection prefers to select the server with the most replicas, possibly in multiple replication layers. Only replicas reachable by a chain of running relays or directly connected to the primary count. When multiple servers are tied for primary status, the server which appears earlier in the servers-setting of the monitor is selected.

    Servers in a cyclical replication topology (multiprimary group) are interpreted as having all the servers in the group as replicas. Even from a multiprimary group only one server is selected as the overall primary.

    After a primary has been selected, the monitor prefers to stick with the choice even if other potential primaries with more replica servers are available. Only if the current primary is clearly unsuitable does the monitor try to select another primary. An existing primary turns invalid if:

    1. It is unwritable (read_only is on).

    2. It has been down for more than failcount monitor passes and has no running replicas. Running replicas behind a downed relay count. A replica in this context is any server with at least a partially running replication connection (either io or sql thread is running). The replicas must also be down for more than failcount monitor passes to allow new master selection.

    3. It did not previously replicate from another server in the cluster but it is now replicating.

    Cases 1 and 2 cover the situations in which the DBA, an external script or even another MaxScale has modified the cluster such that the old primary can no longer act as primary. Cases 3 and 4 are less severe. In these cases the topology has changed significantly and the primary should be re-selected, although the old primary may still be the best choice.

    The primary change described above is different from failover and switchover described in section A primary change only modifies the server roles inside MaxScale but does not modify the cluster other than changing the targets of read and write queries. Failover and switchover perform a primary change on their own.

    As a general rule, it's best to avoid situations where the cluster has multiple standalone servers, separate primary-replica pairs or separate multiprimary groups. Due to primary invalidation rule 2, a standalone primary can easily lose the primary status to another valid primary if it goes down. The new primary probably does not have the same data as the previous one. Non-standalone primaries are less vulnerable, as a single running replica or multiprimary group member will keep the primary valid even when down.

    A minimal configuration for a monitor requires a set of servers for monitoring and a username and a password to connect to these servers.

    From MaxScale 2.2.1 onwards, the module name is mariadbmon instead ofmysqlmon. The old name can still be used.

    The grants required by the user depend on which monitor features are used. A full list of the grants can be found in the section.

    For a list of optional parameters that all monitors support, read the document.

    These are optional parameters specific to the MariaDB Monitor. Failover, switchover and rejoin-specific parameters are listed in their own . Rebuild-related parameters are described in the . ColumnStore parameters are described in the .

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    When active, the monitor assumes that server hostnames and ports are consistent between the server definitions in the MaxScale configuration file and the "SHOW ALL SLAVES STATUS" outputs of the servers themselves. Specifically, the monitor assumes that if server A is replicating from server B, then A must have a replica connection with Master_Host andMaster_Port equal to B's address and port in the configuration file. If this is not the case, e.g. an IP is used in the server while a hostname is given in the file, the monitor may misinterpret the topology. The monitor attempts name resolution on the addresses if a simple string comparison does not find a match. Using exact matching addresses is, however, more reliable. In MaxScale 24.02.0, an alternative IP or hostname for a server can be given in .

    This setting must be ON to use any cluster operation features such as failover or switchover, because MaxScale uses the addresses and ports in the configuration file when issuing "CHANGE MASTER TO"-commands.

    If the network configuration is such that the addresses MaxScale uses to connect to backends are different from the ones the servers use to connect to each other and private_address is not used, assume_unique_hostnames should be set to OFF. In this mode, MaxScale uses server id:s it queries from the servers and the Master_Server_Id fields of the replica connections to deduce which server is replicating from which. This is not perfect though, since MaxScale doesn't know the id:s of servers it has never connected to (e.g. server has been down since MaxScale was started). Also, the Master_Server_Id-field may have an incorrect value if the replica connection has not been established. MaxScale will only trust the value if the monitor has seen the replica connection IO thread connected at least once. If this is not the case, the replica connection is ignored.

    String. This is an optional server setting, yet documented here since it's only used by MariaDB Monitor. If not set, the normal server address setting is used.

    Defines an alternative IP-address or hostname for the server for use with replication. Whenever MaxScale modifies replication (e.g. during switchover), the private address is given as Master_Host to "CHANGE MASTER TO"-commands. Also, when detecting replication, any Master_Host-values from "SHOW SLAVE STATUS"-queries are compared to the private addresses of configured servers if the normal address doesn't match.

    This setting is useful if replication and application traffic are separated to different network interfaces.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: none

    Designate additional conditions for master-status, i.e. qualified for read and write queries.

    Normally, if a suitable primary candidate server is found as described in , MaxScale designates it Master.master_conditions sets additional conditions for a primary server. This setting is an enum_mask, allowing multiple conditions to be set simultaneously. Conditions 2, 3 and 4 refer to replica servers. A single replica must fulfill all of the given conditions for the primary to be viable.

    If the primary candidate fails master_conditions but fulfills slave_conditions, it may be designated Slave instead.

    The available conditions are:

    1. none : No additional conditions

    2. connecting_slave : At least one immediate replica (not behind relay) is attempting to replicate or is replicating from the primary (Slave_IO_Running is 'Yes' or 'Connecting', Slave_SQL_Running is 'Yes'). A replica with incorrect replication credentials does not count. If the replica is currently down, results from the last successful monitor tick are used.

    3. connected_slave : Same as above, with the difference that the replication connection must be up (Slave_IO_Running is 'Yes'). If the replica is currently down, results from the last successful monitor tick are used.

    The default value of this setting is master_conditions=primary_monitor_master,disk_space_ok to ensure that both monitors use the same primary server when cooperating and that the primary is not out of disk space.

    For example, to require that the primary must have a replica which is both connected and running, set

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: none

    Designate additional conditions for Slave-status, i.e qualified for read queries.

    Normally, a server is Slave if it is at least attempting to replicate from the primary candidate or a relay (Slave_IO_Running is 'Yes' or 'Connecting', Slave_SQL_Running is 'Yes', valid replication credentials). The primary candidate does not necessarily need to be writable, e.g. if it fails its master_conditions. slave_conditions sets additional conditions for a replica server. This setting is an enum_mask, allowing multiple conditions to be set simultaneously.

    The available conditions are:

    1. none : No additional conditions. This is the default value.

    2. linked_master : The replica must be connected to the primary (Slave_IO_Running and Slave_SQL_Running are 'Yes') and the primary must be Running. The same applies to any relays between the replica and the primary.

    3. running_master : The primary must be running. Relays may be down.

    For example, to require that the primary server of the cluster must be running and writable for any servers to have Slave-status, set

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 5

    The number of consecutive monitor passes a primary server must be down before it is considered failed. If automatic failover is enabled (auto_failover=true), it may be performed at this time. A value of 0 or 1 enables immediate failover.

    If automatic failover is not possible, the monitor will try to search for another server to fulfill the primary role. See section for more details. Changing the primary may break replication as queries could be routed to a server without previous events. To prevent this, avoid having multiple valid primary servers in the cluster.

    The worst-case delay between the primary failure and the start of the failover can be estimated by summing up the timeout values and monitor_interval and multiplying that by failcount:

    If is enabled, failcount also has a smallest safe value, so that stale locks left behind by a network outage expire before a failover begins. See .

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    If set to ON, the monitor attempts to disable the read_only-flag on the primary when seen. The flag is checked every monitor tick. The monitor user requires the SUPER-privilege for this feature to work.

    Typically, the primary server should never be in read-only-mode. Such a situation may arise due to misconfiguration or accident, or perhaps if MaxScale crashed during switchover.

    When this feature is enabled, setting the primary manually to read_only will no longer cause the monitor to search for another primary. The primary will instead for a moment lose its [Master]-status (no writes), until the monitor again enables writes on the primary. When starting from scratch, the monitor still prefers to select a writable server as primary if possible.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    If set to ON, the monitor attempts to enable the read_only-flag on any writable replica server. The flag is checked every monitor tick. The monitor user requires the SUPER-privilege (or READ_ONLY ADMIN) for this feature to work. While the read_only-flag is ON, only users with the SUPER-privilege (or READ_ONLY ADMIN) can write to the backend server. If temporary write access is required, this feature should be disabled before attempting to disable read_only manually. Otherwise, the monitor will quickly re-enable it.

    read_only won't be enabled on the master server, even if it has lost [Master]-status due to and is marked [Slave].

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    Works similar to except will set read_only on any writable server that is not the primary and not in maintenance (a superset of the servers altered by enforce_read_only_slaves).

    The monitor user requires the SUPER-privilege (or READ_ONLY ADMIN) for this feature to work. If the cluster has no valid primary or primary candidate, read_only is not set on any server as it is unclear which servers should be altered.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    If a running server that is not the primary or a relay primary is out of disk space the server is set to maintenance mode. Such servers are not used for router sessions and are ignored when performing a failover or other cluster modification operation. See the general monitor parameters and on how to enable disk space monitoring.

    Once a server has been put to maintenance mode, the disk space situation of that server is no longer updated. The server will not be taken out of maintenance mode even if more disk space becomes available. The maintenance flag must be removed manually:

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: none

    Using this setting is recommended when multiple MaxScales are monitoring the same backend cluster. When enabled, the monitor attempts to acquire exclusive locks on the backend servers. The monitor considers itself the primary monitor if it has a majority of locks. The majority can be either over all configured servers or just over running servers. See for more details on how this feature works and which value to use.

    Allowed values:

    1. none Default value, no locking.

    2. majority_of_all Primary monitor requires a majority of locks, even counting servers which are [Down].

    3. majority_of_running Primary monitor requires a majority of locks over [Running] servers.

    This setting is separate from the global MaxScale setting passive. If passive is set to true, cluster operations are disabled even if the monitor has acquired the locks. Generally, it's best not to mix cooperative monitoring with passive. Either set passive=false or do not set it at all.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    This is a comma-separated list of server names that will not take part in . MaxScale will not acquire locks on these servers and the servers will not add to the number of locks required for majority. If all servers are added to the list, MaxScale cannot claim lock majority at all. This setting does not affect primary server selection (i.e. Master-role), so a server in this list may be a valid target for write queries. See for limiting primary server selection.

    If a server in this list is selected as the primary server and cooperative monitoring is enabled, the monitor will (if it is the primary monitor) still acquire the maxscale_mariadbmonitor_master lock on the server to ensure other MaxScales select the same primary server.

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: -1

    Defines a replication lag limit in seconds for launching the monitor script configured in the script-parameter. If the replication lag of a server goes above this limit, the script is run with the $EVENT-placeholder replaced by "rlag_above". If the lag goes back below the limit, the script is run again with replacement "rlag_below".

    Negative values disable this feature. For more information on monitor scripts, see .

    MariaDB Monitor can perform several operations that modify the replication topology. The supported operations are:

    • , which replaces a failed primary with a replica

    • , which replaces a failed primary with a replica only if no data is clearly lost

    • , which swaps a running primary with a replica

    See for more information on the implementation of the commands.

    MariaDB Monitor also supports backup operations that copy or overwrite the entire contents of a server: rebuild-server (run with the async-rebuild-server command), create-backup (async-create-backup), and restore-from-backup (async-restore-from-backup). These are described in the section.

    The cluster operations require that the monitor user (user) has the following privileges:

    • SUPER, to modify replica connections, set globals such as read_only and kill connections from other super-users

    • REPLICATION CLIENT (REPLICATION SLAVE ADMIN in MariaDB Server 10.5), to list replica connections

    • RELOAD, to flush binary logs

    A list of the grants can be found in the section.

    The privilege system was changed in MariaDB Server 10.5. The effects of this on the MaxScale monitor user are minor, as the SUPER-privilege contains many of the required privileges and is still required to kill connections from other super-users.

    In MariaDB Server 11.0.1 and later, SUPER no longer contains all the required grants. The monitor requires:

    • READ_ONLY ADMIN, to set read_only

    • REPLICA MONITOR and REPLICATION SLAVE ADMIN, to view and manage replication connections

    • RELOAD, to flush binary logs

    In addition, the monitor needs to know which username and password a replica should use when starting replication. These are given inreplication_user and replication_password.

    The user can define files with SQL statements which are executed on any server being demoted or promoted by cluster manipulation commands. See the sections onpromotion_sql_file and demotion_sql_file for more information.

    The monitor can manipulate scheduled server events when promoting or demoting a server. See the section on handle_events for more information.

    All cluster operations can be activated manually through MaxCtrl. See section for more details.

    See for information on possible issues with failover and switchover.

    Failover replaces a failed primary with a running replica. It does the following:

    1. Select the most up-to-date replica of the old primary to be the new primary. The selection criteria is as follows in descending priority:

      • gtid_IO_pos (latest event in relay log)

      • gtid_current_pos (most processed events)

    Failover-safe performs the same steps as a normal failover but refuses to start if it's clear that data would be lost. Dataloss occurs if the primary had data which was not replicated to any replica before the primary went down. MaxScale detects this by looking at the GTIDs of the servers. Because the monitor queries the GTIDs only every monitor interval, this check is inaccurate. If the primary performs a write just before crashing and before MaxScale queries the GTID, data could be lost even with "safe" failover. Thus, this feature mainly protects against situations where the replicas are constantly lagging.

    Switchover swaps a running primary with a running replica. It does the following:

    1. Prepare the old primary for demotion:

    2. If backend_read_timeout is short, extend it and reconnect.

    3. Stop any external replication.

    Similar to failover, switchover is considered successful if the new primary was successfully promoted.

    Switchover-force performs the same steps as a normal switchover but ignores any errors on the old primary. Switchover-force also does not expect the new primary to reach the gtid-position of the old, as the old primary could be receiving more events constantly. Thus, switchover-force may lose events and replication can break on multiple (or even all) replicas. This is an unsafe command and should only be used as a last resort.

    Rejoin joins a standalone server to the cluster or redirects a replica replicating from a server other than the primary. A standalone server is joined by:

    1. Run the commands in demotion_sql_file.

    2. Enable the read_only-flag.

    3. Disable scheduled server events (if event handling is on).

    A server which is replicating from the wrong primary is redirected simply with STOP SLAVE, RESET SLAVE, CHANGE MASTER TO and START SLAVE commands.

    Redirect redirects a replica to replicate from another server in the cluster. It runs the STOP REPLICA, CHANGE MASTER TO and START REPLICA commands. This command is ineffective if is on, as the monitor would quickly undo any changes.

    Redirect accepts the following key-value arguments. conn_name is only required when dealing with multi-source replication.

    argument
    type
    default
    description

    Reset-replication (added in MaxScale 2.3.0) deletes binary logs and resets gtid:s. This destructive command is meant for situations where the gtid:s in the cluster are out of sync while the actual data is known to be in sync. The operation proceeds as follows:

    1. Reset gtid:s and delete binary logs on all servers:

    2. Stop (STOP SLAVE) and delete (RESET SLAVE ALL) all replica connections.

    3. Enable the read_only-flag.

    4. Disable scheduled server events (if event handling is on).

    Scan-topology (added in MaxScale 25.10) scans the replication topology and outputs the results in json format. Topology scan begins by running SHOW ALL REPLICAS STATUS and SHOW REPLICA HOSTS on any existing monitored servers. These queries show connected primary and replica servers. The monitor then expands the search, performing the same queries on the discovered servers until no new servers can be found. This command can be useful in determining if all servers in the replication topology are configured in MaxScale and monitored.

    Scan-topology accepts the following key-value arguments:

    argument
    type
    default
    description

    The resulting json-object contains an array with an element for each scanned server. For each server, the host, port, server id, primary server ids and replica server ids are listed. If the server is already configured in MaxScale, its name and monitor is listed.

    Discover-replicas (added in MaxScale 25.10) scans the replication topology (as in scan-topology) and adds any new discovered servers to MaxScale and the monitor. Only servers directly replicating from the current primary server are added, i.e. any external primaries or replicas behind relays are ignored. The command can also optionally remove servers that are shut down or non-replicating.

    Discover-replicas accepts the following key-value arguments:

    argument
    type
    default
    description

    Any discovered servers are added to MaxScale as if created via runtime maxctrl create server .... The servers are thus similar to any other runtime configured server and are visible in the GUI and maxctrl list servers. The address and port-settings of the discovered servers are set to the values returned by SHOW REPLICA HOSTS. Other settings are copied from the current primary server, so that the discovered servers inherit e.g. TLS settings. The generated servers are named <monitor_name>-server, e.g. MyMonitor-server3.

    A server can only be removed if it is not explicitly used by any other module, e.g. a service. Thus, this command is best used when services are configured with the -setting as the services will then automatically match any changes in the set of monitored servers.

    Discover-replicas is incompatible with and will refuse to run if it is enabled.

    Bootstrap (added in MaxScale 25.10) bootstraps an empty monitor (no servers), adding servers to it. Bootstrap requires the address of a server in the cluster to start from. The monitor connects to the address given and scans the replication topology as in scan-topology. Any server successfully connected to is added to the monitor and monitored normally. Server names are auto-generated as in <monitor_name>-server, e.g. MyMonitor-server3.

    Bootstrap accepts the following key-value arguments:

    argument
    type
    default
    description

    Any discovered servers are added to MaxScale as if created via runtime maxctrl create server .... The servers are thus similar to any other runtime configured server and are visible in the GUI and maxctrl list servers.

    The address and port-settings of the discovered servers are set to the values returned by SHOW REPLICA HOSTS or SHOW REPLICA STATUS. Other settings are copied from the server given in the template-setting, so that the discovered servers inherit e.g. TLS settings. If no server template is given, discovered servers will use . The server template must be a valid, existing server in MaxScale configuration. It need not be monitored by any monitor and its address and port-settings can point to a non-existing (but theoretically valid) network address. It can be configured in the config file or created runtime:

    Only simple topologies (i.e. one primary and zero or more replicas) are supported. MaxScale refuses to attempt this command on a more complicated replication setup. This policy helps keep the effects of this command predictable, as more complicated setups may include e.g. external primaries that should not be added to the monitor.

    Bootstrap is incompatible with and will refuse to run if it is enabled.

    Cluster operations can be activated manually through the REST API or MaxCtrl. The commands are only performed when MaxScale is in active mode. The commands generally match their automatic versions. The exception is rejoin, in which the manual command allows rejoining even when the joining server has empty gtid:s. This rule allows the user to force a rejoin on a server without binary logs.

    All commands require the monitor instance name as the first parameter. Failover selects the new primary server automatically and does not require additional parameters. Rejoin requires the name of the joining server as the second parameter. Replication reset accepts the name of the new primary server as the second parameter. If not given, the current primary is selected.

    Switchover takes one to three parameters. If only the monitor name is given, switchover will autoselect both the replica to promote and the current primary as the server to be demoted. If two parameters are given, the second parameter is interpreted as the replica to promote. If three parameters are given, the third parameter is interpreted as the current primary. The user-given current primary is compared to the primary server currently deduced by the monitor and if the two are unequal, an error is given.

    Example commands are below:

    The commands follow the standard module command syntax. All require the monitor configuration name (MyMonitor) as the first parameter. For switchover, the last two parameters define the server to promote (NewPrimaryServ) and the server to demote (OldPrimaryServ). For rejoin, the server to join (OldPrimaryServ) is required. Replication reset requires the server to promote (NewPrimaryServ).

    It is safe to perform manual operations even with automatic failover, switchover or rejoin enabled since automatic operations cannot happen simultaneously with manual ones.

    When a cluster modification is initiated via the REST-API, the URL path is of the form:

    • <operation> is the name of the command e.g. failover, switchover, rejoin or reset-replication.

    • <monitor-name> is the monitor name from the MaxScale configuration file.

    • <server-name1> and <server-name2>

    Given a MaxScale configuration file like

    with the assumption that server2 is the current primary, then the URL path for making server4 the new primary would be:

    Example REST-API paths for other commands are listed below.

    Most cluster modification commands wait until the operation either succeeds or fails. async-switchover is an exception, as it returns immediately. Otherwise async-switchover works identical to a normal switchover command. Use the module command fetch-cmd-result to view the result of the queued command. fetch-cmd-result returns the status or result of the latest manual command, whether queued or not.

    As of MaxScale 24.08.0, switchover can be launched using an alternate command syntax which passes arguments as key-value pairs. This allows for greater flexibility as a variable number of arguments can be easily defined in the call. This alternative form of switchover accepts the following arguments:

    argument
    type
    default
    description

    The key-value syntax thus supports the same features as the old switchover,async-switchover and switchover-force-commands.

    In addition, key-value argument passing supports old_primary_maint. This feature leaves the old primary server in maintenance mode without replication. This is useful when performing rolling MariaDB Server version upgrades. After all replicas have been upgraded, switch out the old primary withold_primary_maint=1 to promote one of the replicas while leaving the old primary as standalone.

    Failover can activate automatically if auto_failover is on. The activation begins when the primary has been down at least failcount monitor iterations. Before modifying the cluster, the monitor checks that all prerequisites for the failover are fulfilled. If the cluster does not seem ready, an error is printed and the cluster is rechecked during the next monitor iteration.

    Switchover can also activate automatically with theswitchover_on_low_disk_space-setting. The operation begins if the primary server is low on disk space but otherwise the operating logic is quite similar to automatic failover.

    Rejoin stands for starting replication on a standalone server or redirecting a replica replicating from the wrong primary (any server that is not the cluster primary). The rejoined servers are directed to replicate from the current cluster primary server, forcing the replication topology to a 1-primary-N-replicas configuration.

    A server is categorized as standalone if the server has no replica connections, not even stopped ones. A server is replicating from the wrong primary if the replica IO thread is connected but the primary server id seen by the replica does not match the cluster primary id. Alternatively, the IO thread may be stopped or connecting but the primary server host or port information differs from the cluster primary info. These criteria mean that a STOP SLAVE does not yet set a replica as standalone.

    With auto_rejoin active, the monitor will try to rejoin any servers matching the above requirements. Rejoin does not obey failcount and will attempt to rejoin any valid servers immediately. When activating rejoin manually, the user-designated server must fulfill the same requirements.

    Switchover and failover are meant for simple topologies (one primary and several replicas). Using these commands with complicated topologies (multiple primaries, relays, circular replication) may give unpredictable results and should be tested before use on a production system.

    The server cluster is assumed to be well-behaving with no significant replication lag (within failover_timeout/switchover_timeout) and all commands that modify the cluster (such as "STOP SLAVE", "CHANGE MASTER", "START SLAVE") complete in a few seconds (faster than backend_read_timeout and backend_write_timeout).

    The backends must all use GTID-based replication, and the domain id should not change during a switchover or failover. Replicas should not have extra local events so that GTIDs are compatible across the cluster.

    Failover cannot be performed if MaxScale was started only after the primary server went down. This is because MaxScale needs reliable information on the gtid domain of the cluster and the replication topology in general to properly select the new primary. enforce_simple_topology=1 relaxes this requirement.

    Failover may lose events. If a primary goes down before sending new events to at least one replica, those events are lost when a new primary is chosen. If the old primary comes back online, the other servers have likely moved on with a diverging history and the old primary can no longer join the replication cluster.

    To reduce the chance of losing data, use In semisynchronous mode, the primary waits for a replica to receive an event before returning an acknowledgement to the client. This does not yet guarantee a clean failover. If the primary fails after preparing a transaction but before receiving replica acknowledgement, it will still commit the prepared transaction as part of its crash recovery. If the replicas never saw this transaction, the old primary has diverged from the cluster. See for more information. This situation is much less likely in MariaDB Server 10.6.2 and later, as the improved crash recovery logic will delete such transactions.

    Even a controlled shutdown of the primary may lose events. The server does not by default wait for all data to be replicated to the replicas when shutting down and instead simply closes all connections. Before shutting down the primary with the intention of having a replica promoted, run switchover first to ensure that all data is replicated. For more information on server shutdown, see .

    Switchover requires that the cluster is "frozen" for the duration of the operation. This means that no data modifying statements such as INSERT or UPDATE are executed and the GTID position of the primary server is stable. When switchover begins, the monitor sets the global read_only flag on the old primary backend to stop any updates. read_only does not affect users with the SUPER-privilege so any such user can issue writes during a switchover. These writes have a high chance of breaking replication, because the write may not be replicated to all replicas before they switch to the new primary. To prevent this, any users who commonly do updates should NOT have the SUPER-privilege. For even more security, the only SUPER-user session during a switchover should be the MaxScale monitor user. This also applies to users running scheduled server events. Although the monitor by default disables events on the master, an event may already be executing. If the event definer has SUPER-privilege, the event can write to the database even through read_only.

    When mixing rejoin with failover/switchover, the backends should have log_slave_updates on. The rejoining server is likely lagging behind the rest of the cluster. If the current cluster primary does not have binary logs from the moment the rejoining server lost connection, the rejoining server cannot continue replication. This is an issue if the primary has changed and the new primary does not have log_slave_updates on.

    If an automatic cluster operation such as auto-failover or auto-rejoin fails, all cluster modifying operations are disabled for failcount monitor iterations, after which the operation may be retried. Similar logic applies if the cluster is unsuitable for such operations, e.g. replication is not using GTID.

    The monitor detects if a server in the cluster is replicating from an external primary (a server that is not monitored by the monitor). If the replicating server is the cluster primary server, then the cluster itself is considered to have an external primary.

    If a failover/switchover happens, the new primary server is set to replicate from the cluster external primary server. The username and password for the replication are defined in replication_user and replication_password. The address and port used are the ones shown by SHOW ALL SLAVES STATUS on the old cluster primary server. In the case of switchover, the old primary also stops replicating from the external server to preserve the topology.

    After failover the new primary is replicating from the external primary. If the failed old primary comes back online, it is also replicating from the external server. To normalize the situation, either have auto_rejoin on or manually execute a rejoin. This will redirect the old primary to the current cluster primary.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: true

    Enable automatic primary failover. true, on, yes and 1 enable normal failover. false, off, no and 0 disable the feature. safe enables .

    When automatic failover is enabled, MaxScale will elect a new primary server for the cluster if the old primary goes down. A server is assumed Down if it cannot be connected to, even if this is caused by incorrect credentials. Failover triggers if the primary stays down for monitor intervals. Failover will not take place if MaxScale is set .

    As failover alters replication, it requires more privileges than normal monitoring. See for a list of grants.

    Failover is designed to be used with simple primary-replica topologies. More complicated topologies, such as multilayered or circular replication, are not guaranteed to always work correctly. Test before using failover with such setups.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    Enable automatic joining of servers to the cluster. When enabled, MaxScale will attempt to direct servers to replicate from the current cluster primary if they are not currently doing so. Replication will be started on any standalone servers. Servers that are replicating from another server will be redirected. This effectively enforces a 1-primary-N-replicas topology. The current primary itself is not redirected, so it can continue to replicate from an external primary. Rejoin is also not performed on any server that is replicating from multiple sources, as this indicates a complicated topology (this rule is overridden by ).

    This feature is often paired with to redirect the former primary when it comes back online. Sometimes this kind of rejoin will fail as the old primary may have transactions that were never replicated to the current one. See for more information.

    As an example, consider the following series of events:

    1. Replica A goes down

    2. Primary goes down and a failover is performed, promoting Replica B

    3. Replica A comes back

    4. Old primary comes back

    Replica A is still trying to replicate from the downed primary, since it wasn't online during failover. If auto_rejoin is on, Replica A will quickly be redirected to Replica B, the current primary. The old primary will also rejoin the cluster if possible.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    When enabled, the monitor will automatically switchover back to the original, failovered primary once it rejoins the cluster. Both and should be enabled for this feature to properly work. If these features are not enabled, failback will only activate once failover and rejoin have been performed manually.

    The monitor keeps track of the failback primary separately from the current primary. The failback primary is updated if either an external topology change, , or causes a primary server change. Failover does not change the failback primary. The current failback primary is listed in monitor diagnostics. Run maxctrl show monitors and look for failback_primary.

    Once the failback primary rejoins the cluster as a replica, a counter starts. The failback primary must stay online and replicate without interruption for monitor ticks. It must also catch up with the current primary server, at least to the gtid the current primary had when the failback primary rejoined. Replication delay must also be low, typically at most five seconds. Once these conditions are met, the monitor runs a switchover to restore the failback primary to the primary role.

    The following series of events demonstrates failback switchover:

    1. Cluster includes primary P, replicas R1 and R2.

    2. P goes down and stays down long enough for a failover to trigger. R1 is the new primary.

    3. R1 also goes down, failover triggers again. R2 is now primary and the only server left running.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    If enabled, the monitor will attempt to switchover a primary server low on disk space with a replica. The switch is only done if a replica without disk space issues is found. Ifmaintenance_on_low_disk_space is also enabled, the old primary (now a replica) will be put to maintenance during the next monitor iteration.

    For this parameter to have any effect, disk_space_threshold must be specified for the or the . Also, must be defined for the monitor.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    This setting tells the monitor to assume that the servers should be arranged in a 1-primary-N-replicas topology and the monitor should try to keep it that way. Ifenforce_simple_topology is enabled, the settings assume_unique_hostnames,auto_failover and auto_rejoin are also activated regardless of their individual settings.

    By default, mariadbmon will not rejoin servers with more than one replication stream configured into the cluster. Starting with MaxScale 6.2.0, whenenforce_simple_topology is enabled, all servers will be rejoined into the cluster and any extra replication sources will be removed. This is done to make automated failover with multi-source external replication possible.

    This setting also allows the monitor to perform a failover to a cluster where the primary server has not been seen [Running]. This is usually the case when the primary goes down before MaxScale is started. When using this feature, the monitor will guess the GTID domain id of the primary from the replicas. For reliable results, the GTID:s of the cluster should be simple.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    This and replication_password specify the username and password of the replication user. These are given as the values for MASTER_USER andMASTER_PASSWORD whenever a CHANGE MASTER TO command is executed.

    Both replication_user and replication_password parameters must be defined if a custom replication user is used. If neither of the parameters is defined, theCHANGE MASTER TO-command will use the monitor credentials for the replication user.

    The credentials used for replication must have the REPLICATION SLAVE privilege.

    replication_password uses the same encryption scheme as other password parameters. If password encryption is in use, replication_password must be encrypted with the same key to avoid erroneous decryption.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    See

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    If set to ON, any CHANGE MASTER TO-command generated will set MASTER_SSL=1 to enable encryption for the replication stream. This setting should only be enabled if the backend servers are configured for ssl. This typically means setting ssl_ca, ssl_cert and ssl_key in the server configuration file. Additionally, credentials for the replication user should require an encrypted connection (e.g. ALTER USER repl@'%' REQUIRE SSL;).

    If the setting is left OFF, MASTER_SSL is not set at all, which will preserve existing settings when redirecting a replica connection.

    Type: string

    A custom string added to "CHANGE MASTER TO"-commands sent by the monitor whenever setting up replication (e.g. during switchover). Useful for defining ssl certificates or other specialized replication options. MaxScale does not check the contents of the string, so care should be taken to ensure that only valid options are set and that the contents do not interfere with the options MaxScale sets on its own (e.g. MASTER_HOST). This setting can also be configured for an individual server. If configured for both the monitor and a server, the server setting takes priority.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 90s

    Time limit for failover operation. Note that since the granularity of the timeout is seconds, a timeout specified in milliseconds will be rejected, even if the duration is longer than a second.

    If no successful failover takes place within the configured time period, a message is logged and automatic failover is disabled. This prevents further automatic modifications to the misbehaving cluster.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 90s

    Time limit for switchover operations. The timeout is also used as the time limit for a rejoin operation. Rejoin should rarely time out, since it is a faster operation than switchover. Note that since the granularity of the timeouts is seconds, a timeout specified in milliseconds will be rejected, even if the duration is longer than a second.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    Enable additional primary failure verification for automatic failover.verify_master_failure enables this feature and defines the timeout.

    Note that since the granularity of the timeout is seconds, a timeout specified in milliseconds will be rejected, even if the duration is longer than a second.

    Failure verification is performed by checking whether the replica servers are still connected to the primary and receiving events. An event is either a change in the Gtid_IO_Pos-field of the SHOW SLAVE STATUS output or a heartbeat event. Effectively, if a replica has received an event withinmaster_failure_timeout duration, the primary is not considered down when deciding whether to failover, even if MaxScale cannot connect to the primary.master_failure_timeout should be longer than the Slave_heartbeat_period of the replica connection to be effective.

    If every replica loses its connection to the primary (Slave_IO_Running is not "Yes"), primary failure is considered verified regardless of timeout. This allows faster failover when the primary properly disconnects.

    For automatic failover to activate, the failcount requirement must also be met.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 10s

    master_failure_timeout is specified as documented . If no explicit unit is provided, the value is interpreted as seconds in MaxScale 2.4. In subsequent versions a value without a unit may be rejected. Note that since the granularity of the timeout is seconds, a timeout specified in milliseconds will be rejected, even if the duration is longer than a second.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    This is a comma-separated list of server names that will not be chosen for primary promotion during a failover or autoselected for switchover. This does not affect switchover if the user selects the server to promote. Using this setting can disrupt new primary selection for failover such that a non-optimal server is chosen. At worst, this will cause replication to break. Alternatively, failover may fail if all valid promotion candidates are in the exclusion list.

    As of MaxScale 24.02.4 and 24.08.1, this setting also affects primary server selection during MaxScale startup or due to replication topology changes. A server listed in servers_no_promotion will thus not be selected as primary unless manually designated in a switchover-command.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    This and demotion_sql_file are paths to text files with SQL statements in them. During promotion or demotion, the contents are read line-by-line and executed on the backend. Use these settings to execute custom statements on the servers to complement the built-in operations.

    Empty lines or lines starting with '#' are ignored. Any results returned by the statements are ignored. All statements must succeed for the failover, switchover or rejoin to continue. The monitor user may require additional privileges and grants for the custom commands to succeed.

    When promoting a replica to primary during switchover or failover, thepromotion_sql_file is read and executed on the new primary server after its read-only flag is disabled. The commands are run before starting replication from an external primary if any.

    demotion_sql_file is run on an old primary during demotion to replica, before the old primary starts replicating from the new primary. The file is also run before rejoining a standalone server to the cluster, as the standalone server is typically a former primary server. When redirecting a replica replicating from a wrong primary, the sql-file is not executed.

    Since the queries in the files are run during operations which modify replication topology, care is required. If promotion_sql_file contains data modification (DML) queries, the new primary server may not be able to successfully replicate from an external primary. demotion_sql_file should never contain DML queries, as these may not replicate to the replica servers before replica threads are stopped, breaking replication.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    See .

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    If enabled, the monitor continuously queries the servers for enabled scheduled events and uses this information when performing cluster operations, enabling and disabling events as appropriate.

    When a server is being demoted, any events with "ENABLED" status are set to "SLAVESIDE_DISABLED". When a server is being promoted to primary, events that are either "SLAVESIDE_DISABLED" or "DISABLED" are set to "ENABLED" if the same event was also enabled on the old primary server last time it was successfully queried. Events are considered identical if they have the same schema and name. When a standalone server is rejoined to the cluster, its events are also disabled since it is now a replica.

    The monitor does not check whether the same events were disabled and enabled during a switchover or failover/rejoin. All events that meet the criteria above are altered.

    The monitor does not enable or disable the event scheduler itself. For the events to run on the new primary server, the scheduler should be enabled by the admin. Enabling it in the server configuration file is recommended.

    Events running at high frequency may cause replication to break in a failover scenario. If an old primary which was failed over restarts, its event scheduler will be on if set in the server configuration file. Its events will also remember their "ENABLED"-status and run when scheduled. This may happen before the monitor rejoins the server and disables the events. This should only be an issue for events running more often than the monitor interval or events that run immediately after the server has restarted.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    Enables additional checks when a STOP SLAVE command times out during a cluster manipulation operation such as failover or switchover. Normally, if STOP SLAVE times out, the monitor just tries again until time runs out. With this setting enabled, the monitor additionally checks replication connection status with SHOW ALL SLAVES STATUS. If replication has properly ended, the monitor assumes STOP SLAVE completed successfully and continues with the operation. If replication is still ongoing, the monitor prints the slave thread running states and retries STOP SLAVE.

    As of MaxScale 2.5, MariaDB-Monitor supports cooperative monitoring. This means that multiple monitors (typically in different MaxScale instances) can monitor the same backend server cluster and only one will be the primary monitor. Only the primary monitor may perform switchover, failover or rejoin operations. The primary also decides which server is the primary. Cooperative monitoring is enabled with the -setting. Even with this setting, only one monitor per server per MaxScale is allowed. This limitation can be circumvented by defining multiple copies of a server in the configuration file.

    Cooperative monitoring uses for coordinating between monitors. When cooperating, the monitor regularly checks the status of a lock named maxscale_mariadbmonitor on every server and acquires it if free. If the monitor acquires a majority of locks, it is the primary. If a monitor cannot claim majority locks, it is a secondary monitor.

    The primary monitor of a cluster also acquires the lock maxscale_mariadbmonitor_master on the primary server. Secondary monitors check which server this lock is taken on and only accept that server as the primary. This arrangement is required so that multiple monitors can agree on which server is the primary regardless of replication topology. If a secondary monitor does not see the primary-lock taken, then it won't mark any server as [Master], causing writes to fail.

    The lock-setting defines how many locks are required for primary status. Settingcooperative_monitoring_locks=majority_of_all means that the primary monitor needs n_servers/2 + 1 (rounded down) locks. For example, a cluster of three servers needs two locks for majority, a cluster of four needs three, and a cluster of five needs three. This scheme is resistant against split-brain situations in the sense that multiple monitors cannot be primary simultaneously. However, a split may cause both monitors to consider themselves secondary, in which case a primary server won't be detected.

    Even without a network split, cooperative_monitoring_locks=majority_of_all will lead to neither monitor claiming lock majority once too many servers go down. This scenario is depicted in the image below. Only two out of four servers are running when three are needed for the majority. Although both MaxScales see both running servers, neither is certain they have majority and the cluster stays in read-only mode. If the primary server is down, no failover is performed either.

    No majority: both MaxScale instances see the same two reachable servers, so neither can lock a majority and both remain secondary.

    Setting cooperative_monitoring_locks=majority_of_running changes the way n_servers is calculated. Instead of using the total number of servers, only servers currently [Running] are considered. This scheme adapts to multiple servers going down, ensuring that claiming lock majority is always possible. However, it can lead to multiple monitors claiming primary status in a split-brain situation. As an example, consider a cluster with servers 1 to 4 with MaxScales A and B, as in the image below. MaxScale A can connect to servers 1 and 2 (and claim their locks) but not to servers 3 and 4 due to a network split. MaxScale A thus assumes servers 3 and 4 are down. MaxScale B does the opposite, claiming servers 3 and 4 and assuming 1 and 2 are down. Both MaxScales claim two locks out of two available and assume that they have lock majority. Both MaxScales may then promote their own primaries and route writes to different servers.

    Split brain: a broken heartbeat between datacenters lets both MaxScale A and MaxScale B act as primary at once, each locking its own read-write server.

    The recommended strategy depends on which failure scenario is more likely and/or more destructive. If it's unlikely that multiple servers are ever down simultaneously, then majority_of_all is likely the safer choice. On the other hand, if split-brain is unlikely but multiple servers may be down simultaneously, then majority_of_running would keep the cluster operational. For step-by-step walkthroughs of each mode during a failover and during a network partition, and for how they compare with an active/passive pair, see .

    To check if a monitor is primary, fetch monitor diagnostics with maxctrl show monitors or the REST API. The boolean field primary indicates whether the monitor has lock majority on the cluster. If cooperative monitoring is disabled, the field value is null. Lock information for individual servers is listed in the server-specific field lock_held. Again, null indicates that locks are not in use or the lock status is unknown.

    If a MaxScale instance tries to acquire the locks but fails to get majority (perhaps another MaxScale was acquiring locks simultaneously) it will release any acquired locks and try again after a random number of monitor ticks. This prevents multiple MaxScales from fighting over the locks continuously as one MaxScale will eventually wait less time than the others. Conflict probability can be further decreased by configuring each monitor with a different monitor_interval.

    The flowchart below illustrates the lock handling logic.

    MariaDB Monitor cooperative locking: on each tick, a MaxScale that holds (or can acquire) a majority of server locks becomes primary; otherwise it releases any locks and continues as secondary.

    Monitor cooperation depends on the server locks. The locks are connection-specific. The owning connection can manually release a lock, allowing another connection to claim it. Also, if the owning connection closes, the MariaDB Server process releases the lock. How quickly a lost connection is detected affects how quickly the primary monitor status moves from one monitor and MaxScale to another.

    If the primary MaxScale or its monitor is stopped normally, the monitor connections are properly closed, releasing the locks. This allows the secondary MaxScale to quickly claim the locks. However, if the primary simply vanishes (broken network), the connection may just look idle. In this case, the MariaDB Server may take a long time before it considers the monitor connection lost. This time ultimately depends on TCP keepalive settings on the machines running MariaDB Server.

    On MariaDB Server 10.3.3 and later, the TCP keepalive settings can be configured for just the server process. See for information on settings tcp_keepalive_interval, tcp_keepalive_probes and tcp_keepalive_time. These settings can also be set on the operating system level, as described .

    As of MaxScale 6.4.16, 22.08.13, 23.02.10, 23.08.6 and 24.02.2, configuring TCP keepalive is no longer necessary as the monitor sets the session wait_timeout variable when acquiring a lock. This causes the MariaDB Server to close the monitor connection if the connection appears idle for too long. The value of wait_timeout used depends on the monitor interval and connection timeout settings, and is logged at MaxScale startup.

    A monitor can also be ordered to manually release its locks via the module command release-locks. This is useful for manually changing the primary monitor. After running the release-command, the monitor will not attempt to reacquire the locks for one minute, even if it wasn't the primary monitor to begin with. This command can cause the cluster to become temporarily unusable by MaxScale. Only use it when there is another monitor ready to claim the locks.

    Some backend failures are not observable just by connecting to the server and running standard monitor queries. A server may be connectable and respond to queries sent by the monitor, but its disk could be full or malfunctioning or the storage engine could be locked in some way. Normally, MariaDB Monitor would consider such a server to be in good health, even if in reality the server could not perform any writes.

    To detect such errors, MariaDB Monitor can be configured to perform a regular write test if the gtid_binlog_pos of the primary server is not advancing otherwise. Testing that writes are going through and are being saved to the binary log increases the chance of detecting storage failures. The monitor can also be configured to perform a failover if the primary server fails the write test. Even this test may miss storage issues, as the monitor write test performs a small insert that may go through even when a large write done by a real application does not.

    See the following configuration parameters for more information on how to configure this feature.

    • Type:

    • Dynamic: Yes

    • Default: 0s

    If enabled (value > 0s), the monitor will perform a write test on the primary server if its gtid_binlog_pos has not changed within the configured interval. This test inserts one row to the table configured in . If the insert fails or does not complete within , the server fails the write test. What happens after that depends on .

    • Type: string

    • Dynamic: Yes

    • Default: mxs.maxscale_write_test

    The write test target table. The table name should be fully qualified i.e. include the database name. If the table does not exist or does not contain expected columns, the monitor (re)creates it. The table is created with a query like

    The database must be created manually. The monitor user requires privileges to create, drop, read and manipulate the table:

    • Type:

    • Default: log

    • Values: log, failover

    Which action to take if the primary server fails the write test. log means that MaxScale will simply log the failure but perform no other action. This is mainly useful for testing the feature.

    If set to failover, the monitor will perform a failover if the primary server fails the write test consecutive times. That is, the first write test is performed after write_test_interval has passed without writes. If the test fails, the monitor will repeat the test during the next monitor tick. After failcount monitor ticks with failed write tests, failover begins. After failover, the former primary server is set into maintenance mode. Manual intervention is required to take the server into use again.

    Backup operations manipulate the contents of a MariaDB Server, saving it or overwriting it. MariaDB-Monitor supports three backup operations:

    1. rebuild-server: Replace the contents of a database server with the contents of another. Launched with the async-rebuild-server command.

    2. create-backup: Copy the contents of a database server to a storage location. Launched with the async-create-backup command.

    These operations do not modify server config files, only files in the data directory (typically /var/lib/mysql) are affected.

    All of these operations are monitor commands and best launched with MaxCtrl. The operations are asynchronous, which means MaxCtrl won't wait for the operation to complete and instead immediately returns "OK". To see the current status of an operation, either check MaxScale log or use the fetch-cmd-result-command (e.g. maxctrl call command mariadbmon fetch-cmd-result MyMonitor).

    Because these operations are always run asynchronously, the MaxCtrl command name is prefixed with async- (for example, async-rebuild-server). The unprefixed name (for example, rebuild-server) is the operation's name as it appears in the MaxScale log and in fetch-cmd-result output; it is not a separate command you can run.

    To perform backup operations, MaxScale requires ssh-access on all affected machines. The ssh_user and ssh_keyfile-settings define the SSH credentials MaxScale uses to access the servers. MaxScale must be able to run commands with sudo on both the source and target servers. See and below for more information.

    The following tools need to be installed on the backends:

    1. mariadb-backup. Backs up and restores MariaDB Server contents. Installed e.g. with yum install MariaDB-backup. See for more information.

    2. pigz. Compresses and decompresses the backup stream. Installed e.g. withyum install pigz.

    3. socat. Streams data from one machine to another. Is likely already installed. If not, can be installed e.g. with yum install socat

    mariadb-backup needs server credentials to log in and authenticate to the MariaDB Server being copied from. For this, MaxScale uses the monitor user. The monitor user may thus require additional privileges. See for more details.

    The rebuild server-operation replaces the contents of a database server with the contents of another server. The source server is effectively cloned and all data on the target server is lost. This is useful when a replica server has diverged from the primary server, or when adding a new server to the cluster. MaxScale performs this operation by running mariadb-backup on both the source and target servers.

    Run this operation with the async-rebuild-server command. In the MaxScale log and in fetch-cmd-result output it is referred to by its operation name, rebuild-server.

    Verify SSH Connectivity

    The async rebuild server operation requires SSH to be correctly configured between the MaxScale host and all the database servers. Before starting a rebuild operation, it is important to ensure that MaxScale can interact with the database servers over SSH without generating any unwanted or additional output during login or logout. The rebuild process may encounter a non-specific issue or fail without a descriptive error message due to interference from shell configuration files (such as .bashrc, .profile, etc.) on the database servers that print text during login.

    Hence, before using the async rebuild server feature, verify that SSH output is clean by running the following command on the MaxScale host:

    The output must contain only the hostname of the database server without any additional text, lines, or errors.

    Example of correct output:

    If any additional text or unwanted output appears in the output (from .bashrc, /etc/profile, or any custom login scripts), the async rebuild server operation may fail without providing a clear descriptive error message.

    Verify Backup User Privileges

    The MariaDB monitor user (specified by user and password parameters) must have sufficient privileges to run mariadb-backup command locally on both the source and target database nodes via SSH before starting the rebuild operation.

    Before launching the operation, run the following command to verify that the monitor user can perform a backup manually on the database server:

    Expected The command should run without errors and create a backup in the specified directory.

    In the event the command fails with authentication errors, you may need to grant privileges for maxscale@% and maxscale@localhost, as the backup command may connect locally. For example:

    Once the privileges are granted, you can run the test command again to verify it works properly.

    Rebuild Operation Steps

    When launched, the rebuild operation proceeds as below. If any step fails, the operation is stopped and the target server will be left in an unspecified state.

    1. Log in to both servers with ssh and check that the tools listed above are present (e.g. mariadb-backup -v should succeed).

    2. Check that the port used for transferring the backup is free on the source server. If not, kill the process holding it. This requires running lsof and killing.

    3. Test the connection by streaming a short message from the source host to the target.

    The rebuild-operation is a monitor module command and takes four arguments:

    1. Monitor name, e.g. MyMonitor.

    2. Target server name, e.g. MyTargetServer.

    3. Source server name, e.g. MySourceServer. This parameter is optional. If not specified, the monitor prefers to autoselect an up-to-date replica server to avoid increasing load on the primary server. Due to the--safe-slave-backup-option, the replica will stop replicating until the backup data has been transferred.

    The following example rebuilds MyTargetServer with contents of MySourceServer.

    The following example uses a custom data directory on the target.

    The operation does not launch if the target server is already replicating or if the source server is not a primary or replica.

    Steps 6 and 8 can take a long time depending on the size of the database and if writes are ongoing. During these steps, the monitor will continue monitoring the cluster normally. After each monitor tick the monitor checks if the rebuild-operation can proceed. No other monitor operations, either manual or automatic, can run until the rebuild completes.

    In addition to traditional argument passing, rebuild-server supports key-value arguments. The supported arguments are:

    argument
    type
    default
    description

    The dry_run-argument causes the monitor to only check if preconditions for rebuild are met on the source and target servers. It checks that SSH- connections can be established and that required tools are present on the servers. No permanent changes are done.

    The following example checks if MyServer1 can be rebuilt from the contents of MyServer2.

    The create backup-operation copies the contents of a database server to the backup storage. The source server is not modified but may slow down during backup creation. MaxScale performs this operation by running mariadb-backup on both the source and storage servers. The storage location is defined by the backup_storage_address and backup_storage_path settings. Normal ssh-settings are used to access the storage server. The backup storage machine does not need to have a MariaDB Server installed.

    Run this operation with the async-create-backup command. In the MaxScale log and in fetch-cmd-result output it is referred to by its operation name, create-backup.

    Backup creation runs somewhat similar to rebuild-server. The main difference is that the backup data is simply saved to a directory and not prepared or used to start a MariaDB Server. If any step fails, the operation is stopped and the backup storage directory will be left in an unspecified state.

    1. Init. See rebuild-server.

    2. Check listen port on the backup storage machine. See rebuild-server.

    3. Check that the backup storage main directory exists. Check that it does not contain a backup with the same name as the one being created. Create the final backup directory.

    Backup creation is a monitor module command and takes three arguments: the monitor name, source server name and backup name. Backup name defines the subdirectory where the backup is saved and should be a valid directory name. The command

    would save the backup of MySourceServer to <backup_storage_path>/wednesday_161122 on the host defined in backup_storage_address. ssh_user needs to have read and write access to the main storage directory. The source server must be a primary or replica.

    Similar to rebuild-server, the monitor will continue monitoring the servers while the backup is transferred.

    In addition to traditional argument passing, create-backup supports key-value arguments. The supported arguments are:

    argument
    type
    default
    description

    The dry_run-argument causes the monitor to only check if preconditions for backup creation are met on the source server and backup storage. It checks that SSH-connections can be established and that required tools are present. The backup storage must also not yet have a backup with the given name. No permanent changes are done.

    The following example checks that MyServer1 can be backed up.

    The restore-operation is the reverse of create-backup. It overwrites the contents of an existing MariaDB Server with a backup from the backup storage. The backup is not removed and can be used again. MaxScale performs this operation by transferring the backup contents as a tar archive and overwriting the target server data directory. The backup storage is defined in monitor settings similar to create-backup.

    Run this operation with the async-restore-from-backup command. In the MaxScale log and in fetch-cmd-result output it is referred to by its operation name, restore-from-backup.

    The restore-operation runs somewhat similar to rebuild-server. The main difference is that the backup data is copied with tar instead of mariadb-backup. If any step fails, the operation is stopped and the target server will be left in an unspecified state.

    1. Init. See rebuild-server.

    2. Check listen port on the target machine. See rebuild-server.

    3. Check that the backup storage main directory exists and that it contains a backup with the name requested.

    Server restoration is a monitor module command and takes four arguments.

    1. Monitor name, e.g. MyMonitor.

    2. Target server name, e.g. MyNewServer.

    3. Backup name. This parameter defines the subdirectory where the backup is read from and should be an existing directory on the backup storage host.

    The command

    would erase the contents of MyTargetServer and replace them with the backup contained in <backup_storage_path>/wednesday_161122 on the host defined in backup_storage_address. ssh_user needs to have read access to the main storage directory and the backup. The target server must not be a primary or replica.

    The following example uses a custom data directory on the target.

    Similar to rebuild-server, the monitor will continue monitoring the servers while the backup is transferred and prepared.

    In addition to traditional argument passing, restore-from-backup supports key-value arguments. The supported arguments are:

    argument
    type
    default
    description

    The dry_run-argument causes the monitor to only check if preconditions for restore are met on the target server and backup storage. It checks that SSH-connections can be established and that required tools are present. The backup storage must also have a backup with the given name. No permanent changes are done.

    The following example checks if MyServer1 can be restored.

    call command mariadbmon async-create-backup monitor=MariaDB-Monitor source=server1 dry_run=true bu_name=bu1

    The list-backups command lists currently available backups in the backup storage.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    Ssh username. Used when logging in to backend servers to run commands.

    • Type: path

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    Path to file with an ssh private key. Used when logging in to backend servers to run commands.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    Boolean, default: true. When logging in to backends, require that the server is already listed in the known_hosts-file of the user running MaxScale.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 10s

    The rebuild operation consists of multiple ssh commands. Most of the commands are assumed to complete quickly. If these commands take more than ssh_timeout to complete, the operation fails. Adjust this setting if rebuild fails due to ssh commands timing out. This setting does not affect steps 5 and 6, as these are assumed to take significant time.

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 22

    SSH port. Used for running remote commands on servers.

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 4444

    The port which the source server listens on for a connection. The port must not be blocked by a firewall or listened on by any other program. If another process is listening on the port when rebuild is starting, MaxScale will attempt to kill the process.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: 1G

    Given as is tomariadb-backup --prepare --use-memory=<mariadb_backup_use_memory>. If set to empty, no --use-memory is set and mariadb-backup will use its internal default. See for more information.

    Starting with MaxScale 24.02.7, the old name mariabackup_use_memory has been deprecated and replaced with mariadb_backup_use_memory. The old name is valid and will continue working as an alias.

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 1

    Given as is tomariadb-backup --backup --parallel=<val>. Defines the number of threads used for parallel data file transfer. See for more information.

    Starting with MaxScale 24.02.7, the old name mariabackup_parallel has been deprecated and replaced with mariadb_backup_parallel. The old name is valid and will continue working as an alias.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    Address of the backup storage. Does not need to have MariaDB Server running or be monitored by the monitor. Connected to with ssh. Must have enough disk space to store all backups.

    • Type: path

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    Path to main backup storage directory on backup storage host. ssh_user needs to have full access to this directory to save and read backups.

    If giving MaxScale general sudo-access is out of the question, MaxScale must be allowed to run the specific commands required by the backup operations. This can be achieved by creating a file with the commands in the/etc/sudoers.d-directory. In the example below, the user johnny is given the power to run commands as root. The contents of the file may need to be tweaked due to changes in install locations.

    Since MaxScale version 22.08, MariaDB Monitor can run ColumnStore administrative commands against a ColumnStore cluster. The commands interact with the ColumnStore REST-API present in recent ColumnStore versions and have been tested with MariaDB-Server 10.6 running the ColumnStore plugin version 6.2. None of the commands affect monitor configuration or replication topology. MariaDB Monitor simply relays the commands to the backend cluster.

    MariaDB Monitor can fetch cluster status, add and remove nodes, start and stop the cluster, and set cluster read-only or readwrite. MaxScale only communicates with the first server in the servers-list.

    Most of the commands are asynchronous, i.e. they do not wait for the operation to complete on the ColumnStore backend before returning to the command prompt. MariaDB Monitor itself, however, runs the command in the background and does not perform normal monitoring until the operation completes or fails. After an operation has started the user should use fetch-cmd-result to check its status. The examples below show how to run the commands using MaxCtrl. If a command takes a timeout-parameter, the timeout can be given in seconds (s), minutes (m) or hours (h).

    ColumnStore command settings are listed . At leastcs_admin_api_key must be set.

    Fetch cluster status. Returns the result as is. Status fetching has an automatic timeout of ten seconds.

    Examples:

    Add or remove a node to/from the ColumnStore cluster.

    <node-host> is the hostname or IP of the node being added or removed.

    Examples:

    Examples:

    Examples:

    Numeric, default: 8640. The REST-API port on the ColumnStore nodes. All nodes are assumed to listen on the same port.

    String. The API-key MaxScale sends to the ColumnStore nodes when making a REST-API request. Should match the value configured on the ColumnStore nodes.

    String, default: /cmapi/0.4.0. Base path sent with the REST-API request.

    Fetches the result of the last manual command. Requires monitor name as parameter. Most commands only return a generic success message or an error description. ColumnStore commands may return more data. Scheduling another command clears a stored result.

    Fetches the detailed status of the currently running manual command. If no command is running, fetches status of the last completed manual command. The results are returned as a json array, with each array element containing information on one phase of a manual command. Only backup operations currently support this detailed status information.

    Fetch-cmd-status is meant for internal use and the data it returns is subject to change. It accepts the following key-value argument:

    argument
    type
    default
    description

    Cancels the latest operation, whether manual or automatic, if possible. Requires monitor name as parameter. A scheduled manual command is simply canceled before it can run. If a command is already running, it stops as soon as possible. The cancel-cmd itself does not wait for a running operation to stop. Use fetch-cmd-result or check the log to see if the operation has truly completed. Canceling is most useful for stopping a stalled rebuild operation.

    See the .

    Before performing failover or switchover, the monitor checks that prerequisites are fulfilled, printing any errors and warnings found. This should catch and explain most issues with failover or switchover not working. If the operations are attempted and still fail, then most likely one of the commands the monitor issued to a server failed or timed out. The log should explain which query failed.

    A typical failure reason is that a command such as STOP SLAVE takes longer than thebackend_read_timeout of the monitor, causing the connection to break. As of 2.3, the monitor will retry most such queries if the failure was caused by a timeout. The retrying continues until the total time for a failover or switchover has been spent. If the log shows warnings or errors about commands timing out, increasing the backend timeout settings of the monitor should help. Other settings to look at are query_retries and query_retry_timeout. These are general MaxScale settings described in the . Setting query_retries to 2 is a reasonable first try.

    If switchover causes the old primary (now replica) to fail replication, then most likely a user or perhaps a scheduled event performed a write while the monitor had set read_only=1. This is possible if the user performing the write has "SUPER" or "READ_ONLY ADMIN" privileges. The switchover-operation tries to kick out SUPER-users but this is not certain to succeed. Remove these privileges from any users that regularly do writes to prevent them from interfering with switchover.

    The server configuration files should have log-slave-updates=1 to ensure that a newly promoted primary has binary logs of previous events. This allows the new primary to replicate past events to any lagging replicas.

    To print out all queries sent to the servers, start MaxScale with--debug=enable-statement-logging. This setting prints all queries sent to the backends by monitors and authenticators. The printed queries may include usernames and passwords.

    If a replica is shown in maxctrl as "Slave of External Server" instead of "Slave", the reason is likely that the "Master_Host"-setting of the replication connection does not match the MaxScale server definition. As of 2.3.2, the MariaDB Monitor by default assumes that the replica connections (as shown by SHOW ALL SLAVES STATUS) use the exact same "Master_Host" as used in the MaxScale configuration file server definitions. This is controlled by the setting .

    Since MaxScale 2.2 it's possible to detect a replication setup which includes Binlog Server: the required action is to add the binlog server to the list of servers only if master_id identity is set.

    This page is licensed: CC BY-SA / Gnu FDL

    It was previously part of a multiprimary group but is no longer, or the multiprimary group is replicating from a server not in the group.
    ,
    connecting_slave
    ,
    connected_slave
    ,
    running_slave
    ,
    primary_monitor_master
    ,
    disk_space_ok
  • Default: primary_monitor_master, disk_space_ok

  • running_slave : Same as connecting_slave, with the addition that the replica must also be Running.

  • primary_monitor_master : If this MaxScale is cooperating with another MaxScale and this is the secondary MaxScale, requiring that the candidate primary is selected also by the primary MaxScale.

  • disk_space_ok : The candidate primary must not be low on disk space. This option only takes effect if disk space check is enabled. Added in MaxScale 23.08.5.

  • ,
    linked_master
    ,
    running_master
    ,
    writable_master
    ,
    primary_monitor_master
  • Default: none

  • writable_master : The primary must be writable, i.e. labeled Master.
  • primary_monitor_master : If this MaxScale is cooperating with another MaxScale and this is the secondary MaxScale, requiring that the candidate primary is selected also by the primary MaxScale.

  • disk_space_ok : The replica must not be low on disk space. This option only takes effect if disk space check is enabled. Added in MaxScale 23.08.5.

  • ,
    majority_of_all
    ,
    majority_of_running
  • Default: none

  • Default: None
    switchover-force, which swaps a running primary with a replica, ignoring most errors. Can break replication.
  • async-switchover, which schedules a switchover and returns

  • rejoin, which directs servers to replicate from the primary

  • reset-replication (added in MaxScale 2.3.0), which deletes binary logs and resets gtid:s

  • PROCESS, to check if the event_scheduler process is running
  • SHOW DATABASES and EVENT, to list and modify server events

  • SELECT on mysql.user, to see which users have SUPER

  • SELECT on mysql.global_priv so see to see which users have READ_ONLY ADMIN

  • PROCESS, to check if the event_scheduler process is running
  • SHOW DATABASES, EVENT and SET USER, to list and modify server events

  • BINLOG ADMIN, to delete binary logs (during reset-replication)

  • CONNECTION ADMIN, to kill connections

  • SELECT on mysql.user, to see which users have SUPER

  • SELECT on mysql.global_priv so see to see which users have READ_ONLY ADMIN

  • log_slave_updates is on

  • disk space is not low

  • If the new primary has unprocessed relay log items, cancel and try again later.

  • Prepare the new primary:

    • Remove the replica connection the new primary used to replicate from the old primary.

    • Disable the read_only-flag.

    • Enable scheduled server events (if event handling is on). Only events that were enabled on the old primary are enabled.

    • Run the commands in promotion_sql_file.

    • Start replication from external primary if one exists.

  • Redirect all other replicas to replicate from the new primary:

    • STOP SLAVE

    • CHANGE MASTER TO

    • START SLAVE

  • Check that all replicas are replicating.

  • Enable the read_only-flag to stop writes from normal users.
  • Kill connections from super and read-only admin users since read_only does not affect them. During this step, all writes are blocked with "FLUSH TABLES WITH READ LOCK".

  • Disable scheduled server events (if event handling is on).

  • Run the commands in demotion_sql_file.

  • Flush the binary log ("flush logs") so that all events are on disk.

  • Wait a moment to check that gtid is stable.

  • Wait for the new primary to catch up with the old primary.

  • Promote new primary and redirect replicas as in failover steps 3 and 4. Also redirect the demoted old primary.

  • Check that all replicas are replicating.

  • Start replication: CHANGE MASTER TO and START SLAVE.

    false

    Run command asynchronously

    replica

    server

    none (mandatory)

    Server to redirect

    new_primary

    server

    none (mandatory)

    New primary for the replica

    conn_name

    string

    empty

    Replica connection name

  • Delete binary logs (RESET MASTER).

  • Set the sequence number of gtid_slave_pos to zero. This also affects gtid_current_pos.

  • Prepare new primary:

  • Disable the read_only-flag.

  • Enable scheduled server events (if event handling is on). Events are only enabled if the cluster had a primary server when starting the reset-replication operation. Only events that were enabled on the previous primary are enabled on the new.

  • Direct other servers to replicate from the new primary as in the other operations.

  • false

    Run command asynchronously

    false

    Run command asynchronously

    remove

    boolean

    false

    Remove shut down or non-replicating servers

    false

    Run command asynchronously

    template

    server

    empty

    Server settings template

    address

    string

    none (mandatory)

    Scan starting address

    port

    number

    3306

    Scan starting port

    are server names as described above for MaxCtrl. Only switchover accepts both, failover doesn't need any and both rejoin and reset-replication accept one.

    empty (autoselect)

    Which server to promote

    old_primary

    server

    empty (autoselect)

    Which server to demote

    async

    boolean

    false

    Run command asynchronously

    force

    boolean

    false

    Ignore most errors

    old_primary_maint

    boolean

    false

    Leave old primary to maintenance

    ,
    on
    ,
    yes
    ,
    1
    ,
    false
    ,
    off
    ,
    no
    ,
    0
    ,
    safe
  • Default: false

  • Default: false
    R1 comes back up. Monitor rejoins it to the cluster, so that R1 replicates from R2.
  • Failback switchover does not trigger, as P is still the failback primary and it's down.

  • Some time later, P comes back online. Monitor rejoins it to the cluster.

  • If P successfully replicates from R2 (no diverged histories) and catches up, the monitor runs switchover to restore P as primary.

  • Default: false

    Dynamic: Yes

    restore-from-backup: Overwrite the contents of a database server with a backup. Launched with the async-restore-from-backup command.
    .

    Launch mariadb-backup on the source machine, compress the stream and listen for an incoming connection. This is performed with the following command: mariadb-backup --backup --safe-slave-backup --stream=xbstream --parallel=1 | pigz -c | socat - TCP-LISTEN:<port>. Note: MaxScale uses the user and password parameters specified in the monitor configuration to authenticate to MariaDB. Before initiating the async rebuild server process, ensure this user has the sufficient privileges on both the source and target servers. See the Verify Backup User Privileges section for details and example grant statements.

  • Ask the target server what its data directory is (select @@datadir;). Stop MariaDB Server on the target machine and delete all contents of the data directory.

  • On the target machine, connect to the source machine, read the backup stream, decompress it and write to the data directory. This is performed with a command like socat -u TCP:<host>:<port> STDOUT | pigz -dc | mbstream -x. This step can take a long time if there is much data to transfer.

  • Check that the data directory on the target machine is not empty, i.e. that the transfer at least appears to have succeeded.

  • Prepare the backup on the target server with a command like: mariadb-backup --use-memory=1G --prepare. This step can also take some time if the source server performs writes during data transfer.

  • On the target server, change ownership of datadir contents to the mysql-user and start MariaDB-server.

  • Read gtid from the data directory. Have the target server start replicating from the primary if it is not one already.

  • Data directory on target server. This parameter is optional. If not specified, the monitor will ask the target server. If the target server is not running, the monitor will assume /var/lib/mysql. Thus, this only needs to be defined with non-standard directory setups.

    none (mandatory)

    Which server to rebuild

    source

    server

    empty (autoselect)

    Which server to copy data from

    datadir

    string

    empty (autodetect)

    Data directory on target server

    dry_run

    boolean

    false

    If true, only check preconditions

    Test the connection by streaming a short message from the source host to the backup storage.
  • Serve backup on source. Similar to rebuild-server step 4.

  • Transfer backup directly to the final storage directory. Similar to rebuild-server step 5.

  • Check that the copied backup data looks ok.

  • none (mandatory)

    Which server to copy data from

    bu_name

    string

    none (mandatory)

    Backup name

    dry_run

    boolean

    false

    If true, only check preconditions

    Test the connection by streaming a short message from the backup storage to the target machine.
  • On the backup storage machine, compress the backup with tar and serve it with socat, listening for an incoming connection. This is performed with a command like tar -zc -C <backup_dir> . | socat - TCP-LISTEN:<port>.

  • Ask the target server what its data directory is (select @@datadir;). Stop MariaDB Server on the target machine and delete all contents of the data directory.

  • On the target machine, connect to the source machine, read the backup stream, decompress it and write to the data directory. This is performed with a command like socat -u TCP:<host>:<port> STDOUT | sudo tar -xz -C /var/lib/mysql/. This step can take a long time if there is much data to transfer.

  • From here on, the operation proceeds as from rebuild-server step 7.

  • Data directory on target server. This parameter is optional. If not specified, the monitor will ask the target server. If the target server is not running, the monitor will assume /var/lib/mysql. Thus, this only needs to be defined with non-standard directory setups.

    none (mandatory)

    Which server to rebuild

    bu_name

    string

    none (mandatory)

    Backup name

    datadir

    string

    empty (autodetect)

    Data directory on target server

    dry_run

    boolean

    false

    If true, only check preconditions

    '
    mariadbmon-password
    '
    ;
    GRANT REPLICA MONITOR ON *.* TO 'mariadbmon'@'maxscalehost';
    '
    mariadbmon-password
    '
    ;
    GRANT REPLICATION CLIENT ON *.* TO 'mariadbmon'@'maxscalehost';
    GRANT CONNECTION ADMIN ON *.* TO 'mariadbmon'@'maxscalehost';
    GRANT REPLICATION MASTER ADMIN ON *.* TO 'mariadbmon'@'maxscalehost';
    GRANT REPLICATION SLAVE ON *.* TO 'mariadbmon'@'maxscalehost';
    GRANT EVENT, SHOW DATABASES ON *.* TO 'mariadbmon'@'maxscalehost';
    CREATE USER 'replication'@'replicationhost' IDENTIFIED BY 'replication-password';
    GRANT REPLICATION REPLICA ON *.* TO 'replication'@'replicationhost';
    CREATE USER 'replication'@'replicationhost' IDENTIFIED BY 'replication-password';
    GRANT REPLICATION SLAVE ON *.* TO 'replication'@'replicationhost';
    [MyMonitor]
    type=monitor
    module=mariadbmon
    servers=server1,server2,server3
    user=myuser
    password=mypwd
    master_conditions=connected_slave,running_slave
    slave_conditions=running_master,writable_master
    (monitor_interval + backend_timeout) * failcount
    maxctrl clear server server2 Maint
    servers_no_cooperative_monitoring_locks=backup_dc_server1,backup_dc_server2
    call command mariadbmon failover MONITOR
    call command mariadbmon failover-safe MONITOR
    call command mariadbmon switchover MONITOR [NEW_PRIMARY] [OLD_PRIMARY]
    call command mariadbmon switchover-force MONITOR [NEW_PRIMARY] [OLD_PRIMARY]
    call command mariadbmon rejoin MONITOR OLD_PRIMARY

    monitor

    monitor

    none (mandatory)

    Monitor name

    async

    call command mariadbmon redirect monitor=MyMonitor replica=MyServer2 new_primary=MyServer3
    maxctrl call command mariadbmon reset-replication MONITOR [NEW_PRIMARY]

    monitor

    monitor

    none (mandatory)

    Monitor name

    async

    maxctrl call command mariadbmon scan-topology monitor=MyMonitor
    {
        "results": [
            {
                "host": "192.168.0.1",
                "id": 100,
                "monitor_name": "MyMonitor",
                "port": 3306,
                "primaries": [],
                "replicas": [
                    300,
                    200
                ],
                "server_name": "MyServer1"
            },
            {
                "host": "192.168.0.2",
                "id": 200,
                "monitor_name": "MyMonitor",
                "port": 3306,
                "primaries": [
                    100
                ],
                "replicas": [],
                "server_name": "MyServer2"
            }
        ]
    }

    monitor

    monitor

    none (mandatory)

    Monitor name

    async

    maxctrl call command mariadbmon discover-replicas monitor=MyMonitor remove=true

    monitor

    monitor

    none (mandatory)

    Monitor name

    async

    maxctrl create server MyServerTemplate address=123.123.123.123 port=1111 ssl=true ssl_ca=/certs/ca.crt
    maxctrl call command mariadbmon bootstrap monitor=MyMonitor template=MyServerTemplate address=192.168.0.4
    maxctrl call command mariadbmon failover MyMonitor
    maxctrl call command mariadbmon failover-safe MyMonitor
    maxctrl call command mariadbmon rejoin MyMonitor OldPrimaryServ
    maxctrl call command mariadbmon reset-replication MyMonitor
    maxctrl call command mariadbmon reset-replication MyMonitor NewPrimaryServ
    maxctrl call command mariadbmon switchover MyMonitor
    maxctrl call command mariadbmon switchover MyMonitor NewPrimaryServ
    maxctrl call command mariadbmon switchover MyMonitor NewPrimaryServ OldPrimaryServ
    maxctrl call command mariadbmon switchover-force MyMonitor NewPrimaryServ
    /v1/maxscale/modules/mariadbmon/<operation>?<monitor-name>&<server-name1>&<server-name2>
    [Cluster1]
    type=monitor
    module=mariadbmon
    servers=server1, server2, server3, server 4
    ...
    /v1/maxscale/modules/mariadbmon/switchover?Cluster1&server4&server2
    /v1/maxscale/modules/mariadbmon/failover?Cluster1
    /v1/maxscale/modules/mariadbmon/rejoin?Cluster1&server3
    /v1/maxscale/modules/mariadbmon/reset-replication?Cluster1&server3
    maxctrl call command mariadbmon async-switchover Cluster1
    OK
    maxctrl call command mariadbmon fetch-cmd-result Cluster1
    {
        "links": {
            "self": "http://localhost:8989/v1/maxscale/modules/mariadbmon/fetch-cmd-result"
        },
        "meta": "switchover completed successfully."
    }

    monitor

    monitor

    none (mandatory)

    Monitor name

    new_primary

    maxctrl call command mariadbmon switchover monitor=MyMonitor new_primary=MyServer2 async=1 force=1
    maxctrl call command mariadbmon switchover monitor=MyMonitor old_primary_maint=1
    switchover_on_low_disk_space=true
    enforce_simple_topology=true
    replication_custom_options=MASTER_SSL_CERT = '/tmp/certs/client-cert.pem',
                               MASTER_SSL_KEY = '/tmp/certs/client-key.pem',
                               MASTER_SSL_CA = '/tmp/certs/ca.pem',
                               MASTER_SSL_VERIFY_SERVER_CERT=0
    servers_no_promotion=backup_dc_server1,backup_dc_server2
    promotion_sql_file=/home/root/scripts/promotion.sql
    demotion_sql_file=/home/root/scripts/demotion.sql
    maxctrl call command mariadbmon release-locks MyMonitor1
    write_test_interval=20s
    CREATE OR REPLACE TABLE mxs.maxscale_write_test
    (id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
    `date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    `gtid` TEXT NULL);
    GRANT SELECT, INSERT, DELETE, CREATE, DROP ON `mxs`.* TO 'maxscale'@'maxscalehost';
    write_test_table=mxs.my_write_test_table
    ssh -i /home/maxscale/.ssh/<private_key_filename> root@<db_host_ip> hostname
    dbserver01
    /usr/bin/mariabackup \
      --user=<monitor_user> \
      --password=<password> \
      --backup \
      --safe-slave-backup \
      --target-dir=<backup_directory>
    -- For remote connections
    GRANT RELOAD, PROCESS, FILE, SHOW DATABASES, SUPER, BINLOG MONITOR, EVENT, CONNECTION ADMIN, SLAVE MONITOR, REPLICATION MASTER ADMIN, REPLICATION SLAVE ADMIN ON *.* TO 'maxscale'@'%' IDENTIFIED BY 'password';
    
    -- For local connections during backup
    GRANT RELOAD, PROCESS, LOCK TABLES, BINLOG MONITOR ON *.*
          TO 'maxscale'@'localhost' IDENTIFIED BY 'password';
    maxctrl call command mariadbmon async-rebuild-server MyMonitor MyTargetServer MySourceServer
    maxctrl call command mariadbmon async-rebuild-server MyMonitor MyTargetServer MySourceServer /my_datadir

    monitor

    monitor

    none (mandatory)

    Monitor name

    target

    $ maxctrl call command mariadbmon async-rebuild-server monitor=MyMonitor target=MyServer1 source=MyServer2 dry_run=true
    OK
    $ maxctrl call command mariadbmon fetch-cmd-result MyMonitor
    "rebuild-server completed successfully."
    maxctrl call command mariadbmon async-create-backup MyMonitor MySourceServer wednesday_161122

    monitor

    monitor

    none (mandatory)

    Monitor name

    source

    $ maxctrl call command mariadbmon async-create-backup monitor=MyMonitor source=MyServer1 bu_name=mybackup2 dry_run=true
    OK
    $ maxctrl call command mariadbmon fetch-cmd-result MyMonitor
    "create-backup completed successfully."
    maxctrl call command mariadbmon async-restore-from-backup MyMonitor MyTargetServer wednesday_161122
    maxctrl call command mariadbmon async-restore-from-backup MyMonitor MyTargetServer wednesday_161122 /my_datadir

    monitor

    monitor

    none (mandatory)

    Monitor name

    target

    $ maxctrl call command mariadbmon async-restore-from-backup monitor=MyMonitor target=MyServer2 bu_name=mybackup2 dry_run=true
    OK
    $ maxctrl call command mariadbmon fetch-cmd-result MyMonitor
    "restore-from-backup completed successfully."
    $ maxctrl call command mariadbmon list-backups monitor=MariaDB-Monitor
    {
        "backups": [
            "bu1",
            "bu2",
            "bu3"
        ]
    }
    mariadb_backup_use_memory=2G
    mariadb_backup_parallel=2
    backup_storage_address=192.168.1.11
    backup_storage_path=/home/maxscale_ssh_user/backup_storage
    johnny ALL= NOPASSWD: /bin/systemctl stop mariadb
    johnny ALL= NOPASSWD: /bin/systemctl start mariadb
    johnny ALL= NOPASSWD: /usr/sbin/lsof
    johnny ALL= NOPASSWD: /bin/kill
    johnny ALL= NOPASSWD: /bin/du
    johnny ALL= NOPASSWD: /usr/bin/mariabackup
    johnny ALL= NOPASSWD: /usr/bin/mariadb-backup
    johnny ALL= NOPASSWD: /bin/mbstream
    johnny ALL= NOPASSWD: /bin/rm -rf /var/lib/mysql/*
    johnny ALL= NOPASSWD: /bin/chown -R mysql\:mysql /var/lib/mysql
    johnny ALL= NOPASSWD: /bin/cat /var/lib/mysql/xtrabackup_binlog_info
    johnny ALL= NOPASSWD: /bin/cat /var/lib/mysql/mariadb_backup_binlog_info
    johnny ALL= NOPASSWD: /bin/tar -xz -C /var/lib/mysql/
    maxctrl call command mariadbmon cs-get-status <monitor-name>
    maxctrl call command mariadbmon async-cs-get-status <monitor-name>
    maxctrl call command mariadbmon cs-get-status MyMonitor
    {
        "mcs1": {
            "cluster_mode": "readwrite",
            "dbrm_mode": "master",
    <snip>
    
    maxctrl call command mariadbmon async-cs-get-status MyMonitor
    OK
    maxctrl call command mariadbmon fetch-cmd-result MyMonitor
    {
        "mcs1": {
            "cluster_mode": "readwrite",
            "dbrm_mode": "master",
    <snip>
    maxctrl call command mariadbmon async-cs-add-node <monitor-name> <node-host> <timeout>
    maxctrl call command mariadbmon async-cs-remove-node <monitor-name> <node-host> <timeout>
    maxctrl call command mariadbmon async-cs-add-node MyMonitor mcs3 1m
    OK
    maxctrl call command mariadbmon fetch-cmd-result MyMonitor
    {
        "node_id": "mcs3",
        "timestamp": "2022-05-05 08:07:51.518268"
    }
    maxctrl call command mariadbmon async-cs-remove-node MyMonitor mcs3 1m
    OK
    maxctrl call command mariadbmon fetch-cmd-result MyMonitor
    {
        "node_id": "mcs3",
        "timestamp": "2022-05-05 10:46:46.506947"
    }
    maxctrl call command mariadbmon async-cs-start-cluster <monitor-name> <timeout>
    maxctrl call command mariadbmon async-cs-stop-cluster <monitor-name> <timeout>
    maxctrl call command mariadbmon async-cs-start-cluster MyMonitor 1m
    OK
    maxctrl call command mariadbmon fetch-cmd-result MyMonitor
    {
        "timestamp": "2022-05-05 09:41:57.140732"
    }
    maxctrl call command mariadbmon async-cs-stop-cluster MyMonitor 1m
    OK
    maxctrl call command mariadbmon fetch-cmd-result MyMonitor
    {
        "mcs1": {
            "timestamp": "2022-05-05 09:45:33.779837"
        },
    <snip>
    maxctrl call command mariadbmon async-cs-set-readonly <monitor-name> <timeout>
    maxctrl call command mariadbmon async-cs-set-readwrite <monitor-name> <timeout>
    maxctrl call command mariadbmon async-cs-set-readonly MyMonitor 30s
    OK
    maxctrl call command mariadbmon fetch-cmd-result MyMonitor
    {
        "cluster-mode": "readonly",
        "timestamp": "2022-05-05 09:49:18.365444"
    }
    maxctrl call command mariadbmon async-cs-set-readwrite MyMonitor 30s
    OK
    maxctrl call command mariadbmon fetch-cmd-result MyMonitor
    {
        "cluster-mode": "readwrite",
        "timestamp": "2022-05-05 09:50:30.718972"
    }
    cs_admin_port=8641
    cs_admin_api_key=somekey123
    maxctrl call command mariadbmon fetch-cmd-result MariaDB-Monitor
    "switchover completed successfully."

    monitor

    monitor

    none (mandatory)

    Monitor name

    maxctrl call command mariadbmon fetch-cmd-status monitor=MariaDB-Monitor
    [
        {
            "name": "rebuild-server",
            "run_status": "scheduled",
            "timestamp": "2025-03-07 07:35:47",
            "unix_timestamp": 1741332947
        },
        {
            "name": "rebuild-server",
            "run_status": "running",
            "state": "initializing",
            "timestamp": "2025-03-07 07:35:47",
            "unix_timestamp": 1741332947
        },
    maxctrl call command mariadbmon cancel-cmd MariaDB-Monitor
    OK

    Cluster Manipulation Grants

    Primary selection

    Configuration

    Common Monitor Settings

    Settings

    assume_unique_hostnames

    private_address

    master_conditions

    slave_conditions

    failcount

    enforce_writable_master

    enforce_read_only_slaves

    enforce_read_only_servers

    maintenance_on_low_disk_space

    cooperative_monitoring_locks

    servers_no_cooperative_monitoring_locks

    script_max_replication_lag

    Cluster manipulation operations

    Operation details

    Failover

    Failover is considered successful if steps 1 to 3 succeed, as the cluster then has at least a valid primary server.

    Failover-safe

    Switchover

    Switchover-force

    Rejoin

    Redirect

    Reset Replication

    Scan topology

    Discover replicas

    Bootstrap

    Manual activation

    Queued switchover

    Switchover with key-value arguments

    Automatic activation

    Limitations and requirements

    External primary support

    Settings for Cluster manipulation operations

    auto_failover

    auto_rejoin

    auto_failback_switchover

    switchover_on_low_disk_space**

    enforce_simple_topology

    replication_user

    replication_password

    replication_master_ssl

    replication_custom_options

    failover_timeout

    switchover_timeout

    verify_master_failure

    master_failure_timeout

    servers_no_promotion

    promotion_sql_file

    demotion_sql_file

    handle_events

    check_repl_on_stop_slave_timeout

    Cooperative monitoring

    Releasing locks

    Primary server write test

    Settings for Primary server write test

    write_test_interval

    write_test_table

    write_test_fail_action

    Backup operations

    Rebuild server

    Prerequisites

    Rebuild server with key-value arguments

    Create backup

    Create backup with key-value arguments

    Restore from backup

    Restore from backup with key-value arguments

    List backups

    Settings for Backup operations

    ssh_user

    ssh_keyfile

    ssh_check_host_key

    ssh_timeout

    ssh_port

    rebuild_port

    mariadb_backup_use_memory

    mariadb_backup_parallel

    backup_storage_address

    backup_storage_path

    sudoers.d configuration

    ColumnStore commands

    Get status

    Add or remove node

    Start and stop cluster

    Set read-only or readwrite

    Settings for Columnstore commands

    cs_admin_port

    cs_admin_api_key

    cs_admin_base_path

    Other commands

    fetch-cmd-result

    fetch-cmd-status

    cancel-cmd

    Troubleshooting

    Failover/switchover fails

    Replica detection shows external primaries

    Using the MariaDB Monitor With Binlogrouter

    Topology scan
    discover replicas
    bootstrap
    cluster manipulation operations
    scheduled event management
    Cluster Manipulation Operations
    Required Grants
    Monitor Common
    section
    Rebuild server-section
    ColumnStore commands-section
    boolean
    private_address
    enum_mask
    Primary selection
    enum_mask
    Primary selection
    cooperative monitoring
    Failover With Multiple MaxScales
    boolean
    boolean
    master_conditions
    boolean
    enforce_read_only_slaves
    boolean
    disk_space_threshold
    disk_space_check_interval
    enum
    Cooperative monitoring
    cooperative monitoring
    servers_no_promotion
    general monitor documentation
    failover
    failover-safe
    switchover
    operation details
    Backup operations
    Required Grants
    Manual activation
    Limitations and requirements
    auto_rejoin
    cluster
    configuration synchronization
    server default settings
    configuration synchronization
    semisynchronous replication
    Configuring the Primary Wait Point
    Binary Log Dump Threads and the Shutdown Process
    enum
    safe failover
    failcount
    passive
    here
    boolean
    enforce_simple_topology
    auto_failover
    limitations
    boolean
    auto_failover
    auto_rejoin
    manual switchover
    switchover due to low disk space
    reset-replication
    failcount
    boolean
    server
    monitor
    disk_space_check_interval
    boolean
    replication_user
    boolean
    duration
    duration
    boolean
    master_failure_timeout
    duration
    here
    promotion_sql_file
    boolean
    boolean
    cooperative_monitoring_locks
    server locks
    Failover With Multiple MaxScales
    Server System Variables
    here
    duration
    write_test_table
    backend_read_timeout
    write_test_fail_action
    enum
    failcount
    settings
    sudoers.d configuration
    mariadb-backup documentation
    mariadb-backup documentation
    boolean
    duration
    here
    here
    here
    Limitations and requirements-section
    Configuration guide
    assume_unique_hostnames
    spinner
    GRANT READ_ONLY ADMIN, REPLICATION SLAVE ADMIN ON *.* TO 'mariadbmon'@'maxscalehost';
    GRANT BINLOG ADMIN, CONNECTION ADMIN, PROCESS, RELOAD, SET USER ON *.* TO 'mariadbmon'@'
    GRANT SELECT ON mysql.user TO 'mariadbmon'@'maxscalehost';
    GRANT SELECT ON mysql.global_priv TO 'mariadbmon'@'maxscalehost';
    GRANT SUPER ON *.* TO 'mariadbmon'@'maxscalehost';
    GRANT PROCESS, RELOAD ON *.* TO 'mariadbmon'@'maxscalehost';
    GRANT SELECT ON mysql.user TO 'mariadbmon'@'maxscalehost';
    GRANT SELECT ON mysql.global_priv TO 'mariadbmon'@'maxscalehost';

    boolean

    boolean

    boolean

    boolean

    server

    server

    server

    server

    maxscalehost
    '
    ;

    MaxScale MaxCtrl

    Reference guide for the MaxCtrl command-line utility. Learn syntax and options for managing MaxScale objects, including servers, services, monitors, and listeners via the REST API.

    MaxCtrl

    MaxCtrl is a command line administrative client for MaxScale which uses the MaxScale REST API for communication. It has replaced the legacy MaxAdmin command line client that is no longer supported or included.

    By default, the MaxScale REST API listens on port 8989 on the local host. The default credentials for the REST API are admin:mariadb. The users used by the REST API are the same that are used by the MaxAdmin network interface. This means that any users created for the MaxAdmin network interface should work with the MaxScale REST API and MaxCtrl.

    For more information about the MaxScale REST API, refer to the REST API documentation. and the Configuration guide.

    Limitations

    • MaxCtrl does not work when used from a SystemD unit with MemoryDenyWriteExecute=true.

    If the file ~/.maxctrl.cnf exists, maxctrl will use any values in the section [maxctrl] as defaults for command line arguments. For instance, to avoid having to specify the user and password on the command line, create the file .maxctrl.cnf in your home directory, with the following content:

    Note that all access rights to the file must be removed from everybody else but the owner. MaxCtrl refuses to use the file unless the rights have been removed.

    Another file from which to read the defaults can be specified with the -c flag.

    This page is licensed: CC BY-SA / Gnu FDL

    [maxctrl]
    u = my-name
    p = my-password
    Usage: list servers
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    List all servers in MaxScale.
    
    
      Field       | Description
      -----       | -----------
      Server      | Server name
      Address     | Address where the server listens
      Port        | The port on which the server listens
      Connections | Current connection count
      State       | Server state
      GTID        | Current value of @@gtid_current_pos
      Monitor     | The monitor for this server
    Usage: list services
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    List all services and the servers they use.
    
    
      Field             | Description
      -----             | -----------
      Service           | Service name
      Router            | Router used by the service
      Connections       | Current connection count
      Total Connections | Total connection count
      Targets           | Targets that the service uses
    Usage: list listeners [service]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    List listeners of all services. If a service is given, only listeners for that service are listed.
    
    
      Field   | Description
      -----   | -----------
      Name    | Listener name
      Port    | The port where the listener listens
      Host    | The address or socket where the listener listens
      State   | Listener state
      Service | Service that this listener points to
    Usage: list monitors
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    List all monitors in MaxScale.
    
    
      Field   | Description
      -----   | -----------
      Monitor | Monitor name
      State   | Monitor state
      Servers | The servers that this monitor monitors
    Usage: list sessions
    
    Options:
          --rdns     Perform a reverse DNS lookup on client IPs  [boolean] [default: false]
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    List all client sessions.
    
    
      Field     | Description
      -----     | -----------
      Id        | Session ID
      User      | Username
      Host      | Client host address
      Connected | Time when the session started
      Idle      | How long the session has been idle, in seconds
      Service   | The service where the session connected
      Memory    | Memory usage (not exhaustive)
    Usage: list filters
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    List all filters in MaxScale.
    
    
      Field   | Description
      -----   | -----------
      Filter  | Filter name
      Service | Services that use the filter
      Module  | The module that the filter uses
    Usage: list modules
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    List all currently loaded modules.
    
    
      Field   | Description
      -----   | -----------
      Module  | Module name
      Type    | Module type
      Version | Module version
    Usage: list threads
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    List all worker threads.
    
    
      Field       | Description
      -----       | -----------
      Id          | Thread ID
      Current FDs | Current number of managed file descriptors
      Total FDs   | Total number of managed file descriptors
      Load (1s)   | Load percentage over the last second
      Load (1m)   | Load percentage over the last minute
      Load (1h)   | Load percentage over the last hour
    Usage: list users
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    List network the users that can be used to connect to the MaxScale REST API.
    
    
      Field        | Description
      -----        | -----------
      Name         | User name
      Type         | User type
      Privileges   | User privileges
      Created      | When the user was created
      Last Updated | The last time the account password was updated
      Last Login   | The last time the user logged in
    Usage: list commands
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    List all available module commands.
    
    
      Field    | Description
      -----    | -----------
      Module   | Module name
      Commands | Available commands
    Usage: list queries
    
    List queries options:
      -l, --max-length  Maximum SQL length to display. Use --max-length=0 for no limit.  [number] [default: 120]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    List all active queries being executed through MaxScale. In order for this command to work, MaxScale must be configured with 'retain_last_statements' set to a value greater than 0.
    Usage: show server <server>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Show detailed information about a server. The `Parameters` field contains the currently configured parameters for this server. See `--help alter server` for more details about altering server parameters.
    
    
      Field               | Description
      -----               | -----------
      Server              | Server name
      Source              | File where the object is stored in
      Address             | Address where the server listens
      Port                | The port on which the server listens
      State               | Server state
      Version             | Server version
      Uptime              | Server uptime in seconds
      Last Event          | The type of the latest event
      Triggered At        | Time when the latest event was triggered at
      Services            | Services that use this server
      Monitors            | Monitors that monitor this server
      Master ID           | The server ID of the master
      Node ID             | The node ID of this server
      Slave Server IDs    | List of slave server IDs
      Current Connections | Current connection count
      Total Connections   | Total cumulative connection count
      Max Connections     | Maximum number of concurrent connections ever seen
      Statistics          | Server statistics
      Parameters          | Server parameters
    Usage: show servers
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Show detailed information about all servers.
    
    
      Field               | Description
      -----               | -----------
      Server              | Server name
      Source              | File where the object is stored in
      Address             | Address where the server listens
      Port                | The port on which the server listens
      State               | Server state
      Version             | Server version
      Uptime              | Server uptime in seconds
      Last Event          | The type of the latest event
      Triggered At        | Time when the latest event was triggered at
      Services            | Services that use this server
      Monitors            | Monitors that monitor this server
      Master ID           | The server ID of the master
      Node ID             | The node ID of this server
      Slave Server IDs    | List of slave server IDs
      Current Connections | Current connection count
      Total Connections   | Total cumulative connection count
      Max Connections     | Maximum number of concurrent connections ever seen
      Statistics          | Server statistics
      Parameters          | Server parameters
    Usage: show service <service>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Show detailed information about a service. The `Parameters` field contains the currently configured parameters for this service. See `--help alter service` for more details about altering service parameters.
    
    
      Field               | Description
      -----               | -----------
      Service             | Service name
      Source              | File where the object is stored in
      Router              | Router that the service uses
      State               | Service state
      Started At          | When the service was started
      Users Loaded At     | When the users for the service were loaded
      Current Connections | Current connection count
      Total Connections   | Total connection count
      Max Connections     | Historical maximum connection count
      Cluster             | The cluster that the service uses
      Servers             | Servers that the service uses
      Services            | Services that the service uses
      Filters             | Filters that the service uses
      Parameters          | Service parameter
      Router Diagnostics  | Diagnostics provided by the router module
    Usage: show services
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Show detailed information about all services.
    
    
      Field               | Description
      -----               | -----------
      Service             | Service name
      Source              | File where the object is stored in
      Router              | Router that the service uses
      State               | Service state
      Started At          | When the service was started
      Users Loaded At     | When the users for the service were loaded
      Current Connections | Current connection count
      Total Connections   | Total connection count
      Max Connections     | Historical maximum connection count
      Cluster             | The cluster that the service uses
      Servers             | Servers that the service uses
      Services            | Services that the service uses
      Filters             | Filters that the service uses
      Parameters          | Service parameter
      Router Diagnostics  | Diagnostics provided by the router module
    Usage: show monitor <monitor>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Show detailed information about a monitor. The `Parameters` field contains the currently configured parameters for this monitor. See `--help alter monitor` for more details about altering monitor parameters.
    
    
      Field               | Description
      -----               | -----------
      Monitor             | Monitor name
      Source              | File where the object is stored in
      Module              | Monitor module
      State               | Monitor state
      Servers             | The servers that this monitor monitors
      Parameters          | Monitor parameters
      Monitor Diagnostics | Diagnostics provided by the monitor module
    Usage: show monitors
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Show detailed information about all monitors.
    
    
      Field               | Description
      -----               | -----------
      Monitor             | Monitor name
      Source              | File where the object is stored in
      Module              | Monitor module
      State               | Monitor state
      Servers             | The servers that this monitor monitors
      Parameters          | Monitor parameters
      Monitor Diagnostics | Diagnostics provided by the monitor module
    Usage: show session <session>
    
    Options:
          --rdns     Perform a reverse DNS lookup on client IPs  [boolean] [default: false]
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Show detailed information about a single session. The list of sessions can be retrieved with the `list sessions` command. The <session> is the session ID of a particular session.
    
    The `Connections` field lists the servers to which the session is connected and the `Connection IDs` field lists the IDs for those connections.
    
    
      Field             | Description
      -----             | -----------
      Id                | Session ID
      Service           | The service where the session connected
      State             | Session state
      User              | Username
      Host              | Client host address
      Port              | Client network port
      Database          | Current default database of the connection
      Connected         | Time when the session started
      Idle              | How long the session has been idle, in seconds
      Parameters        | Session parameters
      Client TLS Cipher | Client TLS cipher
      Connections       | Ordered list of backend connections
      Connection IDs    | Thread IDs for the backend connections
      Queries           | Query history
      Log               | Per-session log messages
      Memory            | Memory usage (not exhaustive)
    Usage: show sessions
    
    Options:
          --rdns     Perform a reverse DNS lookup on client IPs  [boolean] [default: false]
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Show detailed information about all sessions. See `--help show session` for more details.
    
    
      Field             | Description
      -----             | -----------
      Id                | Session ID
      Service           | The service where the session connected
      State             | Session state
      User              | Username
      Host              | Client host address
      Port              | Client network port
      Database          | Current default database of the connection
      Connected         | Time when the session started
      Idle              | How long the session has been idle, in seconds
      Parameters        | Session parameters
      Client TLS Cipher | Client TLS cipher
      Connections       | Ordered list of backend connections
      Connection IDs    | Thread IDs for the backend connections
      Queries           | Query history
      Log               | Per-session log messages
      Memory            | Memory usage (not exhaustive)
    Usage: show filter <filter>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    The list of services that use this filter is show in the `Services` field.
    
    
      Field       | Description
      -----       | -----------
      Filter      | Filter name
      Source      | File where the object is stored in
      Module      | The module that the filter uses
      Services    | Services that use the filter
      Parameters  | Filter parameters
      Diagnostics | Filter diagnostics
    Usage: show filters
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Show detailed information of all filters.
    
    
      Field       | Description
      -----       | -----------
      Filter      | Filter name
      Source      | File where the object is stored in
      Module      | The module that the filter uses
      Services    | Services that use the filter
      Parameters  | Filter parameters
      Diagnostics | Filter diagnostics
    Usage: show listener <listener>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    
    
    
                                                               Field      | Description
                                                               -----      | -----------
                                                               Name       | Listener name
                                                               Source     | File where the object is stored in
                                                               Service    | Services that the listener points to
                                                               Parameters | Listener parameters
    Usage: show filters
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Show detailed information of all filters.
    
    
      Field       | Description
      -----       | -----------
      Filter      | Filter name
      Source      | File where the object is stored in
      Module      | The module that the filter uses
      Services    | Services that use the filter
      Parameters  | Filter parameters
      Diagnostics | Filter diagnostics
    Usage: show module <module>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    This command shows all available parameters as well as detailed version information of a loaded module.
    
    
      Field       | Description
      -----       | -----------
      Module      | Module name
      Type        | Module type
      Version     | Module version
      Maturity    | Module maturity
      Description | Short description about the module
      Parameters  | All the parameters that the module accepts
      Commands    | Commands that the module provides
    Usage: show modules
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Displays detailed information about all modules.
    
    
      Field       | Description
      -----       | -----------
      Module      | Module name
      Type        | Module type
      Version     | Module version
      Maturity    | Module maturity
      Description | Short description about the module
      Parameters  | All the parameters that the module accepts
      Commands    | Commands that the module provides
    Usage: show maxscale
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    See `--help alter maxscale` for more details about altering MaxScale parameters.
    
    
      Field        | Description
      -----        | -----------
      Version      | MaxScale version
      Commit       | MaxScale commit ID
      Started At   | Time when MaxScale was started
      Activated At | Time when MaxScale left passive mode
      Uptime       | Time MaxScale has been running
      Config Sync  | MaxScale configuration synchronization
      Parameters   | Global MaxScale parameters
      System       | System Information
    Usage: show thread <thread>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Show detailed information about a worker thread.
    
    
      Field                  | Description
      -----                  | -----------
      Id                     | Thread ID
      State                  | The state of the thread
      Accepts                | Number of TCP accepts done by this thread
      Reads                  | Number of EPOLLIN events
      Writes                 | Number of EPOLLOUT events
      Hangups                | Number of EPOLLHUP and EPOLLRDUP events
      Errors                 | Number of EPOLLERR events
      Avg event queue length | Average number of events returned by one epoll_wait call
      Max event queue length | Maximum number of events returned by one epoll_wait call
      Max exec time          | The longest time spent processing events returned by a epoll_wait call
      Max queue time         | The longest time an event had to wait before it was processed
      Current FDs            | Current number of managed file descriptors
      Total FDs              | Total number of managed file descriptors
      Load (1s)              | Load percentage over the last second
      Load (1m)              | Load percentage over the last minute
      Load (1h)              | Load percentage over the last hour
      QC cache size          | Query classifier size
      QC cache inserts       | Number of times a new query was added into the query classification cache
      QC cache hits          | How many times a query classification was found in the query classification cache
      QC cache misses        | How many times a query classification was not found in the query classification cache
      QC cache evictions     | How many times a query classification result was evicted from the query classification cache
      Sessions               | The current number of sessions
      Zombies                | The current number of zombie connections, waiting to be discarded
      Memory                 | The current (partial) memory usage
    Usage: show threads
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
          --kind     The kind of threads to display, only the running or all.  [string] [choices: "running", "all"] [default: "running"]
    
    Show detailed information about all worker threads.
    
    
      Field                  | Description
      -----                  | -----------
      Id                     | Thread ID
      State                  | The state of the thread
      Accepts                | Number of TCP accepts done by this thread
      Reads                  | Number of EPOLLIN events
      Writes                 | Number of EPOLLOUT events
      Hangups                | Number of EPOLLHUP and EPOLLRDUP events
      Errors                 | Number of EPOLLERR events
      Avg event queue length | Average number of events returned by one epoll_wait call
      Max event queue length | Maximum number of events returned by one epoll_wait call
      Max exec time          | The longest time spent processing events returned by a epoll_wait call
      Max queue time         | The longest time an event had to wait before it was processed
      Current FDs            | Current number of managed file descriptors
      Total FDs              | Total number of managed file descriptors
      Load (1s)              | Load percentage over the last second
      Load (1m)              | Load percentage over the last minute
      Load (1h)              | Load percentage over the last hour
      QC cache size          | Query classifier size
      QC cache inserts       | Number of times a new query was added into the query classification cache
      QC cache hits          | How many times a query classification was found in the query classification cache
      QC cache misses        | How many times a query classification was not found in the query classification cache
      QC cache evictions     | How many times a query classification result was evicted from the query classification cache
      Sessions               | The current number of sessions
      Zombies                | The current number of zombie connections, waiting to be discarded
      Memory                 | The current (partial) memory usage
    Usage: show logging
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    See `--help alter logging` for more details about altering logging parameters.
    
    
      Field              | Description
      -----              | -----------
      Current Log File   | The current log file MaxScale is logging into
      Enabled Log Levels | List of log levels enabled in MaxScale
      Parameters         | Logging parameters
    Usage: show commands <module>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    This command shows the parameters the command expects with the parameter descriptions.
    
    
      Field        | Description
      -----        | -----------
      Command      | Command name
      Parameters   | Parameters the command supports
      Descriptions | Parameter descriptions
    Usage: show qc_cache
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Show contents (statement and hits) of query classifier cache.
    Usage: show dbusers <service>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Show information about the database users of the service.
    
    
      Field  | Description
      -----  | -----------
      User   | The user name of the account
      Host   | The host of the account
      Plugin | Authentication plugin
      TLS    | Whether TLS is required from this user
      Super  | Does the user have a SUPER grant
      Global | Does the user have global database access
      Proxy  | Whether this is a proxy user
      Role   | The default role for this user
    Usage: set server <server> <state>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Set options:
          --force  If combined with the `maintenance` state, this forcefully closes all connections to the target server  [boolean] [default: false]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    If <server> is monitored by a monitor, this command should only be used to set the server into the `maintenance` or the `drain` state. Any other states will be overridden by the monitor on the next monitoring interval. To manually control server states, use the `stop monitor <name>` command to stop the monitor before setting the server states manually.
    
    When a server is set into the `drain` state, no new connections to it are allowed but existing connections are allowed to gracefully close. Servers with the `Master` status cannot be drained or set into maintenance mode. To clear a state set by this command, use the `clear server` command.
    
    To forcefully close all connections to a server, use `set server <name> maintenance --force`
    Usage: clear server <server> <state>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    This command clears a server state set by the `set server <server> <state>` command
    Usage: enable log-priority <log>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    The `debug` log priority is only available for debug builds of MaxScale.
    Usage: disable log-priority <log>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    The `debug` log priority is only available for debug builds of MaxScale.
    Usage: create server <name> <host|socket> [port] [params...]
    
    Create server options:
          --services  Link the created server to these services  [array]
          --monitors  Link the created server to these monitors  [array]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    The created server will not be used by any services or monitors unless the --services or --monitors options are given. The list of servers a service or a monitor uses can be altered with the `link` and `unlink` commands. If the <host|socket> argument is an absolute path, the server will use a local UNIX domain socket connection. In this case the [port] argument is ignored.
    
    The recommended way of declaring parameters is with the new `key=value` syntax added in MaxScale 6.2.0. Note that for some parameters (e.g. `extra_port` and `proxy_protocol`) this is the only way to pass them. The redundant option parameters have been deprecated in MaxScale 22.08.
    Usage: create monitor <name> <module> [params...]
    
    Create monitor options:
          --servers  Link the created monitor to these servers. All non-option arguments after --servers are interpreted as server names e.g. `--servers srv1 srv2 srv3`.  [array]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    The list of servers given with the --servers option should not contain any servers that are already monitored by another monitor. The last argument to this command is a list of key=value parameters given as the monitor parameters. The redundant option parameters have been deprecated in MaxScale 22.08.
    Usage: service <name> <router> <params...>
    
    Create service options:
          --servers   Link the created service to these servers. All non-option arguments after --servers are interpreted as server names e.g. `--servers srv1 srv2 srv3`.  [array]
          --filters   Link the created service to these filters. All non-option arguments after --filters are interpreted as filter names e.g. `--filters f1 f2 f3`.  [array]
          --services  Link the created service to these services. All non-option arguments after --services are interpreted as service names e.g. `--services svc1 svc2 svc3`.  [array]
          --cluster   Link the created service to this cluster (i.e. a monitor)  [string]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    The last argument to this command is a list of key=value parameters given as the service parameters. If the --servers, --services or --filters options are used, they must be defined after the service parameters. The --cluster option is mutually exclusive with the --servers and --services options.
    
    Note that the `user` and `password` parameters must be defined.
    Usage: filter <name> <module> [params...]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    The last argument to this command is a list of key=value parameters given as the filter parameters.
    Usage: create listener <service> <name> <port> [params...]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    The new listener will be taken into use immediately. The last argument to this command is a list of key=value parameters given as the listener parameters. These parameters override any parameters set via command line options: e.g. using `protocol=mariadb` will override the `--protocol=cdc` option. The redundant option parameters have been deprecated in MaxScale 22.08.
    Usage: create user <name> <password>
    
    Create user options:
          --type  Type of user to create  [string] [choices: "admin", "basic"] [default: "basic"]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    By default the created user will have read-only privileges. To make the user an administrative user, use the `--type=admin` option. Basic users can only perform `list` and `show` commands.
    Usage: create report <file>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    The generated report contains the state of all the objects in MaxScale as well as all other required information needed to diagnose problems.
    Usage: destroy server <name>
    
    Destroy options:
          --force  Remove the server from monitors and services before destroying it  [boolean] [default: false]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    The server must be unlinked from all services and monitor before it can be destroyed.
    Usage: destroy monitor <name>
    
    Destroy options:
          --force  Remove monitored servers from the monitor before destroying it  [boolean] [default: false]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    The monitor must be unlinked from all servers before it can be destroyed.
    Usage: destroy listener { <listener> | <service> <listener> }
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Destroying a listener closes the listening socket, opening it up for immediate reuse. If only one argument is given and it is the name of a listener, it is unconditionally destroyed. 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.
    Usage: destroy service <name>
    
    Destroy options:
          --force  Remove filters, listeners and servers from service before destroying it  [boolean] [default: false]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    The service must be unlinked from all servers and filters. All listeners for the service must be destroyed before the service itself can be destroyed.
    Usage: destroy filter <name>
    
    Destroy options:
          --force  Automatically remove the filter from all services before destroying it  [boolean] [default: false]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    The filter must not be used by any service when it is destroyed.
    Usage: destroy user <name>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    The last remaining administrative user cannot be removed. Create a replacement administrative user before attempting to remove the last administrative user.
    Usage: destroy session <id>
    
    Destroy options:
          --ttl  Give session this many seconds to gracefully close  [number] [default: 0]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    This causes the client session with the given ID to be closed. If the --ttl option is used, the session is given that many seconds to gracefully stop. If no TTL value is given, the session is closed immediately.
    Usage: link service <name> <target...>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    This command links targets to a service, making them available for any connections that use the service. A target can be a server, another service or a cluster (i.e. a monitor). Before a server is linked to a service, it should be linked to a monitor so that the server state is up to date. Newly linked targets are only available to new connections, existing connections will use the old list of targets. If a monitor (a cluster of servers) is linked to a service, the service must not have any other targets linked to it.
    Usage: link monitor <name> <server...>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Linking a server to a monitor will add it to the list of servers that are monitored by that monitor. A server can be monitored by only one monitor at a time.
    Usage: unlink service <name> <target...>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    This command unlinks targets from a service, removing them from the list of available targets for that service. New connections to the service will not use the unlinked targets but existing connections can still use the targets. A target can be a server, another service or a cluster (a monitor).
    Usage: unlink monitor <name> <server...>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    This command unlinks servers from a monitor, removing them from the list of monitored servers. The servers will be left in their current state when they are unlinked from a monitor.
    Usage: start service <name>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    This starts a service stopped by `stop service <name>`
    Usage: start listener <name>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    This starts a listener stopped by `stop listener <name>`
    Usage: start monitor <name>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    This starts a monitor stopped by `stop monitor <name>`
    Usage: start [services|maxscale]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    This command will execute the `start service` command for all services in MaxScale.
    Usage: stop service <name>
    
    Stop options:
          --force  Close existing connections after stopping the service  [boolean] [default: false]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Stopping a service will prevent all the listeners for that service from accepting new connections. Existing connections will still be handled normally until they are closed.
    Usage: stop listener <name>
    
    Stop options:
          --force  Close existing connections after stopping the listener  [boolean] [default: false]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Stopping a listener will prevent it from accepting new connections. Existing connections will still be handled normally until they are closed.
    Usage: stop monitor <name>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Stopping a monitor will pause the monitoring of the servers. This can be used to manually control server states with the `set server` command.
    Usage: stop [services|maxscale]
    
    Stop options:
          --force  Close existing connections after stopping all services  [boolean] [default: false]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    This command will execute the `stop service` command for all services in MaxScale.
    Usage: alter server <server> <key=value> ...
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    To display the server parameters, execute `show server <server>`.
    The parameters should be given in the `key=value` format. This command also supports the legacy method
    of passing parameters as `key value` pairs but the use of this is not recommended.
    Usage: alter monitor <monitor> <key=value> ...
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    To display the monitor parameters, execute `show monitor <monitor>`
    The parameters should be given in the `key=value` format. This command also supports the legacy method
    of passing parameters as `key value` pairs but the use of this is not recommended.
    Usage: alter service <service> <key=value> ...
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    To display the service parameters, execute `show service <service
    The parameters should be given in the `key=value` format. This command also supports the legacy method
    of passing parameters as `key value` pairs but the use of this is not recommended.
    Usage: alter service-filters <service> [filters...]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    The order of the filters given as the second parameter will also be the order in which queries pass through the filter chain. If no filters are given, all existing filters are removed from the service.
    
    For example, the command `maxctrl alter service-filters my-service A B C` will set the filter chain for the service `my-service` so that A gets the query first after which it is passed to B and finally to C. This behavior is the same as if the `filters=A|B|C` parameter was defined for the service.
    
    The parameters should be given in the `key=value` format. This command also supports the legacy method
    of passing parameters as `key value` pairs but the use of this is not recommended.
    Usage: alter filter <filter> <key=value> ...
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    To display the filter parameters, execute `show filter <filter>`. Some filters support runtime configuration changes to all parameters. Refer to the filter documentation for details on whether it supports runtime configuration changes and which parameters can be altered.
    
    The parameters should be given in the `key=value` format. This command also supports the legacy method
    of passing parameters as `key value` pairs but the use of this is not recommended.
    Note: To pass options with dashes in them, surround them in both single and double quotes:
    
          maxctrl alter filter my-namedserverfilter target01 '"->master"'
    Usage: alter listener <listener> <key=value> ...
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    To display the listener parameters, execute `show listener <listener>`
    The parameters should be given in the `key=value` format. This command also supports the legacy method
    of passing parameters as `key value` pairs but the use of this is not recommended.
    Usage: alter logging <key=value> ...
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    To display the logging parameters, execute `show logging`
    The parameters should be given in the `key=value` format. This command also supports the legacy method
    of passing parameters as `key value` pairs but the use of this is not recommended.
    Usage: alter maxscale <key=value> ...
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    To display the MaxScale parameters, execute `show maxscale`.
    The parameters should be given in the `key=value` format. This command also supports the legacy method
    of passing parameters as `key value` pairs but the use of this is not recommended.
    Usage: alter user <name> <password>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Changes the password for a user. To change the user type, destroy the user and then create it again.
    Usage: alter session <session> <key=value> ...
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Alter parameters of a session. To get the list of modifiable parameters, use `show session <session>`
    The parameters should be given in the `key=value` format. This command also supports the legacy method
    of passing parameters as `key value` pairs but the use of this is not recommended.
    Usage: alter session-filters <session> [filters...]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    The order of the filters given as the second parameter will also be the order in which queries pass through the filter chain. If no filters are given, all existing filters are removed from the session. The syntax is similar to `alter service-filters`.
    Usage: rotate logs
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    This command is intended to be used with the `logrotate` command.
    Usage: reload service <service>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    Usage: reload tls <service>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    This command reloads the TLS certificates for all listeners and servers as well as the REST API in MaxScale. The REST API JWT signature keys are also rotated by this command.
    Usage: reload session <id>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    This command reloads the configuration of a session. When a session is reloaded, it internally restarts the MaxScale session. This means that new connections are created and taken into use before the old connections are discarded. The session will use the latest configuration of the service the listener it used pointed to. This means that the behavior of the session can change as a result of a reload if the configuration has changed. If the reloading fails, the old configuration will remain in use. The external session ID of the connection will remain the same as well as any statistics or session level alterations that were done before the reload.
    Usage: reload sessions
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    This command reloads the configuration of all sessions. When a session is reloaded, it internally restarts the MaxScale session. This means that new connections are created and taken into use before the old connections are discarded. The session will use the latest configuration of the service the listener it used pointed to. This means that the behavior of the session can change as a result of a reload if the configuration has changed. If the reloading fails, the old configuration will remain in use. The external session ID of the connection will remain the same as well as any statistics or session level alterations that were done before the reload.
    Usage: call command <module> <command> [params...]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    To inspect the list of module commands, execute `list commands`
    Usage: get <resource> [path]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    API options:
          --sum     Calculate sum of API result. Only works for arrays of numbers e.g. `api get --sum servers data[].attributes.statistics.connections`.  [boolean] [default: false]
          --pretty  Pretty-print output.  [boolean] [default: false]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Perform a raw REST API call. The path definition uses JavaScript syntax to extract values. For example, the following command extracts all server states as an array of JSON values: maxctrl api get servers data[].attributes.state
    Usage: post <resource> <value>
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    API options:
          --sum     Calculate sum of API result. Only works for arrays of numbers e.g. `api get --sum servers data[].attributes.statistics.connections`.  [boolean] [default: false]
          --pretty  Pretty-print output.  [boolean] [default: false]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Perform a raw REST API call. The provided value is passed as-is to the REST API after building it with JSON.parse
    Usage: patch <resource> [path]
    
    Global Options:
      -c, --config     MaxCtrl configuration file  [string] [default: "~/.maxctrl.cnf"]
      -u, --user       Username to use  [string] [default: "admin"]
      -p, --password   Password for the user. To input the password manually, use -p '' or --password=''  [string] [default: "mariadb"]
      -h, --hosts      List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma.  [string] [default: "127.0.0.1:8989"]
      -t, --timeout    Request timeout in plain milliseconds, e.g '-t 1000', or as duration with suffix [h|m|s|ms], e.g. '-t 10s'  [string] [default: "10000"]
      -q, --quiet      Silence all output. Ignored while in interactive mode.  [boolean] [default: false]
          --tsv        Print tab separated output  [boolean] [default: false]
          --skip-sync  Disable configuration synchronization for this command  [boolean] [default: false]
    
    HTTPS/TLS Options:
      -s, --secure                  Enable HTTPS requests  [boolean] [default: false]
          --tls-key                 Path to TLS private key  [string]
          --tls-passphrase          Password for the TLS private key  [string]
          --tls-cert                Path to TLS public certificate  [string]
          --tls-ca-cert             Path to TLS CA certificate  [string]
      -n, --tls-verify-server-cert  Whether to verify server TLS certificates  [boolean] [default: true]
    
    API options:
          --sum     Calculate sum of API result. Only works for arrays of numbers e.g. `api get --sum servers data[].attributes.statistics.connections`.  [boolean] [default: false]
          --pretty  Pretty-print output.  [boolean] [default: false]
    
    Options:
          --version  Show version number  [boolean]
          --help     Show help  [boolean]
    
    Perform a raw REST API call. The provided value is passed as-is to the REST API after building it with JSON.parse

    .maxctrl.cnf

    Commands

    list

    list servers

    list services

    list listeners

    list monitors

    list sessions

    list filters

    list modules

    list threads

    list users

    list commands

    list queries

    show

    show server

    show servers

    show service

    show services

    show monitor

    show monitors

    show session

    show sessions

    show filter

    show filters

    show listener

    show listeners

    show module

    show modules

    show maxscale

    show thread

    show threads

    show logging

    show commands

    show qc_cache

    show dbusers

    set

    set server

    clear

    clear server

    enable

    enable log-priority

    disable

    disable log-priority

    create

    create server

    create monitor

    create service

    create filter

    create listener

    create user

    create report

    destroy

    destroy server

    For a complete, step-by-step tutorial on safely draining and removing a server from your topology, see .

    destroy monitor

    destroy listener

    destroy service

    destroy filter

    destroy user

    destroy session

    link

    link service

    link monitor

    unlink

    unlink service

    unlink monitor

    start

    start service

    start listener

    start monitor

    start services

    stop

    stop service

    stop listener

    stop monitor

    stop services

    alter

    alter server

    alter monitor

    alter service

    alter service-filters

    alter filter

    alter listener

    alter logging

    alter maxscale

    alter user

    alter session

    alter session-filters

    rotate

    rotate logs

    reload

    reload service

    reload tls

    reload session

    reload sessions

    call

    call command

    api

    api get

    api post

    api patch

    classify

    spinner
    Removing a Server in MaxScale with MaxCtrl

    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.

    Concepts

    Glossary

    Word
    Description

    connection routing

    Connection routing is a method of handling requests in which MariaDB MaxScale will accept connections from a client and route data on that connection to a single database using a single connection. Connection based routing will not examine individual requests on a connection and it will not move that connection once it is established.

    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

    For more information on how to manually set these states via MaxCtrl, read the .

    A monitor module is capable of monitoring the state of a particular kind of cluster and making that state available to the routers of MaxScale.

    Examples of monitor modules are mariadbmon that is capable of monitoring a regular primary-replica cluster and in addition of performing both switchover and failover, galeramon that is capable of monitoring a Galera cluster, and csmon that is capable of monitoring a Columnstore cluster.

    Monitor modules have sections of their own in the MaxScale configuration file.

    A filter module resides in front of routers in the request processing chain of MaxScale. That is, a filter will see a request before it reaches the router and before a response is sent back to the client. This allows filters to reject, handle, alter or log information about a request.

    Examples of filters cache that provides query caching according to rules, regexfilter that can rewrite requests according to regular expressions, and qlafilter that logs information about requests.

    Filters have sections of their own in the MaxScale configuration file that are referred to from services.

    Simple filters that do not have any settings can be created automatically by referring to them by the module name in the filters list of a service. For example, using filters=hintfilter in a service will create a filter named hintfilter using the module hintfilter.

    Limitations:

    • MaxScale: No limitations.

    • MaxScale Lite: At most 2 filters can be created.

    A router module is capable of routing requests to backend servers according to the characteristics of a request and/or the algorithm the router implements. Examples of routers are readconnroute that provides connection routing, that is, the server is chosen according to specified rules when the session is created and all requests are subsequently routed to that server, and readwritesplit that provides statement routing, that is, each individual request is routed to the most appropriate server.

    Routers do not have sections of their own in the MaxScale configuration file, but are referred to from services.

    A service abstracts a set of databases and makes them appear as a single one to the client. Depending on what router (e.g. readconnroute or readwritesplit) the service uses, the servers are used in some particular way. If the service uses filters, then all requests will be pre-processed in some way before they reach the router.

    Services have sections of their own in the MaxScale configuration file.

    Limitations:

    • MaxScale: No limitations.

    • MaxScale Lite: At most 2 services can be created.

    A listener defines a port MaxScale listens on. Connection requests arriving on that port will be forwarded to the service the listener is associated with. A listener may be associated with a single service, but several listeners may be associated with the same service.

    Listeners have sections of their own in the MaxScale configuration file.

    An defines common parameters used in other configuration sections.

    The administration of MaxScale can be divided in two parts:

    • Writing the MaxScale configuration file, which is described in the following .

    • Performing runtime modifications using

    For detailed information about MaxCtrl please refer to the specific documentation referred to above. In the following it will only be explained how MaxCtrl relate to each other, as far as user credentials go.

    Note: By default all runtime configuration changes are saved on disk and loaded on startup. Refer to the section for more details on how it works and how to disable it.

    MaxCtrl can connect using TCP/IP sockets. When connecting with MaxCtrl using TCP/IP sockets, the user and password must be provided and are checked against a separate user credentials database. By default, that database contains the user admin whose password is mariadb.

    Note that if MaxCtrl is invoked without explicitly providing a user and password then it will by default use admin and mariadb. That means that when the default user is removed, the credentials must always be provided.

    The REST API calls to MaxScale can be logged by enabling .

    For more detail see the admin audit configuration values admin_audit, admin_audit_file and admin_audit_exclude_methods below and .

    The following global configuration parameters can NOT be changed at runtime and can only be defined in a configuration file:

    • admin_auth

    • admin_enabled

    • admin_gui

    All other parameters that relate to objects can be altered at runtime or can be changed by destroying and recreating the object in question.

    MaxScale by default reads configuration from the file /etc/maxscale.cnf. If the command line argument --configdir=<path> is given, maxscale.cnf is searched for in <path> instead. If the argument --config=<file> is given, configuration is read from the file <file>.

    MaxScale also looks for a directory with the same name as the configuration file, followed by ".d" (for example /etc/maxscale.cnf.d). If found, MaxScale recursively reads all files with the ".cnf" suffix in the directory hierarchy. Other files are ignored.

    After loading normal configuration files, MaxScale reads runtime-generated configuration files, if any, from the .

    Different configuration sections can be arranged with little restrictions. Global path settings such as logdir, piddir and datadir are only read from the main configuration file. Other global settings are also best left in the main file to ensure they are read before other configuration sections are parsed.

    The configuration file format used is , similar to the MariaDB Server. The files contain sections and each section can contain multiple key-value pairs.

    Comments are defined by prefixing a row with a hash (#). Trailing comments are not supported.

    A parameter can be defined on multiple lines as shown below. A value spread over multiple lines is simply concatenated. The additional lines of the value definition need to have at least one whitespace character in the beginning.

    Section names may not contain whitespace and must not start with the characters @@.

    As the object names are used to form URLs in the MaxScale REST API, they must be safe for use in URLs. This means that only alphanumeric characters (i.e. a-z, A-Z and 0-9) and the special characters _.~- can be used.

    By default all changes done at runtime via the MaxScale GUI, MaxCtrl or the REST API will be saved on disk, inside the directory. The changes done at runtime will override the configuration found in the static configuration files for that particular object.

    This means that if an object that is found in /etc/maxscale.cnf is modified at runtime, all future changes to it must also be done at runtime. Any modifications done to /etc/maxscale.cnf after a runtime change has been made are ignored for that object.

    To prevent the saving of runtime changes and to make all runtime changes volatile, add and under the [maxscale] section. This will make MaxScale behave like the MariaDB server does: any changes done with SET GLOBAL statements are lost if the process is restarted.

    Boolean type parameters interpret the values true, yes, on and 1 as true values and false, no, off and 0 as false values. Starting with MaxScale 23.02, the REST API also accepts the same boolean values for boolean type parameters.

    Where specifically noted, a number denoting a size can be suffixed by a subset of the IEC binary prefixes or the SI prefixes. In the former case the number will be interpreted as a certain multiple of 1024 and in the latter case as a certain multiple of 1000. The supported IEC binary suffixes are Ki, Mi, Gi and Ti and the supported SI suffixes are k, M, G and T. In both cases, the matching is case-insensitive.

    For instance, the following entries

    are equivalent, as are the following

    A number denoting a duration can be suffixed by one of the case-insensitive suffixes h, m or min, s and ms, for specifying durations in hours, minutes, seconds and milliseconds, respectively.

    For instance, the following entries

    are equivalent.

    Note that if an explicit unit is not specified, then it is specific to the configuration parameter whether the duration is interpreted as seconds or milliseconds.

    Not providing an explicit unit has been deprecated in MaxScale 2.4.

    A number denoting a percent must be suffixed with %.

    For instance

    Many modules have settings which accept a regular expression. In most cases, these settings are named either match or exclude, and are used to filter users or queries. MaxScale uses the for matching regular expressions.

    When writing a regular expression (regex) type parameter to a MaxScale configuration file, the pattern string should be enclosed in slashes e.g. ^select -> match=/^select/. This clarifies where the pattern begins and ends, even if it includes whitespace. Without slashes the configuration loader trims the pattern from the ends. The slashes are removed before compiling the pattern. For backwards compatibility, the slashes are not yet mandatory. Omitting them is, however, deprecated and will be rejected in a future release of MaxScale. Currently, binlogfilter, ccrfilter, qlafilter, tee and avrorouter accept parameters in this type of regular expression form. Some other modules may not handle the slashes yet correctly.

    PCRE2 supports a complicated regular expression . MaxScale typically uses regular expressions simply, only checking whether the pattern and subject match at some point. For example, using the QLAFilter and setting match=/SELECT/ causes the filter to accept any query with the text "SELECT" somewhere within. To force the pattern to only match at the beginning of the query, set match=/^SELECT/. To only match the end, setmatch=/SELECT$/.

    Modules which accept regular expression parameters also often accept options which affect how the patterns are compiled. Typically, this setting is called options and accepts values such as ignorecase, case and extended.

    • ignorecase: Causes the regular expression matcher to ignore letter case, and is often on by default. When enabled, /SELECT/ would match both SELECT andselect.

    • extended: Ignores whitespace and # comments in the pattern. Note that this is not the same as the extended regular expression syntax that for example

    These settings can also be defined in the pattern itself, so they can be used even in modules without pattern compilation settings. The pattern settings are (?i) for ignorecase and (?x) for extended. See the for more information.

    Standard regular expression settings for filters

    Many filters use the settings match, exclude and options. Since these settings are used in a similar way across these filters, the settings are explained here. The documentation of the filters link here and describe any exceptions to this generalized explanation.

    These settings typically limit the queries the filter module acts on. match and exclude define PCRE2 regular expression patterns while options affects how both of the patterns are compiled. options works as explained above, accepting the values ignorecase, case and extended, with ignorecase being the default.

    The queries are matched as they arrive to the filter on their way to a routing module. If match is defined, the filter only acts on queries matching that pattern. If match is not defined, all queries are considered to match.

    If exclude is defined, the filter only acts on queries not matching that pattern. If exclude is not defined, nothing is excluded.

    If both are defined, the query needs to match match but not match exclude.

    Even if a filter does not act on a query, the query is not lost. The query is simply passed on to the next module in the processing chain as if the filter was not there.

    Enumeration type parameters have a predefined set of accepted values. For types declared as enum, only one value is accepted. For enum_mask types, multiple values can be defined by separating them with commas. All enumeration values in MaxScale are case-sensitive.

    For example the router_options parameter in the readconnroute router is a mask type enumeration:

    A pathlist type parameter expects one or more filesystem paths separated by colons. The value must not include space between the separators.

    Here is an example path list parameter that points to /tmp/something.log and /var/log/maxscale/maxscale.log:

    The global settings, in a section named [MaxScale], allow various parameters that affect MariaDB MaxScale as a whole to be tuned. This section must be defined in the root configuration file which by default is /etc/maxscale.cnf.

    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:

    Settings
    Brief Description

    See the page for a comprehensive list of these configuration parameters.

    • Type:

    • Default: false

    • Dynamic: No

    This parameter specifies whether a core file should be generated if MaxScale crashes. Since 25.10 the default is false because usually a core file is not needed, as MaxScale is capable of logging the full stack trace of all threads when it crashes.

    • Type: string list

    • Values: all or list of auto tunable parameters, separated by ,

    • Default: 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

    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.

    • Type: number or auto

    • Mandatory: No

    • Dynamic: No

    This parameter controls the number of worker threads that are used for routing client traffic. The default is auto which uses as many threads as there are virtual CPU cores available to MaxScale, rounded up to the nearest integer. If no limitations have been set using CPU affinities or cgroup CPU quotas, this will be the same as the number of CPU cores. In general, as of 24.08, MaxScale will use the appropriate number of threads, also when it is running in a container.

    The maximum value for threads is specified by .

    From 23.02 onwards it is possible to change the number threads at runtime. Please see for more details.

    Additional threads will be created to execute other internal services within MariaDB MaxScale. This setting is used to configure the number of threads that will be used to manage the user connections.

    • Type: positive integer

    • Default: 256

    • Dynamic: No

    This parameter specifies the hard limit for the number of worker threads, which is specified using .

    At startup, if the value of threads is larger than that of threads_max, the value of threads will be reduced to that. At runtime, an attempt to increase the value of threads beyond that of threads_max is an error.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0s

    This duration parameter controls how often the load of the worker threads should be checked. The default value is 0, which means that no checks and no rebalancing will be performed.

    Note that the value of rebalance_period should not be smaller than the value of rebalance_window whose default value is 10.

    If the value of rebalance_period is significantly shorter than that of rebalance_window, it may lead to oscillation where work is constantly moved from one thread to another.

    • 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.

    • 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.

    The minimum value is 1 and the maximum 60.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    This parameter controls whether reverse domain name lookups are made to convert client IP addresses to hostnames. If enabled, client IP addresses will not be resolved to hostnames during authentication or for the REST API even if requested.

    If you have database users that use a hostname in the host part of the user (i.e. 'user'@'my-hostname.org'), a reverse lookup on the client IP address is done to see if it matches the host. Reverse DNS lookups can be very slow which is why it is recommended that they are disabled and that users are defined using an IP address.

    • 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.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 10s

    Duration, default 10s. This setting defines the connection timeout when attempting to fetch MariaDB/MySQL users from a backend server. The same value is also used for read and write timeouts. Increasing this value causes MaxScale to wait longer for a response from a server before user fetching fails. Other servers may then be attempted.

    The value is given as . If no explicit unit is provided, the value is interpreted as seconds. In subsequent versions a value without a unit may be rejected. Since the granularity of the timeout is seconds, a timeout specified in milliseconds will be rejected even if the given value is longer than a second.

    Deprecated and ignored as of MaxScale 2.5.0. See auth_connect_timeout above.

    Deprecated and ignored as of MaxScale 2.5.0. See auth_connect_timeout above.

    • Type: number

    • Mandatory: No

    • Dynamic: No

    • Default: 1

    Deprecated and ignored.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 10s

    Deprecated and ignored.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    Deprecated since MariaDB MaxScale 25.01. Use instead.

    Controls whether MaxScale is a passive node in a cluster of multiple MaxScale instances.

    This parameter is intended to be used with multiple MaxScale instances that use failover functionality to manipulate the cluster in some form. Passive nodes only observe the clusters being monitored and take no direct actions.

    The following functionality is disabled when passive mode is enabled:

    • Automatic failover in the mariadbmon module

    • Automatic rejoin in the mariadbmon module

    • Launching of monitor scripts

    NOTE: Even if MaxScale is in passive mode, it will still accept clients and route any traffic sent to it. The only operations affected by the passive mode are the ones listed above.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    Enable or disable the high precision timestamps in logfiles. Enabling this adds millisecond precision to all logfile timestamps.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    Log messages to the system journal. This logs messages using the native SystemD journal interface. The logs can be viewed with journalctl.

    MaxScale 22.08 changed the default value of syslog from true to false. This was done to remove the redundant logging that it caused as both syslog and maxlog were enabled by default. This caused each message to be logged twice: once into the system journal and once into MaxScale's own logfile.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    Log messages to MariaDB MaxScale's log file. The name of the log file is maxscale.log and it is located in the directory pointed by .

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    Log messages whose syslog priority is warning.

    MaxScale logs warning level messages whenever a condition is encountered that the user should be notified of but does not require immediate action or it indicates a minor problem.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    Log messages whose syslog priority is notice.

    These messages contain information that is helpful for the user and they usually do not indicate a problem. These are logged whenever something worth nothing happens in either MaxScale or in the servers it monitors.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    Log messages whose syslog priority is info.

    These messages provide detailed information about the internal workings of MariaDB MaxScale. These messages should only be enabled when there is a need to inspect the internal logic of MaxScale. A common use-case is to see why a particular query was handled in a certain way. Almost all modules log some messages on the info level and this can be very helpful when trying to solve routing related problems.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    Log messages whose syslog priority is debug.

    These messages are intended for development purposes and are disabled by default. These are rarely useful outside of debugging core MaxScale issues.

    Note: If MariaDB MaxScale has been built in release mode, then debug messages are excluded from the build and this setting will not have any effect. If an attempt to enable these is made, a warning is logged.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    Path to a directory where trace files will be generated to.

    The trace logging offers a low overhead alternative to log_info that is designed to be placed on a local in-memory file system. By placing the files in a location that is not persistent, the overhead of writing to the files is minimal while still allowing the trace logs to be processed as normal log files.

    If this parameter is defined along with trace_file_size, MaxScale will write all log messages from all log levels into a set of trace files located in this directory. The files are named maxscale.trace.N where N is an increasing number and whenever a new file is created the oldest one is removed if there are more than 10 trace files.

    Starting with MaxScale 24.08.1, the maxscale.trace symlink will be created in that will point to the latest log file. This symlink can be used with tail -F to interactively monitor the trace stream or to copy the trace output directly into a compressed file:

    The trace files differ from the normal log file written by MaxScale in that they do not contain the local timestamp and instead contain a raw fractional UNIX timestamp. The format of the trace file is subject to change and it may in the future be identical to the normal log generated by MaxScale.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    The desired amount of log data to keep in the trace files. Each individual trace file will be one tenth the size of trace_file_size and once they exceed this amount, a trace log rotation will occur. For example with trace_file_size=100Mi, roughly 100MiB of log data is kept in 10 files with about 10MiB of data in each file.

    Individual trace files may sometimes exceed this limit and under heavy load the system may end up temporarily using more space than is intended.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: false

    When enabled, a warning is logged whenever a client with SUPER-privilege successfully authenticates. This also applies to COM_CHANGE_USER-commands. The setting is intended for diagnosing situations where a client interferes with a primary server switchover. Super-users bypass the read_only-flag which switchover uses to block writes to the primary.

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0

    Enable or disable the augmentation of messages. If this is enabled, then each logged message is appended with the name of the function where the message was logged. This is primarily for development purposes and hence is disabled by default.

    To disable the augmentation use the value 0 and to enable it use the value 1.

    • Type: number, ,

    • Mandatory: No

    • Dynamic: Yes

    • Default:

    It is possible that a particular error (or warning) is logged over and over again, if the cause for the error persistently remains. To prevent the log from flooding, it is possible to specify how many times a particular error may be logged within a time period, before the logging of that error is suppressed for a while.

    In the example above, the logging of a particular error will be suppressed for 15 seconds if the error has been logged 8 times in 2 seconds.

    The default is 10, 1000ms, 10000ms, which means that if the same error is logged 10 times in one second, the logging of that error is suppressed for the following 10 seconds.

    Whenever an error message that is being throttled is logged within the triggering window (the second argument), the suppression window is extended. This continues until there is a pause in the messages that is longer than the triggering window.

    For example, with the default configuration the messages must pause for at least one second in order for the throttling to eventually stop. This mechanism prevents long-lasting error conditions from slowly filling up the log with short bursts of messages.

    To disable log throttling, add an entry with an empty value

    or one where any of the integers is 0.

    The durations can be specified as documented . If no explicit unit is provided, the value is interpreted as milliseconds in MaxScale 2.4. In subsequent versions a value without a unit may be rejected.

    Note that notice, info and debug messages are never throttled.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: /var/log/maxscale

    Set the directory where the logfiles are stored. The folder needs to be both readable and writable by the user running MariaDB MaxScale.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: /var/lib/maxscale

    Set the directory where the data files used by MariaDB MaxScale are stored. Modules can write to this directory and for example the binlogrouter uses this folder as the default location for storing binary logs.

    This is also the directory where the password encryption key is read from that is generated by maxkeys.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    The location where the .secrets file is read from. If secretsdir is not defined, the file is read from .

    This parameter was added in MaxScale 6.4.16, 22.08.13, 23.02.10, 23.08.6 and 24.02.2.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: OS Dependent

    Set the directory where MariaDB MaxScale looks for modules. The library directory is the only directory that MariaDB MaxScale uses when it searches for modules. If you have custom modules for MariaDB MaxScale, make sure you have them in this folder.

    The default value depends on the operating system. For RHEL versions the value is /usr/lib64/maxscale/. For Debian and Ubuntu it is /usr/lib/x86_64-linux-gnu/maxscale/

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: /usr/share/maxscale

    Sets the directory where static data assets are loaded.

    The MaxScale GUI static files are located in the gui/ subdirectory. If the GUI files have been manually moved somewhere else, this path must be configured to point to the parent directory of the gui/ subdirectory.

    The MaxScale REST API only serves files for the GUI that are located in the gui/ subdirectory of the configured sharedir. Any files whose real path resolves to outside of this directory are not served by the MaxScale GUI: this is done to prevent other files from being accessible via the MaxScale REST API. This means that path to the GUI source directory can contain symbolic links but all parts after the /gui/ directory must reside inside it.

    Removed in MaxScale 25.08. In MaxScale 1, this controlled the location where the database users were cached when access to the servers was not possible. This directory has not been used since the MaxScale 2.0 release.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: /run/maxscale

    Configure the directory for the PID file for MariaDB MaxScale. This file contains the Process ID for the running MariaDB MaxScale process.

    MaxScale versions before 24.08.1 used the path /var/run/maxscale/ for the PID files. This was a legacy path according to the Filesystem Hierarchy Standard and starting with MaxScale 24.08.1, the appropriate modern PID file path is used.

    The value of piddir should not be changed when MaxScale is installed from a DEB/RPM package and is run as a SystemD service. The SystemD service file in /lib/systemd/systemd/maxscale.service depends on the PID file being stored at /run/maxscale/maxscale.pid. However, if piddir must be modified to point to a non-default location, it must also be modified in the SystemD service file configuration to point to the new location.

    Removed in MaxScale 25.10.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: OS Dependent

    Location of the MariaDB Connector-C plugin directory. The MariaDB Connector-C used in MaxScale can use this directory to load authentication plugins. The versions of the plugins must be binary compatible with the connector version that MaxScale was built with.

    Starting with version 6.2.0, the plugins are bundled with MaxScale and the default value now points to the bundled plugins. The location where the plugins are stored depends on the operating system. For RHEL versions the value is /usr/lib64/maxscale/plugin/. For Debian and Ubuntu it is /usr/lib/x86_64-linux-gnu/maxscale/plugin/.

    Older versions of MaxScale used /usr/lib/mysql/plugin/ as the default value.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: /var/lib/maxscale/maxscale.cnf.d/

    Configure the directory where persisted configurations are stored. When a new object is created via MaxCtrl, it will be stored in this directory. Do not use this directory for normal configuration files, use /etc/maxscale.cnf.d/ instead. The user MaxScale is running as must be able to write into this directory.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: /etc/maxscale.modules.d/

    Configure the directory where module configurations are stored. Path arguments are resolved relative to this directory. This directory should be used to store module specific configurations.

    Any configuration parameter that is not an absolute path will be interpreted as a relative path. The relative paths use the module configuration directory as the working directory.

    For example, the configuration parameter file=my_file.txt would be interpreted as /etc/maxscale.modules.d/my_file.txt whereas file=/home/user/my_file.txt would be interpreted as /home/user/my_file.txt.

    Removed in MaxScale 25.08. In MaxScale 1, this controlled the location of an internal data file which has not been used since the MaxScale 2.0 release.

    Deprecated since MariaDB MaxScale 23.08.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: System Dependent

    Specifies the maximum size of the query classifier cache. The default limit is 15% of available system memory. The available system memory may be less than the total system memory, if MaxScale is running in a container whose resources have been limited.

    When the query classifier cache has been enabled, MaxScale will, after a statement has been parsed, store the classification result using the canonicalized version of the statement as the key.

    If the classification result for a statement is needed, MaxScale will first canonicalize the statement and check whether the result can be found in the cache. If it can, the statement will not be parsed at all but the cached result is used.

    The configuration parameter takes one integer that specifies the maximum size of the cache. The size of the cache can be specified as explained .

    Note that MaxScale uses a separate cache for each worker thread. To obtain the amount of memory available for each thread, divide the cache size with the value of threads. If statements are evicted from the cache (visible in the diagnostic output), consider increasing the cache size.

    Note also that limit is not a hard limit, but an approximate one. Namely, although the memory needed for storing the canonicalized statement and the classification result is correctly accounted for, there is additional overhead whose size is not exactly known and over which we do not have direct control.

    Using maxctrl show threads it is possible to check what the actual size of the cache is and to see performance statistics.

    Key
    Meaning

    Deprecated since MariaDB MaxScale 23.08.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: false

    Enable or disable the substitution of environment variables in the MaxScale configuration file. If the substitution of variables is enabled and a configuration line like

    is encountered, then $SOME_VALUE will be replaced with the actual value of the environment variable SOME_VALUE. Note:

    • Variable substitution will be made only if '$' is the first character of the value.

    • Everything following '$' is interpreted as the name of the environment variable.

    • Referring to a non-existing environment variable is a fatal error.

    The setting of substitute_variables will have an effect on all parameters in the all other sections, irrespective of where the [maxscale] section is placed in the configuration file. However, in the [maxscale] section, to ensure that substitution will take place, place the substitute_variables=true line first.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: default

    Specifies whether the query classifier parser should initially expect MariaDB or PL/SQL kind of SQL.

    The allowed values are: default: The parser expects regular MariaDB SQL. oracle : The parser expects PL/SQL.

    NOTE If sql_mode is set to oracle, then MaxScale will also assume that autocommit initially is off.

    At runtime, MariaDB MaxScale will recognize statements like

    and

    and change mode accordingly.

    NOTE If set sql_mode=oracle; is encountered, then MaxScale will also behave as if autocommit had been turned off and conversely, if set sql_mode=default; is encountered, then MaxScale will also behave as if autocommit had been turned on.

    Note that MariaDB MaxScale is not explicitly aware of the sql mode of the server, so the value of sql_mode should reflect the sql mode used when the server is started.

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    What specific local address/interface to use when connecting to servers.

    This can be used for ensuring that MaxScale uses a particular interface when connecting to servers, in case the computer MaxScale is running on has multiple interfaces.

    If given as a hostname, MaxScale will perform name lookup on the address when starting and reuse the result.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 30s

    How often, in seconds, MaxScale at most may refresh the users from the backend server.

    MaxScale will at startup load the users from the backend server, but if the authentication of a user fails, MaxScale assumes it is because a new user has been created and will thus refresh the users. By default, MaxScale will do that at most once per 30 seconds and with this configuration option that can be changed. A value of 0 allows infinite refreshes and a negative value disables the refreshing entirely.

    The value is specified as documented . If no explicit unit is provided, the value is interpreted as seconds in MaxScale 2.4. In subsequent versions a value without a unit may be rejected. Note that since the granularity of the timeout is seconds, a timeout specified in milliseconds will be rejected, even if the duration is longer than a second.

    In MaxScale 2.3.9 and older versions, the minimum allowed value was 10 seconds but, due to a bug, the default value was 0 which allowed infinite refreshes.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0s

    How often, in seconds, MaxScale will automatically refresh the users from the backend server.

    This configuration is used to periodically refresh the backend users, making sure they are up to date. The default value for this setting is 0, meaning the users are not periodically refreshed. However, they can still be refreshed in case of failed authentication depending on users_refresh_time.

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0

    How many statements MaxScale should store in memory for each session. This is for debugging purposes, as in case of problems it is often of value to be able to find out exactly what statements were sent before a particular problem turned up.

    Note: See also dump_last_statements using which the actual logging of the statements is enabled. Unless both of the parameters are defined, the statement logging mechanism doesn't work.

    This mechanism is also used to show the currently active queries for sessions in maxctrl show session output as well as in maxctrl list queries.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: on_close

    With this configuration item it is specified in what circumstances MaxScale should write the last statements that a client sent to the log.

    If the statements end up being logged, they are logged into the MaxScale log as notice level log messages well as the system journal, if enabled.

    • never: the statements are never logged and are only kept in memory. The statements are only shown in the REST-API output as well as in maxctrl show sessions.

    • on_error: the statements are logged if the client closes the connection improperly or disconnects unexpectedly.

    Note that you need to specify with retain_last_statements how many statements MaxScale should retain for each session. Unless it has been set to another value than 0, this configuration setting will not have an effect.

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0

    How many log entries are stored in the session specific trace log. This log is written to disk when a session ends abnormally and can be used for debugging purposes. Currently the session trace log is written to the log in the following situations:

    • When MaxScale receives a fatal signal and is about to crash.

    • Whenever an unexpected response is read from a server

    • If the session is not closed gracefully (i.e. client doesn't send a COM_QUIT packet)

    It would be good to enable this if a session is disconnected and the log is not detailed enough. In this case the info log might reveal the true cause of why the connection was closed.

    Default is 0.

    The session trace log is also exposed by REST API and is shown withmaxctrl show sessions.

    The order in which the session trace messages are logged into the log changed in MaxScale 6.4.9 (MXS-4716). Newer versions will log the messages in the "normal log order" of older events coming first and newer events appearing later in the file. Older versions of MaxScale logged the trace dump in the reverse order with the newest messages first and oldest ones last.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    If both session_trace and session_trace_match are defined, and a trace log entry of a session matches the regular expression, the trace log is written to disk and then cleared. This way subsequent matches will only write new log entries.

    In MaxScale versions 24.08 and older, the check for the match was done only when the session was stopping.

    The most effective way to debug MaxScale related issues is to turn on log_info and observe the events written into the MaxScale log. The only problem with this approach is that it can cause a severe performance bottleneck and can easily fill up the disk as the amount of data written to it is significant. With session_trace and session_trace_match, the content that actually gets logged can be filtered to only what is needed.

    For example, the following configuration would only log the trace log messages from sessions that execute SQL queries with syntax errors:

    This could be used to easily identify which applications execute the queries without having to gather the info level log output from all the sessions that connect to MaxScale. For every session that ends up logging a syntax error message, the last 1000 lines of log output done by that session is written into the MaxScale log.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 65536

    High water mark for network write buffer. When the size of the outbound network buffer in MaxScale for a single connection exceeds this value, network traffic throttling for that connection is started. The parameter accepts . The default value was 16777216 bytes before 22.08.4.

    More specifically, if the client side write queue is above this value, it will block traffic coming from backend servers. If the backend side write queue is above this value, it will block traffic from client.

    The buffer that this parameter controls is the buffer internal to MaxScale and is not the kernel TCP send buffer. This means that the total amount of buffered data is determined by both the kernel TCP buffers and the value of writeq_high_water.

    Network throttling is only enabled when writeq_high_water is non-zero. In MaxScale 23.02 and earlier, also writeq_low_water had to be non-zero.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 1024

    Low water mark for network write buffer. Once the traffic throttling is enabled, it will only be disabled when the network write buffer is below writeq_low_water bytes. The parameter accepts . The default value was 8192 bytes before 22.08.4.

    The value of writeq_high_water must always be greater than the value of writeq_low_water.

    • Type:

    • Default: true

    • Dynamic: No

    Persist changes done at runtime. This parameter was added in MaxScale 22.08.0.

    When persist_runtime_changes is enabled, runtime configuration changes done with the GUI, MaxCtrl or via the REST API cause a new configuration file to be saved in /var/lib/maxscale/maxscale.cnf.d/. If load_persisted_configs is enabled, these files will be applied on top of any existing values found in static configuration files whenever MaxScale is starting up.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: true

    Load persisted runtime changes on startup. This parameter was added in MaxScale 2.3.6.

    All runtime configuration changes are persisted in generated configuration files located by default in /var/lib/maxscale/maxscale.cnf.d/ and are loaded on startup after main configuration files have been read. To make runtime configurations volatile (i.e. they are lost when maxscale is restarted), use load_persisted_configs=false. All changes are still persisted since it stores the current runtime state of MaxScale. This makes problem analysis easier if an unexpected outage happens.

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 10

    The maximum number of authentication failures that are tolerated before a host is temporarily blocked. The default value is 10 failures. After a host is blocked, connections from it are rejected for 60 seconds. To disable this feature, set the value to 0.

    Note that the configured value is not a hard limit. The number of tolerated failures is between max_auth_errors_until_block and threads * max_auth_errors_until_block where max_auth_errors_until_block is the configured value of this parameter and threads is the number of configured threads.

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    Define debug options from the --debug command line option. Either the command line option or the parameter should be used, not both. The debug options are only for testing purposes and are not to be used in production.

    • Type:

    • Default: false

    • Dynamic: No

    If enabled, listeners, servers and REST-API must be configured to use SSL. Any static configuration or runtime configuration change that disables SSL will fail. Kafka connections created by the KafkaCDC and KafkaImporter modules must also be configured for SSL. ODBC connection strings used with the REST-API SQL Connection Interface are not affected. Listeners and servers that use Unix socket connections are ignored as they are considered secure even without SSL.

    The MaxScale REST API is an HTTP interface that provides JSON format data intended to be consumed by monitoring applications and visualization tools.

    The following options must be defined under the [maxscale] section in the configuration file.

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: "127.0.0.1"

    The network interface where the REST API listens on. The default value is the IPv4 address 127.0.0.1 which only listens for local connections.

    • Type: number

    • Mandatory: No

    • Dynamic: No

    • Default: 8989

    The port where the REST API listens on. The default value is port 8989.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    A prefix path that is added to all links generated by the REST API. This is useful when MaxScale is served behind a reverse proxy under a sub-path, so that the links the REST API returns resolve correctly on the client side. When left empty, no prefix is added.

    This parameter was added in MaxScale 25.10.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: true

    Enable REST API authentication using HTTP Basic Access authentication. This is not a secure method of authentication without HTTPS but it does add a small layer of security.

    For more information, read the .

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    The path to the TLS private key in PEM format for the admin interface.

    If the admin_ssl_key and admin_ssl_cert options are all defined, the admin interface will use encrypted HTTPS instead of plain HTTP.

    The REST-API only supports PKCS#8 PEM private keys and using a PKCS#1 PEM private key will result in an error. If your private key is in PKCS#1 PEM format, convert it to PKCS#8 PEM format first before starting up MaxScale.

    If the key is protected by a password, the password must be provided with .

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    The path to the TLS public certificate in PEM format. See admin_ssl_key documentation for more details.

    Deprecated since MariaDB MaxScale 22.08. See admin_ssl_ca.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    The path to the TLS CA certificate in PEM format.

    If defined, the certificate is used as an additional CA certificate for all outbound HTTP request that are done when e.g. admin_oidc_url is defined. This can be used when the OIDC server either uses self-signed certificates or the CA is not trusted by default by the operating system.

    This does not enable mTLS in the REST-API which means that client TLS certificates are not validated even if a CA is specified.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    For details, please see that behaves exactly like admin_ssl_passphrase.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: MAX

    This parameter controls the enabled TLS versions in the REST API. Accepted values are:

    • TLSv10

    • TLSv11

    • TLSv12

    MaxScale versions 6.4.16, 22.08.13, 23.02.10, 23.08.6, 24.02.2 and all newer releases accept also the following alias values:

    • TLSv1.0

    • TLSv1.1

    • TLSv1.2

    The default value is MAX which negotiates the highest level of encryption that both the client and server support. The list of supported TLS versions depends on the operating system and what TLS versions the GnuTLS library supports.

    For example, to enable only TLSv1.1 and TLSv1.3, use admin_ssl_version=TLSv1.1,TLSv1.3.

    This parameter was added in MaxScale 2.5.7.

    Older versions of MaxScale interpreted admin_ssl_version as the minimum allowed TLS version. In those versions, admin_ssl_version=TLSv1.2 allowed both TLSv1.2 and TLSv1.3. In MaxScale 6.4.16, 22.08.13, 23.02.10, 23.08.6, 24.02.2 and all newer versions, the value is a enumeration of accepted TLS protocol versions. In these versions, admin_ssl_version=TLSv1.2 only allows TLSv1.2. To retain the old behavior, specify all the accepted values with admin_ssl_version=TLSv1.2,TLSv1.3

    • Type: string

    • Mandatory: No

    • Dynamic: No

    Additional TLS cipher settings. The configured value is prepended to and the resulting string is given as is to . If left undefined, NORMAL is used.

    Adding unrecognized elements to this setting will cause REST-API startup to fail with the error:

    The value should typically start with a collection of ciphersuites, such as "NORMAL" or "SECURE256". Then, add or remove algorithms with more specific cipher definitions such as "+AES-128-GCM" or "-AES-128-GCM".

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    Verify the peer (client) TLS certificate for REST-API connections. This is the REST-API counterpart to the listener parameter.

    When enabled, clients connecting to the REST API must present a certificate, and that certificate is verified against the CA configured with . If admin_ssl_ca is not set, verification is not performed.

    This parameter was added in MaxScale 25.10.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    Verify the peer host for REST-API TLS connections. This is the REST-API counterpart to the listener parameter.

    When enabled, the client's hostname or IP address is verified against the certificate it presents; if they do not match, the connection is closed. If the client does not provide a certificate, host verification is skipped. To require client certificates, also enable .

    This parameter was added in MaxScale 25.10.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: true

    Enable or disable the admin interface. This allows the admin interface to be completely disabled to prevent access to it.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: true

    Enable or disable the admin graphical user interface.

    MaxScale provides a GUI for administrative operations via the REST API. When the GUI is enabled, the root REST API resource (i.e. http://localhost:8989/) will serve the GUI. When disabled, the REST API will respond with a 200 OK to the request. By disabling the GUI, the root resource can be used as a low overhead health check.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: true

    Whether to serve the GUI only over secure HTTPS connections.

    To be secure by default, the GUI is only served over HTTPS connections as it uses a token authentication scheme. This also controls whether the /auth endpoint requires an encrypted connection.

    To allow use of the GUI without having to configure TLS certificates for the MaxScale REST API, set this parameter to false.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    Log authentication failures for the admin interface.

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    Use Pluggable Authentication Modules (PAM) for REST API authentication. This setting and admin_pam_readonly_service accept a PAM service name which is used during authentication if normal authentication fails. admin_pam_readwrite_service should accept users who can do any MaxCtrl/REST-API-operation. admin_pam_readonly_service should accept users who can only do read operations. Because REST-API does not support back and forth communication between the client and MaxScale, the PAM services must be simple. They should only ask for the password and nothing else.

    If only admin_pam_readwrite_service is configured, both read and write operations can be authenticated by PAM. If only admin_pam_readonly_service is configured, only read operations can be authenticated by PAM. If both are set, the service used is determined by the requested operation. Leave or set both empty to disable PAM for REST-API.

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    See .

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: %

    Limit REST-API logins to specific source addresses/hosts. Supports a comma-separated list of addresses and hostnames. Addresses can be given in CIDR-notation. Admin clients still need to supply credentials as usual. By default, all source addresses are allowed. admin_readwrite_hosts lists the hosts from which any operation is allowed.

    This setting was added in MaxScale 24.02.0.

    When listing hostnames, % and _ act as wildcards, similar to the hostname component in MariaDB Server user accounts. localhost is a reserved hostname and will not match any connection (use 127.0.0.1 for loopback connections).

    When checking the source host of the incoming REST-API client, MaxScale first compares against addresses and address masks. If a match was not found and the setting values contain hostnames, reverse name lookup is performed on the client address. The lookup can take a while in rare cases. To prevent such slowdown, use only IP-addresses in the host lists.

    skip_name_resolve cannot be enabled if admin_readwrite_hosts or admin_readonly_hosts includes hostname patterns, as these would not work.

    Works similar to admin_readwrite_hosts. Lists the hosts from which only read operations are allowed. An admin client can do a read operation if their source address matches either admin_readwrite_hosts or admin_readonly_hosts.

    This setting was added in MaxScale 24.02.0.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: auto

    The signature algorithm used by the MaxScale REST API when generating JSON Web Tokens.

    For more information about the tokens and how they work, refer to .

    If a symmetric algorithm is used (i.e. HS256, HS384 or HS512), MaxScale will generate a random encryption key on startup and use that to sign the messages. The symmetric key can also be retrieved from an if the admin_jwt_key parameter is defined.

    If an asymmetric algorithm (i.e. public key authentication) is used, both the admin_ssl_cert and admin_ssl_key parameters must be defined and they must contain a private key and a public certificate of the correct type. If the wrong key type, key length or elliptic curve is used, MaxScale will refuse to start.

    Asymmetric key algorithms make it possible for the clients of the REST API to validate that the token was indeed generated by the correct entity.

    Symmetric algorithms make it easy to share the same tokens between multiple MaxScale instances as the shared secret can be stored in a key management system.

    The possible values for this parameter are:

    • auto

      • MaxScale will attempt to detect the best algorithm to use for signatures. The algorithm used depends on the private key type: RSA keys use PS256, EC keys use the ES256, ES384 or ES512 depending on the curve, Ed25519 keys use ED25519

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    The ID for the encryption key used to sign the JSON Web Tokens. If configured, an must also be configured and it must contain the key with the given ID. If no key is defined, MaxScale will use a random encryption key whenever a symmetric signature algorithm is used.

    Currently, the encryption key is only read on startup. This means that the tokens will be signed by the latest key version that is available on startup: rotating the encryption key in the key management system will not cause the JWTs to be signed with newer versions of the key.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: 24h

    The maximum lifetime of a token generated by the /auth endpoint.

    If a client requests for a token with a lifetime that exceeds the configured value, the token lifetime is silently truncated to this value. This can be used to control the maximum length of a MaxGUI session.

    This also acts as the effective maximum age of any database connection created from the /sql endpoint.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    The URL to a OpenID Connect server that is used for JWT validation.

    If defined, any tokens signed by this server are accepted as valid bearer tokens for the MaxScale REST API. The "sub" field of the token is assumed to be the username of an administrative user in MaxScale and the "account" claim is assumed to be the type of the user: "admin" for administrative users with full access to the REST-API and "basic" for users with read-only access to the REST-API. This means that all users must be first created with maxctrl create user before the tokens are accepted if the OIDC provider is not able to add the "account" claim.

    Modifying admin_oidc_url will cause the certificates to be fetched again. They are also fetched when the maxctrl reload tls command is executed or when the admin_ssl_cert and admin_ssl_key settings are modified.

    MaxScale versions 22.08.16 and earlier only fetched the new certificates when the maxctrl reload tls command was executed.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: auto

    The OpenID Connect authentication flow that's used for authenticating clients when Single Sing-On is being used.

    By default, the choice of the flow is made based on the supported capabilities of the authorization server. The code flow is preferred if it is supported by the authorization server and if it doesn't, the implicit flow is used as a fallback.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    The client ID that's used when doing OpenID Connect requests. When using another MaxScale as the authorization server, this is the REST-API username that's used.

    If client_id is not configured, the value of admin_jwt_issuer is used as the client_id for all OpenID Connect requests.

    • Type: password

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    The client secret that's used when doing OpenID Connect requests. When using another MaxScale as the authorization server, this is the REST-API password that's used.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    Disable TLS certificate validation when fetching OIDC certificates. This should only be enabled when testing with a local OpenID Connect provider with self-signed certificates.

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    Extra options that are added to the initial authorization request. These options are sometimes needed to pass extra information to the identity provider service.

    For , the API that is used must be defined with this setting. For example, if the API name is my-api then admin_oidc_extra_options=audience=my-api should be used.

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    URL to a server to which the REST API token verification is delegated.

    If the URL is defined, any tokens passed to the REST API will be validated by doing a GET request to the URL with the client's token as a bearer token. The Referer header of the request is set to the URL being requested by the client and the custom X-Referrer-Method header is set to the HTTP method being used (PUT, GET etc.).

    Note: When admin_verify_url is used and the remote server cannot be accessed, all REST API access that uses tokens will be disabled. The only way to use the REST API with tokens is to remove admin_verify_url from the configuration which requires restarting MaxScale. The REST API still accepts HTTP Basic Access authentication even if the remote server cannot be reached.

    By delegating the authentication and authorization of the REST API to an external server, users can implement custom access control systems for the MaxScale REST API.

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: maxscale

    The issuer ("iss") claim of all JWTs generated by MaxScale. This can be set to a custom value to uniquely identify which MaxScale issued a JWT. This is especially useful for cases where the MaxScale GUI is used from behind a reverse proxy.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    Enable logging of incoming REST API calls.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: /var/log/maxscale/admin_audit.csv

    The file where the REST API auditing information is logged.

    If a non-default value is used, the directory where the file resides must exist. For example, with /var/log/maxscale/audit_files/audit.csv, the directory /var/log/maxscale/audit_files must exist.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: GET

    List of comma separated HTTP methods to exclude from logging Currently MaxScale does not use CONNECT or TRACE.

    Resetting to log all methods can be done in the configuration file by writing admin_audit_exclude_methods= or at runtime with maxctrl alter maxscale admin_audit_exclude_methods=. Remember that once a runtime change has been made, the entry for that setting is ignored in the main configuration file (usually maxscale.cnf).

    • Type: monitor

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    This parameter controls which cluster (i.e. monitor) is used to synchronize configuration changes between MaxScale instances. The first server labeled Master will be used for the synchronization.

    By default configuration synchronization is not enabled and it must be explicitly enabled by defining a monitor name for config_sync_cluster.

    When config_sync_cluster is defined, config_sync_user and config_sync_password must also be defined.

    For a detailed description of this feature, refer to the section.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    The username for the account that is used to synchronize configuration changes across MaxScale instances. Both this parameter and config_sync_password are required if config_sync_cluster is configured.

    This account must have the following grants:

    The mysql.maxscale_config table can be pre-created in which case the CREATE grant is not needed by the user configured in config_sync_user. The following SQL is used to create the table.

    If the database where the table is created is changed with config_sync_db, the grants must be adjusted to target that database instead.

    • Type: password

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    The password for config_sync_user. Both this parameter and config_sync_user are required if config_sync_cluster is configured. This password can optionally be encrypted using maxpasswd.

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: mysql

    The database where the maxscale_config table is created. By default the table is created in the mysql database. This parameter was added in MaxScale versions 6.4.6 and 22.08.5.

    As tables in the mysql database cannot have triggers on them, the database must be changed to a user-created one in order to create triggers on the table. An example use-case for triggers on this table is to track all configuration changes done to MaxScale by inserting them into a separate table.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 5s

    How often to synchronize the configuration with the cluster.

    As the synchronization involves selecting the configuration version from the database, this value should not be set to an unreasonably low value. The default value of 5 second should provide a good compromise between responsiveness and how much load it places on the database.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 10s

    Timeout for all SQL operations done during the configuration synchronization. If an operation exceeds this timeout, the configuration change is treated as failed and an error is reported to the client that did the change.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    When enabled MaxScale sends telemetry to the OpenTelemetry Collector.

    • Type: stringlist

    • Default: empty

    • Dynamic: Yes

    • Mandatory: No

    Optional global attributes to send with every metric. Example telemetry_attributes=project=default-project,cluster=mariadb1,instance=maxscale1

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 60s

    Minimum interval to send metrics to the collector.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    When enable and SSL certificates are defined, MaxScale OpenTelemetry uses insecure HTTPS and doesn't validate certificates.

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: http://localhost:4318/v1/metrics

    The OpenTelemetrymetrics URL where MaxScale pushes metrics.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    The path to the TLS private key in PEM format for sending telemetry.

    If the telemetry_ssl_ca and telemetry_ssl_cert options are all defined, the sending of metrics will use encrypted HTTPS instead of plain HTTP. If setting SSLm you also must to change the telemetry_url to https as in https://localhost:4318/v1/metrics.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    The path to the TLS public certificate in PEM format. See telemetry_ssl_key and admin_ssl_key for more documentation details.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    The path to a TLS CA certificate in PEM format.

    • Type:

    • Dynamic: Yes

    • Values: none, file, kmip, vault

    The encryption key manager to use. The available encryption key managers are:

    • none - No key manager, encryption keys are not available.

    • file -

    • kmip -

    Refer to the section for more information on how to configure the key managers. The key managers each have their configuration in their own namespace and must have their name as a prefix.

    For example to configure the file key manager, the following must be used:

    MaxScale logs warnings and errors for various reasons and often it is self- evident and generally applicable whether some occurrence should warrant a warning or an error, or perhaps just an info-level message.

    However, there are events whose seriousness is not self-evident. For instance, in some environments an authentication failure may simply indicate that someone has made a typo, while in some other environment that can only happen in case there has been a security breech.

    To handle events like these, MaxScale defines events whose logging facility and level can be controlled by the administrator. Given an event X, its facility and level are controlled in the following manner:

    The above means that if event X occurs, then that is logged using the facility LOG_LOCAL0 and the level LOG_ERR.

    The valid values of facility are the facility values reported byman syslog, e.g.LOG\_AUTH,LOG\_LOCAL0andLOG\_USER. Likewise, the valid values for levelare the ones also reported byman syslog, e.g.LOG\_WARNING,LOG\_ERRandLOG\_CRIT\.

    Note that MaxScale does not act upon the level, that is, even if the level of a particular event is defined to be LOG_EMERG, MaxScale will not shut down if that event occurs.

    The default facility is LOG_USER and the default level is LOG_WARNING.

    Note that you may also have to configure rsyslog to ensure that the event can be logged to the intended log file. For instance, if the facility is chosen to be LOG_AUTH, then /etc/rsyslog.conf should contain a line like

    for the logged events to end up in /var/log/auth.log, where the initialauth is the relevant entry.

    The available events are:

    This event occurs when there is an authentication failure.

    This event occurs when the firewall blocks a query.

    A service represents the database service that MariaDB MaxScale offers to the clients. In general a service consists of a set of backend database servers and a routing algorithm that determines how MariaDB MaxScale decides to send statements or route connections to those backend servers.

    A service may be considered as a virtual database server that MariaDB MaxScale makes available to its clients.

    Several different services may be defined using the same set of backend servers. For example a connection based routing service might be used by clients that already performed internal read/write splitting, whilst a different statement based router may be used by clients that are not written with this functionality in place. Both sets of applications could access the same data in the same databases.

    A service is identified by a service name, which is the name of the configuration file section and a type parameter of service.

    In order for MariaDB MaxScale to forward any requests it must have at least one service defined within the configuration file. The definition of a service alone is not enough to allow MariaDB MaxScale to forward requests however, the service is merely present to link together the other configuration elements.

    • Type: router

    • Mandatory: Yes

    • Dynamic: No

    The router parameter of a service defines the name of the router module that will be used to implement the routing algorithm between the client of MariaDB MaxScale and the backend databases. Additionally routers may also be passed a comma separated list of options that are used to control the behavior of the routing algorithm. The two parameters that control the routing choice are router and router_options. The router options are specific to a particular router and are used to modify the behavior of the router. The read connection router can be passed options of master, slave or synced, an example of configuring a service to use this router and limiting the choice of servers to those in slave state would be as follows.

    To change the router to connect on to servers in the master state as well as slave servers, the router options can be modified to include the master state.

    A more complete description of router options and what is available for a given router is included with the documentation of the router itself.

    • Type: filter list

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    The filters option allow a set of filters to be defined for a service; requests from the client are passed through these filters before being sent to the router for dispatch to the backend server. The filters parameter takes one or more filter names, as defined within the filter definition section of the configuration file. Multiple filters are separated using the | character.

    The requests pass through the filters from left to right in the order defined in the configuration parameter.

    If a value in the filters list is not the name of any object in MaxScale but is the name of a filter which does not have any configuration settings, it is interpreted as an implicit filter. These types of filters will be automatically created whenever they're used in a service. This makes it easy to enable functionality which does not require configuration that is implemented in filters.

    • The created filter will have the same name as the filter module. For example, using filters=hintfilter will automatically create a filter named hintfilter using the hintfilter module and add it to the service.

    • Only filters that have no configuration settings can be implicitly created.

    • Type: target list

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    The targets parameter is a comma separated list of server and/or service names that comprise the routing targets of the service. This parameter was added in MaxScale 2.5.0.

    This parameter allows nested service configurations to be defined without having to configure listeners for all services. For example, one use-case is to use multiple readwritesplit services behind a schemarouter service to have both the sharding of schemarouter with the high-availability of readwritesplit.

    NOTE: The targets parameter is mutually exclusive with the cluster and servers parameters.

    • Type: server list

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    The servers parameter in a service definition provides a comma separated list of the backend servers that comprise the service. The server names are those used in the name section of a block with a type parameter of server (see below).

    NOTE: The servers parameter is mutually exclusive with the cluster and targets parameters.

    • Type: monitor

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    The servers the service uses are defined by the monitor specified as value of this configuration parameter.

    NOTE: The cluster parameter is mutually exclusive with the servers andtargets parameters.

    • Type: string

    • Mandatory: Yes

    • Dynamic: Yes

    This setting defines the user the service uses to fetch user account information from backends. A password is specified using .

    See for more information (such as required grants) and troubleshooting tips regarding user account management and client authentication.

    • Type: string

    • Mandatory: Yes

    • Dynamic: Yes

    This settings defines the password the service uses to fetch user account information from backends. The password may be either a plain text password or an . The user is specified using .

    See for more information (such as required grants) and troubleshooting tips regarding user account management and client authentication.

    From 23.08.0 onwards, MaxScale will remember the previous password when the password is changed. If the fetching of the user account information fails using the new password, it will be attempted using the previous one. The purpose of this change is to make it a smoother operation to change the password of the service user. The steps are as follows:

    1. $ maxctrl alter service MyService password=TheNewPassword

    2. MariaDB [(none)]> set password for TheServiceUser = password('TheNewPassword');

    Since the old password is remembered and used if the new password does not work, it is no longer necessary to perform those steps simultaneously.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    the service should activate right after connecting to a server. If empty, no role is set. This setting may be useful if the same username is used for both monitors and services. As monitors and services require different privileges, these privileges can be granted to the monitor and the service roles separately instead of granting them all to the same user.

    For services, this setting only affects user account fetching from MariaDB Servers. It does not affect router specific connections such as replication by the or replication management by the .

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    This parameter controls the ability of the root user to connect to MariaDB MaxScale and hence onwards to the backend servers via MariaDB MaxScale.

    Deprecated and ignored.

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: None

    This parameter sets a custom version string that is sent in the MySQL Handshake from MariaDB MaxScale to clients.

    Example:

    If not set, MaxScale will attempt to use a version string from the backend databases by selecting the version string of the database with the lowest version number. If the selected version is from the MariaDB 10 series, a 5.5.5- prefix will be added to it similarly to how the MariaDB 10 series versions added it.

    If MaxScale has not been able to connect to a single database and the versions are unknown, the default value of 5.5.5-10.4.32 <MaxScale version>-maxscale is used where <MaxScale version> is the version of MaxScale.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    This parameter controls whether only a single server or all of the servers are used when loading the users from the backend servers.

    By default MaxScale uses the first server labeled as Master as the source of the authentication data. When this option is enabled, the authentication data is loaded from all the servers and combined into one big data set.

    Note: This parameter was deprecated in MaxScale 24.02.0 but it was then un-deprecated as there were still uses for it. Modules that required this to function correctly (e.g. schemarouter) now automatically enable it.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    Note: This parameter has been deprecated in MaxScale 23.08. The stripping of escape characters is in all known cases the correct thing to do.

    This setting controls whether escape characters (\) are removed from database names when loading user grants from a backend server. When enabled, a grant such as grant select on` `test\_`.* to 'user'@'%'; is read as grant select on` `test\_`.* to 'user'@'%';

    This setting has no effect on database-level grants fetched from a MariaDB Server. The database names of a MariaDB Server are compared using the LIKE operator to properly handle wildcards and escaped wildcards. This setting may affect database names in table and column level grants, although these typically do not contain backlashes.

    Some visual database management tools automatically escape some characters and this might cause conflicts when MaxScale tries to authenticate users.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    Enable or disable the logging of authentication failures and warnings. If enabled, messages about failed authentication attempts will be logged with details about who tried to connect to MariaDB MaxScale and from where.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    When enabled, this allows a service to log warning messages even if the global log level configuration disables them.

    Note that disabling the service level logging does not override the global logging configuration: with log_warning=false in the service and log_warning=true globally, warnings will still be logged for all services.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    When enabled, this allows a service to log notice messages even if the global log level configuration disables them.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    When enabled, this allows a service to log info messages even if the global log level configuration disables them.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    When enabled, this allows a service to log debug messages even if the global log level configuration disables them.

    Debug messages are only enabled for debug builds. Enabling log_debug in a release build does nothing.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 28800s

    The wait_timeout parameter is used to disconnect sessions to MariaDB MaxScale that have been idle for too long. The session timeout is set to 28800 seconds by default. A value of zero is interpreted as no timeout.

    This parameter used to be called connection_timeout and this name is still accepted as an alias for wait_timeout. The old name has been deprecated in MaxScale 23.08.

    The default value of wait_timeout changed from 0s to 28800s in MaxScale versions 24.02.5 and 25.01.2 to match the default value of MariaDB ().

    Note that since the granularity of the timeout is seconds, a timeout specified in milliseconds will be rejected, even if the duration is longer than a second.

    This parameter only takes effect in top-level services. A top-level service is the service where the listener that the client connected to points (i.e. the value of service in the listener). If a service defines other services in its targets parameter, the wait_timeout for those is not used.

    The value of wait_timeout in MaxScale should be lower than the lowest wait_timeout value on the backend servers. This way idle clients are disconnected by MaxScale before the backend servers have to close them. Any client-side idle timeouts (e.g. maximum lifetime for connection pools) should be lower than wait_timeout in both MaxScale and MariaDB. This way the client application will end up closing the connection itself which most of the time results in better and more helpful error messages.

    Warning: If a connection is idle for longer than the configured connection timeout, it will be forcefully disconnected and a warning will be logged in the MaxScale log file.

    Example:

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0 in MaxScale, 15 in MaxScale Trial.

    The maximum number of simultaneous connections MaxScale should permit to this service. Any attempt to make more connections after the limit is reached will result in a "Too many connections" error being returned.

    A value of 0 means no limit, which is the default for MaxScale. MaxScale Trial is limited to a maximum of 15 connections per service.

    Warning: In MaxScale 2.5, it is possible that the number of concurrent connections temporarily exceeds the value of max_connections. This has been fixed in MaxScale 6.

    Example:

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    Note: This parameter has been deprecated in MaxScale 23.08 as the feature is now used automatically if needed. In addition, the session tracking no longer needs to be enabled in MariaDB for the transaction state tracking to work correctly.

    Enable transaction state tracking by offloading it to the backend servers. Getting the transaction state from the server will be more accurate for stored procedures or multi-statement SQL that modifies the transaction state non-atomically.

    In general, it is better to avoid using this type of SQL as tracking the transaction state via the server responses is not compatible with features such as transaction_replay in readwritesplit. session_track_trx_state should only be enabled if the default transaction tracking done by MaxScale does not produce the desired outcome.

    This is only supported by MariaDB versions 10.3 or newer. The following must be configured in the MariaDB server in order for this feature to work. Not configuring the MariaDB server with it can result in the transaction state being wrong in MaxScale which can result in data inconsistency.

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: -1

    How many statements MaxScale should store for each session of this service. This overrides the value of the global setting with the same name. If retain_last_statements has been specified in the global section of the MaxScale configuration file, then if it has not been explicitly specified for the service, the global value holds, otherwise the service specific value rules. That is, it is possible to enable the setting globally and turn it off for a specific service, or just enable it for specific services.

    The value of this parameter can be changed at runtime using maxctrl and the new value will take effect for sessions created thereafter.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 300s

    Keep idle connections alive by sending pings to backend servers. This feature was introduced in MaxScale 2.5.0 where it was changed from a readwritesplit-specific feature to a generic service feature. The default value for this parameter is 300 seconds. To disable this feature, set the value to 0.

    The keepalive interval is specified as documented . If no explicit unit is provided, the value is interpreted as seconds in MaxScale 2.5. In subsequent versions a value without a unit may be rejected. Note that since the granularity of the keepalive is seconds, a keepalive specified in milliseconds will be rejected, even if the duration is longer than a second.

    The parameter value is the interval in seconds between each keepalive ping. A keepalive ping will be sent to a backend server if the connection has been idle for longer than the configured keepalive interval.

    Starting with MaxScale 2.5.21 and 6.4.0, the keepalive pings are not sent if the client has been idle for longer than the configured value of connection_keepalive. Older versions of MaxScale sent the keepalive pings regardless of the client state.

    This parameter only takes effect in top-level services. A top-level service is the service where the listener that the client connected to points (i.e. the value of service in the listener). If a service defines other services in its targets parameter, the connection_keepalive for those is not used.

    If the value of connection_keepalive is changed at runtime, the change in the value takes effect immediately.

    As the connection keepalive pings must be done only when there's no ongoing query, all requests and responses must be tracked by MaxScale. In the case of readconnroute, this will incur a small drop in performance. For routers that rely on result tracking (e.g. readwritesplit and schemarouter), the performance will be the same with or without connection_keepalive.

    If you want to avoid the performance cost and you don't need the connection keepalive feature, you can disable it with connection_keepalive=0s.

    • Type:

    • Mandatory No

    • Dynamic: Yes

    • Default: false

    By default, connection keepalive pings are only sent if the client is either executing a query or has been idle for less than the duration configured in connection_keepalive. When this parameter is enabled, keepalive pings are unconditionally sent to any backends that have been idle for longer than connection_keepalive seconds. This option was added in MaxScale 6.4.9 and can be used to emulate the pre-2.5.21 behavior if long-lived application connections rely on the old unconditional keepalive pings.

    Note: if force_connection_keepalive is enabled and connection_keepalive in MaxScale is set to a lower value than the wait_timeout on the database, the client idle timeouts that wait_timeout control are no longer effective. This happens because MaxScale unconditionally sends the pings which make the client behave like it is not idle and thus the connections will never be killed due to wait_timeout.

    • Type:

    • Mandatory No

    • Dynamic: Yes

    • Default: 0s

    This parameter controls how long a network write can stay buffered. This feature is disabled by default.

    When net_write_timeout is configured and data is buffered on a network connection, if the time since the last successful network write exceeds the configured limit, the connection will be disconnected.

    In MaxScale 24.08 and older releases, this only affected the client connections. Backend connections were never disconnected even if they had writes buffered for very long times.

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 50

    max_sescmd_history sets a limit on how many distinct session commands are stored in the session command history. When the history limit is exceeded, the history is either pruned to the last max_sescmd_history command (when prune_sescmd_history is enabled) or the history is disabled and server reconnections are no longer possible.

    The required history size can be estimated by counting the total number of session state modifying commands (e.g SET NAMES) that are used by a client. Note that connectors usually add some commands that aren't visible to the application developer which means a safety margin should be added. A good rule of thumb is to count the expected number of statements and double that number. The default value of 50 is a value that'll work for most applications that do not rely heavily on user variables.

    Starting with MaxScale versions 21.06.18, 22.08.15, 23.02.12, 23.08.8, 24.02.4 and 24.08.1, binary protocol prepared statements do not count towards the max_sescmd_history limit. In practice this means that all binary protocol prepared statements opened by the client are also kept open by MaxScale and are restored whenever a reconnection to a server happens. The limits imposed by max_sescmd_history apply to other text protocol commands e.g. SET NAMES. Note that text protocol prepared statements count as text protocol commands and are thus potentially pruned when history pruning happens. If an application uses a lot of PREPARE stmt FROM <sql> commands, it is recommended that the value of max_sescmd_history is increased accordingly.

    In older versions of MaxScale, binary protocol prepared statements were limited by max_sescmd_history and were also pruned by prune_sescmd_history but this caused problems when the binary protocol prepared statement were pruned while they were still open from the client's point of view. In older versions, the recommended value of max_sescmd_history is the number of state modifying commands plus the maximum number of open prepared statements that any application may use.

    This parameter was moved into the MaxScale core in MaxScale 6.0. The parameter can be configured for all routers that support the session command history. Currently only readwritesplit and schemarouter support it.

    In addition to limiting the number of commands to store, it also acts as a hard limit on the number of packets that may be queued up on a backend before it is closed. Packets are queued while the TCP socket is being opened and when prepared statements are being prepared. In certain rare cases, a slow server may fall behind and not catch up to the rest of the cluster and a backlog of packets forms. In these cases, if more than max_sescmd_history packets are queued, the connection to the server is closed.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    This option enables pruning of the session command history when it exceeds the value configured in max_sescmd_history. When this option is enabled, only a set number of statements are stored in the history. This limits the per-session memory use while still allowing safe reconnections.

    This parameter is intended to be used with pooled connections that remain in use for a very long time. Most connection pool implementations do not reset the session state and instead re-initialize it with new values. This causes the session command history to grow at roughly a constant rate for the lifetime of the pooled connection.

    Starting with MaxScale 23.08, the session command history is also simplified before being stored. The simplification is done by removing repeated occurrences of the same command and only executing the latest one of them. The order in which the commands are executed still remains the same but inter-dependencies between commands are not preserved.

    For example, the following set of commands demonstrates how the history simplification works and how inter-dependencies can be lost.

    In the example, the value of @my_home has a dependency on the value of @my_planet which is lost when the same statement is executed again and the history simplification removes the earlier one.

    This same problem can occur even in older versions of MaxScale that used a sliding window of the history when the window moves past the statement that later statement depended on. If inter-dependent session commands are being used, the history pruning should be disabled.

    Each client-side session that uses a pooled connection only executes a finite amount of session commands. By retaining a shorter history that encompasses all session commands the individual clients execute, the session state of a pooled connection can be accurately recreated on another server.

    When the session command history pruning is enabled, there is a theoretical possibility that upon server reconnection the session states of the connections are inconsistent. This can only happen if the length of the stored history is shorter than the list of relevant statements that affect the session state. In practice the default value of 50 session commands is a fairly reasonable value and the risk of inconsistent session state is relatively low.

    In case the default history length is too short for safe pruning, set the value of max_sescmd_history to the total number of commands that affect the session state plus a safety margin of 10. The safety margin reserves some extra space for new commands that might be executed due to changes in the client side application.

    Starting with MaxScale 24.02.1, the execution of simple session commands done with binary protocol prepared statements are also stored in the history. A simple session command in the binary protocol is one that:

    • Takes no parameters

    • Modifies the session state

    • Is executed while the original prepared statement is still in the history

    The same limitations that apply to the text protocol session commands apply to the binary protocol session commands.

    This parameter was moved into the MaxScale core in MaxScale 6.0. The parameter can be configured for all routers that support the session command history. Currently only readwritesplit and schemarouter support it.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    This option disables the session command history. This way no history is stored and if a replica server fails, the router will not try to replace the failed replica. Disabling session command history will allow long-lived connections without causing a constant growth in the memory consumption.

    This parameter should only be used when either the memory footprint must be as small as possible or when the pruning of the session command history is not acceptable.

    This parameter was moved into the MaxScale core in MaxScale 6.0. The parameter can be configured for all routers that support the session command history. Currently only readwritesplit and schemarouter support it.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    Defines path to a file with additional user accounts for incoming clients. Default value is empty, which disables the feature.

    In addition to querying the backends, MaxScale can read users from a file. This feature is useful when backends have limitations on the type of users that can be created, or if MaxScale needs to allow users to log in even when backends are down (e.g. binlog router). The users read from the file are only present on MaxScale, so logging into backends can still fail. The format of the file is protocol-specific. The following only applies to MariaDB-protocol, which is also the only protocol supporting this feature.

    The file contains json text. Three objects are read from it: user, db and roles_mapping, none of which are mandatory. These objects must be arrays which contain user information similar to the mysql.user, mysql.db and mysql.roles_mapping tables on the server. Each array element must define at least the string fields user and host, which define the user account to add or modify.

    The elements in the user-array may contain the following additional fields. If a field is not defined, it is assumed either empty (string) or false (boolean).

    • password: String. Password hash, similar to the equivalent column on server.

    • plugin: String. Authentication plugin used by client, similar to server.

    • authentication_string: String. Additional authentication info, similar to server.

    The elements in the db-array must contain the following additional field:

    • db: String. Database which the user can access. Can contain % and _ wildcards.

    The elements in the roles_mapping-array must contain the following additional field:

    • role: String. Role the user can access.

    When users are read from both servers and the file, the server takes priority. That is, if user 'joe'@'%' is defined on both, the file-version is discarded. The file can still affect the database grants and roles of 'joe'@'%', as the db and roles_mapping-arrays are read separately and added to existing grant and role lists.

    An example users file is below.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: add_when_load_ok

    Defines when user_accounts_file is read. The value is an enum, either "add_when_load_ok" (default) or "file_only_always".

    "add_when_load_ok" means that the file is only read when users are successfully read from a server. The file contents are then added to the server-based data. If reading from server fails (e.g. servers are down), the file is ignored.

    "file_only_always" means that users are not read from the servers at all and the file contents is all that matters. The state of the servers is ignored. This mode can be useful with the binlog router, as it allows clients to log in and fetch binary logs from MaxScale even when backend servers are down.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: -1s

    Normally, MaxScale only pools backend connections when a session is closed (controlled by server settings persistpoolmax and persistmaxtime). Other sessions can use the pooled connections instead of creating new connections to backends. If connection sharing is enabled, MaxScale can pool backend connections also from running sessions, and re-attach a pooled connection when a session is doing a query. This effectively allows multiple sessions to share backend connections.

    idle_session_pool_time defines the amount of time a session must be idle before its backend connections may be pooled. To enable connection sharing, set idle_session_pool_time to zero or greater. The value can be given in seconds or milliseconds.

    This feature has a significant drawback: when a backend connection is reused, it needs to be restored to the correct state. This means reauthenticating and replaying session commands. This can add a significant delay before the connection is actually ready for a query. If the session command history size exceeds the value of max_sescmd_history, connection sharing is disabled for the session.

    This feature should only be used when limiting the backend connection count is a priority, even at the cost of query delay and throughput. This feature only works when the following server settings are also set in MaxScale configuration:

    Since reusing a backend connection is an expensive operation, MaxScale only pools connections when another session requires them. idle_session_pool_time thus effectively limits the frequency at which a connection can be moved from one session to another. Setting idle_session_pool_time=0ms causes MaxScale to move connections as soon as possible.

    See below for more information on configuring connection sharing.

    Details, limitations and suggestions for connection sharing

    As noted above, when a connection is pooled and reused its state is lost. Although session variables and prepared statements are restored by replaying session commands, some state information cannot be transferred.

    The most common such state is a transaction. When a transaction is on, connection sharing is disabled for that session until the transaction completes. Other similar situations may not be properly detected, and it's the responsibility of the user to avoid introducing such state to the session when using connection sharing. This means that the following should not be used:

    • Statements such as LOCK TABLES and GET LOCK or any other statement that introduces state into the connection.

    • Temporary tables and some problematic user or session variables such as LAST_INSERT_ID(). For LAST_INSERT_ID(), the value returned by the connector must be used instead of the variable.

    Several settings affect connection sharing and its effectiveness. Reusing a connection is an expensive operation so its frequency should be minimized. The important configuration settings in addition to idle_session_pool_time are MaxScale server settings , and . The service settings , and also have an effect. These settings should be tuned according to the use case.

    persistpoolmax limits how many connections can be kept in a pool for a given server. If the pool is full, no more connections are detached from sessions even if they are idle and required. The pool size should be large enough to contain any connections being transferred between sessions, but not be greater than max_routing_connections. Using the value of max_routing_connections is a reasonable starting point.

    persistmaxtime limits the time a connection may stay in the pool. This should be high enough so that pooled connections are not unnecessarily closed. Cleaning up clearly unneeded connections from the pool may be useful when max_routing_connections is restrictively tuned. Because each MaxScale routing thread has its own connection pool, one thread can monopolize access to a server. For example, if the pool of thread 1 has 100 connections to ServerA with max_routing_connections=100, other threads can no longer connect to the server. In such a situation, reducing persistmaxtime of ServerA may help as it would cause unneeded connections in the pool to be closed faster. Such connection slots then become available to other routing threads. Reducing the number of may also help, as it reduces pool fragmentation. This may reduce overall throughput, though. When using connection sharing, backend connections are only in the pool momentarily. Consequently, persistmaxtime can be set quite low, e.g. 10s.

    If a client session exceeds max_sescmd_history (default 50), pooling is disabled for that session. If many sessions do this and max_routing_connections is set, other sessions will stall as they cannot find a backend connection. This can be avoided with prune_sescmd_history. However, pruning means that old session commands will not be replayed when a pooled connection is reused. If the pruned commands are important (e.g. statement preparations), the session may fail later on.

    If the number of clients actively running queries is greater than max_routing_connections, query throughput will suffer as clients will need to take turns. In this situation, it's imperative to minimize the number of backend connections a single session uses. The settings to achieve this depend on the router. For ReadWriteSplit the following should be used:

    The above settings mean that MaxScale can process roughly (number of replica servers X max_routing_connections) read queries simultaneously. Write queries will still need to take turns as there is only one primary server.

    The following configuration snippet shows example server and service configurations for connection sharing with ReadWriteSplit.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 60s

    When connection sharing (as described above) is on, clients may have to wait for their turn to use a backend connection. If too much time passes without a connection becoming available, MaxScale returns an error to the client, usually also ending the session. multiplex_timeout sets this timeout. Increase it if queries are failing with "Timed out when waiting for a connection". Decrease it if failing early is preferable to stalling.

    Filters provide a means to manipulate or process requests as they pass through MariaDB MaxScale between the client side protocol and the query router. A full explanation of each filter's functionality can be found in its documentation.

    • Type: filter

    • Mandatory: Yes

    • Dynamic: No

    The module parameter defines the name of the filter module that is added to the routing chain.

    Server sections define the backend database servers MaxScale uses. A server is identified by its section name in the configuration file. The only mandatory parameter of a server is type, but address and port are also usually defined. A server may be a member of one or more services. A server may only be monitored by at most one monitor.

    For a complete list of server configuration parameters, see the .

    Limitations:

    • MaxScale: No limitations.

    • MaxScale Trial: At most 3 servers can be created.

    Monitor sections are used to define the monitoring module that watches a set of servers. Each server can only be monitored by one monitor.

    Common monitor parameters .

    A listener defines a port MaxScale listens on for incoming connections. Accepted connections are linked with a MaxScale service. Multiple listeners can feed the same service. Mandatory parameters are type, service and protocol. address is optional, it limits connections to a certain network interface only. socket is also optional and is used for Unix socket connections.

    The network socket where the listener listens may have a backlog of connections. The size of this backlog is controlled by the net.ipv4.tcp_max_syn_backlog and net.core.somaxconn kernel parameters.

    Increasing the size of the backlog by modifying the kernel parameters helps with sudden connection spikes and rejected connections. For more information see .

    For a complete list of listener configuration parameters, see the .

    An include section defined common parameters used in other configuration sections. Consider the following configuration.

    The two monitor sections are identical except for the servers setting. If they otherwise should remain identical, a change must be made in two places. With an include section the situation can be simplified.

    With an include section, all common settings can be defined in one place, and then included to any number of other sections using the @include parameter.

    The @include parameter takes a list of section names, so the settings can be distributed across several include sections.

    It is permissible to specify in the including section, parameters that have already been specified in the included section and they will take precedence. For instance, if Monitor2 in the example above should have a longer backend connect timeout it can be specified as follows.

    Note that an included section must be an include section and that an include section cannot include another include section. For instance, both of the following sections would cause an error at startup.

    Note also that if an included parameter is changed using maxctrl, it will be changed only on the actual object the change is applied on, not on the include section where the parameter is originally specified.

    Protocol modules in MaxScale define what kind of clients can connect to a listener and what type of backend servers are supported. Protocol is defined in listener settings, and affects both the listener and any services the listener is linked to.

    Implements MariaDB protocol. The listener will accept MariaDB/MySQL connections from clients and route the client queries through a linked MaxScale service to backend servers. The backends used by the service should be MariaDB servers or compatible.

    See for more information.

    Accepts MongoDB® connections, yet stores and fetches results to/from MariaDB servers. See for more information.

    This section describes TLS/SSL-related configuration parameters for both servers and listeners.

    To enable TLS/SSL for a listener or server, set the ssl parameter to true. If the clients expect a specific certificate from MaxScale, set the ssl_cert and ssl_key parameters for the listener. If the certificate is not defined, MaxScale will use an auto-generated self-signed certificate. The generated certificate can pass verification when used with a recent (11.4 or greater) client version.

    If the backend database server has certificate verification enabled, configure the ssl_cert and ssl_key parameters of the server.

    Custom CA certificates can be defined with the ssl_ca parameter. If ssl_verify_peer_certificate is enabled yet ssl_ca is not set, MaxScale will load CA certificates from the system default location.

    After this, MaxScale connections between the server and/or the client will be encrypted. Note that the database must also be configured to use TLS/SSL connections if backend connection encryption is used.

    Note: MaxScale does not allow mixed use of TLS/SSL and normal connections on the same port.

    If TLS encryption is enabled for a listener, any unencrypted connections to it will be rejected. MaxScale does this to improve security by preventing accidental creation of unencrypted connections.

    The separation of secure and insecure connections differs from the MariaDB Server which allows both secure and insecure connections on the same port. As MaxScale is the gateway through which all connections go, MaxScale enforces a stricter security policy than MariaDB Server. Multiple listeners with different configurations can be created to enable different encryption schemes.

    TLS encryption must be enabled for listeners when they are created. For servers, the TLS can be enabled after creation but it cannot be disabled or altered.

    Starting with MaxScale 2.5.20, if the TLS certificate given to MaxScale has the X509v3 extended key usage information, MaxScale will check it and refuse to use a certificate with the wrong usage. This means that a certificate with only clientAuth can only be used with servers and a certificate with only serverAuth can only be used with listeners. In order to use the same certificate for both listeners and servers, it must have both the clientAuth and serverAuth usages.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    This enables SSL connections when set to true. The legacy values required and disabled were removed in MaxScale 6.0.

    Starting with MaxScale 21.06.18, 22.08.15, 23.02.12, 23.08.8, 24.02.4 and 24.08.1, if ssl is disabled for a listener, MariaDB user accounts that require ssl cannot log in through that listener. Any user account with a non-empty ssl_type-field in mysql.user-table is blocked. This includes users created with REQUIRE SSL or REQUIRE X509.

    • Type: path

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    A string giving a file path that identifies an existing readable file. The file must be the SSL certificate private key MaxScale should use. This is an optional parameter for listeners but an optional parameter for servers.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    If the private key specified using requires a password, it should be provided with ssl_passphrase. The setting supports 3 different ways for providing the passphrase, indicated by the used prefix:

    • env:string: The string is the name of an environment variable specifying the password.

    • file:string: The string is the path of a file containing the password.

    • pass:string: The string is the password.

    In the case of file, the password is assumed to be the first read line, excluding a trailing line-feed. Any additional data is ignored. A failure to read the line will cause errors to be logged, but will not cause MaxScale to terminate.

    It is an error, not to provide a prefix.

    Examples:

    • Type: path

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    A string giving a file path that identifies an existing readable file. The file must be the SSL certificate MaxScale should use. The certificate must match the key defined in ssl_key. This is an optional parameter for listeners and servers.

    Deprecated since MariaDB MaxScale 22.08. See ssl_ca.

    • Type: path

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    A string giving a file path that identifies an existing readable file. The file must be a Certificate Authority (CA) certificate. It will be used to verify that the peer certificate (sent by either client or a MariaDB Server) is valid. The CA certificate can consist of a certificate chain.

    NOTE Up until MariaDB MaxScale 6, the parameter was called ssl_ca_cert, which is still accepted as an alias for ssl_ca.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: MAX

    This parameter controls the allowed TLS version. Accepted values are:

    • TLSv10

    • TLSv11

    • TLSv12

    MaxScale versions 6.4.16, 22.08.13, 23.02.10, 23.08.6, 24.02.2 and all newer releases accept also the following alias values:

    • TLSv1.0

    • TLSv1.1

    • TLSv1.2

    The default setting (MAX) allows all supported versions. MaxScale supports TLSv1.0, TLSv1.1, TLSv1.2 and TLSv1.3 depending on the OpenSSL library version. TLSv1.0 and TLSv1.1 are considered deprecated and should not be used, so setting ssl_version=TLSv1.2,TLSv1.3 or ssl_version=TLSv1.3 is recommended.

    In MaxScale versions 6.4.13, 22.08.11, 23.02.7, 23.08.3 and earlier, this setting defined the only allowed TLS version, e.g. ssl_version=TLSv12 would only enable TLSv12. The interpretation changed in MaxScale versions 6.4.14, 22.08.12, 23.02.8, 23.08.4 to enable the user to disable old versions while allowing multiple recent TLS versions. In these versions, ssl_version=TLSv1.2 enabled both TLSv1.2 and TLSv1.3.

    The interpretation changed again in MaxScale versions 6.4.16, 22.08.13, 23.02.10, 23.08.6, 24.02.2. In these versions the value of ssl_version is an enumeration of accepted TLS protocol versions. This means that admin_ssl_version=TLSv1.2 again only allows TLSv1.2. To retain the behavior from the previous releases where the newer versions were automatically enabled, the protocol versions must be explicitly listed, for example admin_ssl_version=TLSv1.2,TLSv1.3. The change was done to make the ssl_version behave identically to how the MariaDB parameter works.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    Set the list of TLS ciphers. By default, no explicit ciphers are defined and the system defaults are used. Note that this parameter does not modify TLSv1.3 ciphers.

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 9

    The maximum length of the certificate authority chain that will be accepted. The default value is 9, same as the OpenSSL default. The configured value must be larger than 0.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    Peer certificate verification. This functionality is disabled by default. In versions prior to 2.3.17 the feature was enabled by default.

    When this feature is enabled, the peer (client or MariaDB Server) must send a certificate. The certificate sent by the peer is verified against the configured Certificate Authority to ensure the peer is who they claim to be. For listeners, this behaves as if REQUIRE X509 was defined for all users.

    If this feature is enabled for a server yet ssl_ca is not set, MaxScale will attempt to verify the backend server certificate after authentication as explained . This verification method is only supported with MariaDBAuth and Ed25519Auth and requires MariaDB Server version 11.4 or later.

    • Type:

    • Mandatory No

    • Dynamic: Yes

    • Default: false

    Peer host verification.

    When this feature is enabled, the peer (client or MariaDB Server) hostname or IP is verified against the certificate sent by the peer. If the IP address or the hostname does not match the one in the certificate, the connection is closed.

    If the peer does not provide a certificate, host verification is skipped. To require peer certificates, also enable ssl_verify_peer_certificate. For servers, the combination of

    behaves like the --ssl-verify-server-cert command line option for the mysql client.

    • Type: path

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    A string giving a file path that identifies an existing readable file. The file must be a Certificate Revocation List in the PEM format that defines the revoked certificates. This parameter is only accepted by listeners.

    Example SSL enabled server configuration

    This example configuration requires all connections to this server to be encrypted with SSL. The paths to the certificate files and the Certificate Authority file are also provided.

    Example SSL enabled listener configuration

    This example configuration requires all connections to be encrypted with SSL. The paths to the certificate files and the Certificate Authority file are also provided.

    The main task of MariaDB MaxScale is to accept database connections from client applications and route the connections or the statements sent over those connections to the various services supported by MariaDB MaxScale.

    Currently a number of routing modules are available, these are designed for a range of different needs.

    Connection based load balancing:

    Read/Write aware statement based router:

    Simple sharding on database level:

    Binary log server:

    Monitor modules are used by MariaDB MaxScale to internally monitor the state of the backend databases in order to set the server flags for each of those servers. The router modules then use these flags to determine if the particular server is a suitable destination for routing connections for particular query classifications. The monitors are run within separate threads of MariaDB MaxScale and do not affect MariaDB MaxScale's routing performance.

    The use of monitors in MaxScale is not absolutely mandatory: it is possible to run MariaDB MaxScale without a monitor module. In this case an external monitoring system must the status of each server via MaxCtrl or the REST API. Only do this if you know what you are doing.

    A client's query passes through the router session's QLA and Regex filters on its way to the backend server, with QLA also logging the query.

    Filters provide a means to manipulate or process requests as they pass through MariaDB MaxScale between the client side protocol and the query router. A full explanation of each filter's functionality can be found in its documentation.

    The document shows how you can add a filter to a service and combine multiple filters in one service.

    Passwords stored in the maxscale.cnf file may optionally be encrypted for added security. This is done by creation of an encryption key on installation of MariaDB MaxScale. Encryption keys may be created manually by executing the maxkeys utility with the argument of the filename to store the key. The default location MariaDB MaxScale stores the keys is /var/lib/maxscale. The passwords are encrypted using 256-bit AES CBC encryption.

    Changing the encryption key for MariaDB MaxScale will invalidate any currently encrypted keys stored in the maxscale.cnf file.

    Note: The password encryption format changed in MaxScale 2.5. All encrypted passwords created with MaxScale 2.4 or older need to be re-encrypted.

    Encrypted passwords are created by executing the maxpasswd command with the location of the .secrets file and the password you require to encrypt as an argument.

    The output of the maxpasswd command is a hexadecimal string, this should be inserted into the maxscale.cnf file in place of the ordinary, plain text, password. MariaDB MaxScale will determine this as an encrypted password and automatically decrypt it before sending it the database server.

    The and documents provide information about making runtime changes.

    All changes to the configuration done via MaxCtrl are persisted as individual configuration files in /var/lib/maxscale/maxscale.cnf.d/. The content of these files will override any configurations found in the main configuration file or any auxiliary configuration files.

    Refer to the section for more details on how this mechanism works and how to disable it.

    The configuration synchronization mechanism is intended for synchronizing configuration changes done on one MaxScale to all other MaxScales. This is done by propagating the changes via the database cluster used by Maxscale.

    When configuring configuration synchronization for the first time, the same static configuration files should be used on all MaxScale instances that use the same cluster: the value of config_sync_cluster must be the same on all MaxScale instances and the cluster (i.e. the monitor) pointed by it and its servers must be the same in every configuration.

    Whenever the MaxScale configuration is modified at runtime, the latest configuration is stored in the database cluster in the mysql.maxscale_config table. The table is created when the first modification to the configuration is done. A local copy of the configuration is stored in the data directory to allow MaxScale to function even if a connection to the cluster cannot be made. By default this file is stored at /var/lib/maxscale/maxscale-config.json.

    Whenever MaxScale starts up, it checks if a local version of this configuration exists. If it does and it is a valid cached configuration, the static configuration file as well as any other generated configuration files are ignored. The exception is the [maxscale] section of the main static configuration file which is always read.

    Each configuration has a version number with the initial configuration being version 0. Each time the configuration is modified, the version number is incremented. This version number is used to detect when MaxScale needs to update its configuration.

    When doing a configuration change on the local MaxScale, if the configuration change completes on MaxScale but fails to be committed to the database, MaxScale will attempt to revert the local configuration change. If this attempt fails, MaxScale will discard the cached configuration and abort the process.

    When synchronizing with the cluster, if MaxScale fails to apply a configuration retrieved from the cluster, it attempts to revert the configuration to the previous version. If successful, the failed configuration update is ignored. If the configuration update that fails cannot be reverted, the MaxScale configuration will be in an indeterminate state. When this happens, MaxScale will discard the cached configuration and abort the process.

    When loading a locally cached configuration during startup, if any errors are found in the cached configuration, it is discarded and the MaxScale process will attempt to restart by exiting with code 75 from the main process. If MaxScale is being used as a SystemD service, this will automatically trigger a restart of MaxScale and no further actions are needed.

    The most common reason for a failed configuration update is missing files. For example, if a configuration update adds encrypted connections to a server and the TLS certificates it uses were not copied over to all MaxScale nodes before the change was done, the operation will fail on all nodes that do not have these files.

    If the synchronization of the configuration change fails at the step when the database transaction is being committed, the new configuration can be momentarily visible to the local MaxScale. This means the changes are not guaranteed to be atomic on the local MaxScale but are atomic from the cluster's point of view.

    Starting with MaxScale 6.4.9, any passwords that are transmitted by the configuration synchronization are encrypted if password encryption has been enabled in MaxScale. This means that all MaxScale nodes in the same configuration cluster must be configured to use password encryption and they need to all use the same encryption keys that were created with maxkeys.

    The output of maxctrl show maxscale contains the Config Sync field with information about the current configuration state of the local Maxscale as well as the state of any other nodes using this cluster.

    The version field is the logical configuration version and the origin is the node that originates the latest configuration change. The checksum field is the checksum of the logical configuration and can be used to compare whether two Maxscale instances are in the same configuration state. The nodes field contains the status of each MaxScale instance mapped to the hostname of the server. This field is updated whenever MaxScale reads the configuration from the cluster and can thus be used to detect which MaxScales have updated their configuration.

    The mysql.maxscale_config table where the configuration changes are stored must not be modified manually. The only case when the table should be modified is when resetting the configuration synchronization.

    To reset the configuration synchronization:

    1. Stop all MaxScale instances

    2. Remove the cached configuration file stored at /var/lib/maxscale/maxscale-config.json on all MaxScale instances

    3. Drop the mysql.maxscale_config table

    To disable configuration synchronization, remove config_sync_cluster from the configuration file or set it to an empty string: config_sync_cluster="". This can be done at runtime with MaxCtrl by passing an empty string to config_sync_cluster:

    If MaxScale cannot create a connection to the database cluster, configuration changes are not possible until communication with the database is possible. To override this behavior and force the changes to be done, use the --skip-sync option for maxctrl or the sync=false HTTP parameter for the REST API. Any updates done with --skip-sync will overwritten by changes coming from the cluster.

    Only the MaxScale configuration is synchronized. Any external files (TLS certificates, configuration files for modules or data generated by MaxScale) are not synchronized. For example, the rule files for the cache filter must be synchronized separately if the filter itself is modified.

    Starting with MaxScale 22.08, the Maintenance and Draining states of servers and modifications to the administrative users will be synchronized. In older versions servers had to be put into maintenance mode and users had to be modified separately on each MaxScale.

    • () External files are not synchronized.

    • () The --export-config option will not export the cluster configuration and instead exports only the static configuration files. To start a new MaxScale based off of a clustered configuration, copy the static configuration files as well as the JSON configuration in /var/lib/maxscale/maxscale-config.json to the new MaxScale instance.

    The combination of configuration files can be done either manually (e.g. rsync) or with the maxscale --export-config=FILE command line option. See maxscale --help for more information about how to use the --export-config flag.

    For example, to export the current runtime configuration, run the following command.

    This will create the /tmp/maxscale.cnf.combined file and write the current configuration into the it. This allows new MaxScale instances to be easily set up without requiring copying of all runtime configuration files. The user executing the command must be able to read all MaxScale configuration files as well as create and write the provided filename.

    The encryption key managers are how MaxScale retrieves symmetric encryption keys from a key management system. Some parts of MaxScale require the key_manager to be configured in order to work. The key manager that is used is selected with the parameter and the key manager itself is configured by placing the parameters in the [maxscale] section.

    The encryption key managers can be enabled at runtime using maxctrl alter maxscale but cannot be disabled once enabled. To disable the encryption key management, stop Maxscale, remove any persisted configuration files and remove key_manager as well as any key manager options from the static configuration files.

    The encryption keys are stored in a text file stored on a local filesystem.

    The file uses the same format as the MariaDB server : a file consisting of an encryption key ID number and the hex-encoded encryption key separated by a semicolon. Read for more details on how to create the file.

    For example, to configure encryption for the nosqlprotocol shared credentials using the file-based encryption key:

    1. Create the key file with (echo -n '1;' ; openssl rand -hex 32) | cat > /var/lib/maxscale/encryption.key

    2. Give MaxScale read permissions on it with chown maxscale:maxscale /var/lib/maxscale/encryption.key

    3. Configure MaxScale with the following:

    1. Start MaxScale

    • Key versioning is not supported

    file.keyfile

    • Type: path

    • Mandatory: Yes

    • Dynamic: Yes

    Path to the file that contains the encryption keys. The user MaxScale runs as (almost always maxscale) must be able to read this file. Encryption keys are read from disk only during startup or when any global MaxScale parameter is modified at runtime.

    Encryption keys are read from a KMIP server.

    The KMIP key manager has been verified to work with the PyKMIP server.

    • Key versioning is not supported

    • Encryption keys are not cached locally: whenever MaxScale needs an encryption key, it retrieves it from the KMIP server.

    kmip.host

    • Type: string

    • Mandatory: Yes

    • Dynamic: Yes

    The host where the KMIP server is.

    kmip.port

    • Type: integer

    • Mandatory: Yes

    • Dynamic: Yes

    The port on which the KMIP server listens on.

    kmip.cert

    • Type: path

    • Mandatory: Yes

    • Dynamic: Yes

    The client public certificate used when connecting to the KMIP server.

    kmip.key

    • Type: path

    • Mandatory: Yes

    • Dynamic: Yes

    The client private key used when connecting to the KMIP server.

    kmip.ca

    • Type: path

    • Default: ""

    • Dynamic: Yes

    The CA certificate to use. By default the system default certificates are used.

    Encryption keys are read from a local or remote Vault server using the secret engine included in the Vault. This key manager supports versioned keys. Only version 2 key-value stores are supported.

    The encryption keys use the same format as the MariaDB The key-value secret for each encryption key ID must contain the field data which must contain a hex-encoded string that is either 32, 48 or 64 characters long.

    An easy way to generate a correct encryption key is to use the vault and openssl command line clients. The following command creates a 256-bit encryption key using openssl and stores it using the key ID 1:

    • Encryption keys are not cached locally: whenever MaxScale needs an encryption key, it retrieves it from the Vault server.

    vault.token

    • Type: password

    • Mandatory: Yes

    • Dynamic: Yes

    The authentication token used to connect to the Vault server. This can be encrypted using maxpasswd, similar to how other passwords are encrypted.

    vault.host

    • Type: string

    • Default: localhost

    • Dynamic: Yes

    The host where the Vault server is.

    vault.port

    • Type: integer

    • Default: 8200

    • Dynamic: Yes

    The port on which the Vault server listens on.

    vault.ca

    • Type: path

    • Default: ""

    • Dynamic: Yes

    The CA certificate to use. By default the system default certificates are used.

    vault.tls

    • Type:

    • Default: true

    • Dynamic: Yes

    Whether to use encrypted connections (i.e. HTTPS or HTTP) when communicating with the Vault server.

    vault.mount

    • Type: string

    • Default: secret

    • Dynamic: Yes

    The Key-Value mount where the secret is stored. By default the secret mount is used which is present by default in most Vault installations.

    vault.timeout

    • Type:

    • Default: 30s

    • Dynamic: Yes

    The connection and request timeout used with the Vault server.

    For routing, MaxScale uses asynchronous I/O and a fixed number of threads (aka routing workers), whose number up until 23.02 was fixed at startup. From 23.02 onwards the number of threads can be altered at runtime, which is convenient, for instance, if MaxScale is running in a container whose properties are changed during the lifetime of the container.

    A thread can be in three different states:

    • Active: The thread is routing client traffic and is listening for new connections.

    • Draining: The thread is routing client traffic but is not listening for new connections.

    • Dormant: The thread is not routing client traffic (all sessions have ended), and is not listening for new connections, and is waiting to be terminated.

    All threads start as Active and may become Draining if the number of threads is reduced. A draining thread will eventually become Dormant, unless the number of threads is increased while the thread is still Draining.

    Note that it is not possible to terminate a specific thread, but it is only possible to specify the number of threads that MaxScale should use, and that the threads will be terminated from the end. This has implications if the number of threads is reduced by more than 1, as a Dormant thread will not be terminated before it is the last thread.

    In the following, MaxScale has been started with threads=4.

    All threads are Active. If we now decrease the number of threads

    we will see that the threads 2 and 3 are now Draining. The reason is that threads 2 and 3 still handle client sessions. If some client sessions now end, the situation may become like

    That is, thread 2 is Dormant and thread 3 is Draining. All client sessions that were handled by thread 2 have ended and the thread is ready to be terminated. However, as thread 3 is still Draining, thread 2 will not be terminated but stay Dormant.

    If the sessions handled by thread 3 end, then it will become Dormant at which point first thread 3 will be terminated and immediately after that thread 2.

    If the situation is like

    that is, the number of threads was 4 but has been reduced to 2, and while thread 2 has become drained it stays as Dormant since thread 3 is still Draining, it is possible to make thread 2 Active again by increasing the number of threads to 3.

    Once the sessions of thread 3 ends, we will have

    MariaDB MaxScale is designed to be executed as a service, therefore all error reports, including configuration errors, are written to the MariaDB MaxScale error log file. By default, MariaDB MaxScale will log to a file in /var/log/maxscale and the system log.

    The current limitations of MaxScale are listed in the document.

    • Tune query_classifier_cache_size to allow maximal use of the query classifier cache. Increase the value and/or system memory until the set of unique SQL patterns fits into memory. By default at most 15% of the system memory is used for this cache. To detect if the SQL statements fit into memory, monitor the QC cache evictions value in maxctrl show threads to see how many evictions take place. If it keeps increasing, increase the size of the query classifier cache. Using the query classifier cache with a CPU bound workload gives a roughly 20% improvement in performance compared to when it is turned off.

    • A faster CPU with more CPU cores is better. This is true for most applications but especially for MaxScale as it is mostly limited by the speed of the CPU. Using threads=auto

    From 22.08.2 onwards, maxctrl show maxscale shows a System object with information about the system MaxScale is running on. The fields are:

    Field
    Meaning

    In addition there is an os object that contains what the Linux command uname displays.

    threads

    If threads has not been specified at all in the MaxScale configuration file, or if its value is auto, then MaxScale will use as many routing threads as there are physical cores on the machine. This is the right choice, if MaxScale is running on a dedicated machine or in a container that has not been restricted in any way.

    However, if the number of cores available to MaxScale have been restricted or if MaxScale is running in a container whose CPU quota and period have been limited, then it will lead to MaxScale using more routing threads than what is appropriate in the environment where it is running.

    If machine.cores_virtual is less than machine.cores_physical, then threads should be specified explicitly in the MaxScale configuration file and its value should be that of machine.cores_virtual rounded up to the nearest integer. If that value is 1 it may be beneficial to check whether 2 gives better performance.

    query_classifier_cache_size

    If query_classifier_cache_size has not been specified in the MaxScale configuration file, then MaxScale will use at most 15% of the amount of physical memory in the machine for the cache. This is a good starting point, if MaxScale is running on a dedicated machine or in a container that has not been restricted in any way. Note that the amount specifies how much memory the cache at maximum is allowed to use, not what would immediately be allocated for the cache.

    However, if the amount of memory available to MaxScale has been restricted, which may be the case if MaxScale is running in a container, this may cause the cache to grow beyond what is available, which will lead to a crash or MaxScale being killed.

    If the value of machine.memory_available is less than that of machine.memory_physical, then query_classifier_cache_size should be explicitly set to 15% of maxscale.memory_available. The value can be larger, but must not be a bigger share of machine.memory_available than what is reasonable.

    As can be seen, maxscale.threads is larger than machine.cores_virtual and thus, threads=4 should explicitly be specified in the MaxScale configuration file.

    maxscale.query_classifier_cache_size is the default 15% of machine.memory_physical but as machine.memory_available is just half of that, something like query_classifier_cache_size=3100000000 (~15% of machine.memory_available) should be added to the configuration file.

    For a list of common problems and their solutions, read the article on the MariaDB documentation.

    If MaxScale is running as a systemd service, the systemd Watchdog will be enabled by default. To configure it, change the WatchdogSec option in the Service section of the maxscale systemd configuration file located in /lib/systemd/system/maxscale.service:

    It is not recommended to use a watchdog timeout less than 30 seconds. When enabled MaxScale will check that all threads are running and notify systemd with a "keep-alive ping".

    Systemd reference:

    This page is licensed: CC BY-SA / Gnu FDL

    Draining

    The server is being drained. Existing connections can continue to be used, but no new connections will be created to the server. Typically this status bit is turned on manually using maxctrl, but a monitor may also turn it on.

    Drained

    The server has been drained. The server was being drained and now the number of connections to the server has dropped to 0.

    Auth Error

    The monitor cannot login and query the server due to insufficient privileges.

    Maintenance

    The server is under maintenance. Typically this status bit is turned on manually using maxctrl, but it will also be turned on for a server that for some reason is blocking connections from MaxScale. When a server is in maintenance mode, no connections will be created to it and existing connections will be closed.

    Slave of External Master

    The server is a replica of a primary that is not being monitored.

    Master Stickiness

    The server is monitored by a galeramon with disable_master_failback=true. See for more information.

    admin_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

  • grep -E
    uses.
  • case: Turns on case-sensitive matching. This means that /SELECT/ will not match select.

  • enable-statement-logging

    Allows logging of all SQL statements

    disable-statement-logging

    Disables SQL statement logging

    enable-cors

    Enables Cross-Origin Resource Sharing (CORS) support

    cors-allow-origin

    Specifies COR's allowed origin

    allow-duplicate-servers

    Multiple servers can use the same address and port

    gdb-stacktrace

    Enables the generation of gdb stacktraces upon crash

    sql-batch-size

    Determines the batch size for processing SQL statements

    disable-fcrdns

    Disables the forward-confirmed reverse DNS lookup

    dump-network-traffic

    Dumps network traffic for debugging purposes

    exception-frequency

    Sets the frequency of generated API exceptions

    Mandatory: No

  • Dynamic: No

  • Default: auto
    10, 1000ms, 10000ms

    QC cache misses

    How many times the classification result has not been found from the cache, but the classification had to be performed.

    QC cache evictions

    How many times a cache entry has had to be removed from the cache, in order to make place for another.

    ,
    oracle
  • Default: default

  • ,
    on_error
    ,
    never
  • Default: never

  • on_close: the statements are always logged when a client session is closed. This may produce large amounts of log messages which may affect performance if used in environments where there are lots of client connections.
    Whenever readwritesplit receives a response that is was not expecting.
    ,
    TLSv1.0
    ,
    TLSv1.1
    ,
    TLSv1.2
    ,
    TLSv1.3
    ,
    TLSv10
    ,
    TLSv11
    ,
    TLSv12
    ,
    TLSv13
  • Default: MAX

  • TLSv13 (not supported on OpenSSL 1.0)

  • MAX

  • TLSv1.3 (not supported on OpenSSL 1.0)

    ,
    HS256
    ,
    HS384
    ,
    HS512
    ,
    RS256
    ,
    RS384
    ,
    RS512
    ,
    PS256
    ,
    PS384
    ,
    PS512
    ,
    ES256
    ,
    ES384
    ,
    ES512
    ,
    ED25519
    ,
    ED448
  • Default: auto

  • and Ed448 keys uses
    ED448
    . If MaxScale cannot auto-detect the key type, it falls back to
    HS256
    as the default algorithm.
  • HS256, HS384 or HS512

    • HMAC with SHA-2 Functions. If admin_jwt_key is not defined, uses a random encryption key of the correct size.

  • RS256, RS384 or RS512

    • Digital Signature with RSASSA-PKCS1-v1_5. Requires at least a 2048-bit RSA key.

  • PS256, PS384 or PS512

    • Digital Signature with RSASSA-PSS. Requires at least a 2048-bit RSA key.

  • ES256, ES384 or ES512

    • Digital Signature with ECDSA. Requires an EC key with the correct curve: P-256 for ES256, P-384 for ES384 and P-512 for ES512.

  • ED25519 or ED448

    • Edwards-curve Digital Signature Algorithm (EdDSA). Requires a Ed25519 key for ED25519 or a Ed448 key for ED448.

  • ,
    implicit
    ,
    code
  • Default: auto

  • ,
    PUT
    ,
    POST
    ,
    PATCH
    ,
    DELETE
    ,
    HEAD
    ,
    OPTIONS
    ,
    CONNECT
    ,
    TRACE
  • Default: No exclusions

  • Default: none

  • vault - HashiCorp Vault key manager. This key manager is only included on systems with GCC 9 or newer which means it cannot be used on Ubuntu 18.04.

    If the implicit filter fails to be created, an error is logged and no further automatic attempts are made to load that specific filter module even if it's referred to by other services.
  • Implicitly created filters otherwise behave similarly to normal filters that are defined in the configuration file. If an implicitly created filter is destroyed, it will be created again the next time a service uses it.

  • (>= MaxScale 24.02.5, 25.01.2),
    0s
    (<= MaxScale 24.02.4, 25.01.1)
  • Auto tune: Yes

  • Minimum: 0 in MaxScale, 1 in MaxScale Trial.

  • Maximum: Unlimited in MaxScale, 15 in MaxScale Trial.

  • Auto tune: Yes

  • default_role: String. Default role of user, similar to server.
  • super_priv: Boolean. True if user has SUPER grant.

  • global_db_priv: Boolean. True if user can access any database on login.

  • proxy_priv: Boolean. True if user has a PROXY grant.

  • is_role: Boolean. True if user is a role.

  • ,
    file_only_always
  • Default: add_when_load_ok

  • Stored procedures that cause session level side-effects.

    ,
    TLSv1.0
    ,
    TLSv1.1
    ,
    TLSv1.2
    ,
    TLSv1.3
    ,
    TLSv10
    ,
    TLSv11
    ,
    TLSv12
    ,
    TLSv13
  • Default: MAX

  • TLSv13 (not supported on OpenSSL 1.0)

  • MAX

  • TLSv1.3 (not supported on OpenSSL 1.0)

  • Query Redirection Filter

  • Start all MaxScale instances

    is recommended (the default starting with MaxScale 6).
  • Network throughput between the client, MaxScale and the database nodes governs how much traffic can be handled. The client-to-MaxScale network is likely to be saturated first: having multiple MaxScales in front of the cluster is an easy way of solving this problem.

  • Certain MaxScale modules store data on disk. A faster disk improves their performance but depending on the module, this might not be a big enough of a problem to worry about. Filters like the qlafilter that write information to disk for every SQL query can cause performance bottlenecks.

  • machine.memory_physical

    The amount of physical memory on the machine.

    machine.memory_available

    The amount of memory available to MaxScale. This number may be smaller than machine.memory_physical, if MaxScale is running in a container whose memory has been restricted. Note that if MaxScale is not, or fails to detect it is running in a container, the value shown will be identical with machine.memory_physical. Note also that the amount is available to all processes running in the same container, not just to MaxScale.

    maxscale.query_classifier_cache_size

    The maximum size of the MaxScale query classifier cache.

    maxscale.threads

    The number of routing threads used by MaxScale.

    statement routing

    Statement routing is a method of handling requests in which each request within a connection will be handled individually. Requests may be sent to one or more servers and connections may be dynamically added or removed from the session.

    module

    A module is a separate code entity that may be loaded dynamically into MariaDB MaxScale to increase the available functionality. Modules are implemented as run-time loadable shared objects.

    connection failover

    When a connection currently being used between MariaDB MaxScale and the database server fails a replacement will be automatically created to another server by MariaDB MaxScale without client intervention

    backend database

    A term used to refer to a database that sits behind MariaDB MaxScale and is accessed by applications via MariaDB MaxScale.

    REST API

    HTTP administrative interface

    Running

    The server is running.

    Master

    The server is the primary.

    Slave

    The server is a replica.

    # This is a comment before a parameter
    some_parameter=123
    [MyService]
    type=service
    router=readconnroute
    servers=server1,
            server2,
            server3
    max_size=1099511628000
    max_size=1073741824Ki
    max_size=1048576Mi
    max_size=1024Gi
    max_size=1Ti
    max_size=1000000000000
    max_size=1000000000k
    max_size=1000000M
    max_size=1000G
    max_size=1T
    soft_ttl=1h
    soft_ttl=60m
    soft_ttl=60min
    soft_ttl=3600s
    soft_ttl=3600000ms
    some_param=42%
    router_options=master,slave
    path_list_parameter=/tmp/something.log:/var/log/maxscale/maxscale.log

    disable-module-unloading

    Prevents modules from unloading during runtime

    enable-module-unloading

    Allows the unloading of modules during runtime

    redirect-output-to-file

    Reroutes stdout and stderr to a specified file.

    connection_keepalive

    80% of the smallest value of the servers used by the service

    wait_timeout

    The smallest wait_timeout value of the servers used by the service

    # Valid options are:
    #       threads=[<number of threads> | auto ]
    
    [MaxScale]
    threads=auto
    rebalance_period=10s
    rebalance_threshold=15
    auth_connect_timeout=10s
    # Note: to get a clean compressed file, kill the 'tail' process and instead of
    # using Ctrl+C to kill 'gzip'.
    tail -F /var/log/maxscale/maxscale.trace | gzip > maxscale.trace.gz
    # Valid options are:
    #       log_augmentation=<0|1>
    log_augmentation=1
    # A valid value looks like
    #       log_throttling = X, Y, Z
    #
    # where the first value X is a positive integer and means the number of times
    # a specific error may be logged within a duration of Y, before the logging
    # of that error is suppressed for a duration of Z.
    log_throttling=8, 2s, 15000ms
    log_throttling=
    log_throttling=0, 0, 0
    logdir=/var/log/maxscale/
    datadir=/var/lib/maxscale/
    libdir=/usr/lib64/maxscale/
    connector_plugindir=/usr/lib64/maxscale/plugin/
    persistdir=/var/lib/maxscale/maxscale.cnf.d/
    module_configdir=/etc/maxscale.modules.d/
    # 1MB query classifier cache
    query_classifier_cache_size=1MB

    QC cache size

    The current size of the cache (bytes).

    QC cache inserts

    How many entries have been inserted into the cache.

    QC cache hits

    How many times the classification result has been found from the cache.

    some_parameter=$SOME_VALUE
    substitute_variables=true
    sql_mode=oracle
    set sql_mode=oracle;
    set sql_mode=default;
    local_address=192.168.1.254
    users_refresh_time=120s
    users_refresh_interval=2h
    retain_last_statements=20
    session_trace=20
    session_trace=1000
    session_trace_match=/You have an error in your SQL syntax/
    REST API HTTP daemon error: Setting priorities to ... failed: The request is invalid.
    admin_ssl_cipher=SECURE256:-ECDHE-RSA:-AES-256-CCM:+AES-128-GCM
    admin_readwrite_hosts=192.168.1.1,127.0.0.1/21
    admin_readonly_hosts=mydomain%.com
    GRANT SELECT, INSERT, UPDATE, CREATE ON `mysql`.`maxscale_config`
    CREATE TABLE IF NOT EXISTS mysql.maxscale_config(
      cluster VARCHAR(256) PRIMARY KEY,
      version BIGINT NOT NULL,
      config JSON NOT NULL,
      origin VARCHAR(254) NOT NULL,
      nodes JSON NOT NULL
    ) ENGINE=InnoDB;
    key_manager=file
    file.keyfile=/path/to/keyfile
    event.X.facility=LOG_LOCAL0
    event.X.level=LOG_ERR
    auth,authpriv.*                 /var/log/auth.log
    event.authentication_failure.facility=LOG_AUTH
    event.authentication_failure.level=LOG_CRIT
    event_firewall_incident_facility=LOG_AUTH
    event_firewall_incident_level=LOG_CRIT
    [Test-Service]
    type=service
    router=readconnroute
    router_options=slave
    router=readconnroute
    router_options=master,slave
    filters=counter | QLA
    targets=My-Service,server2
    servers=server1,server2,server3
    cluster=TheMonitor
    user=maxscale
    password=Mhu87p2D
    user=maxscale
    password=Mhu87p2D
    version_string=10.11.2-MariaDB-RWsplit
    [Test-Service]
    wait_timeout=300s
    [Test-Service]
    max_connections=100
    session_track_state_change = ON
    session_track_transaction_info = CHARACTERISTICS
    maxctrl alter service MyService retain_last_statements 5
    SET @my_planet='Earth';                            -- This command will be removed by history simplification
    SET @my_home='My home is: ' || @my_planet;         -- Command #1 in the history
    SET @my_planet='Earth';                            -- Command #2 in the history
    user_accounts_file=/home/root/users.json
    {
        "user": [
            {
                "user": "test1",
                "host": "%",
                "global_db_priv": true
            },
            {
                "user": "test2",
                "host": "127.0.0.1",
                "password": "*032169CDF0B90AF8C00992D43D354E29A2EACB42",
                "plugin": "mysql_native_password",
                "default_role": "role2"
            },
            {
                "user": "",
                "host": "%",
                "plugin": "pam",
                "proxy_priv": true
            }
        ],
        "db": [
            {
                "user": "test2",
                "host": "127.0.0.1",
                "db": "test"
            }
        ],
        "roles_mapping": [
            {
                "user": "test2",
                "host": "127.0.0.1",
                "role": "role2"
            }
        ]
    }
    user_accounts_file_usage=file_only_always
    idle_session_pool_time=900ms
    max_slave_connections=1
    lazy_connect=1
    transaction_replay=true
    [server1]
    type=server
    max_routing_connections=1000 #this should be based on MariaDB Server capacity
    persistpoolmax=1000 #same as above
    persistmaxtime=10
    #other server settings...
    
    [myservice]
    type=service
    max_slave_connections=1
    transaction_replay=true
    idle_session_pool_time=500ms
    lazy_connect=1
    #other service settings...
    multiplex_timeout=33s
    [MyMariaDBServer1]
    type=server
    address=127.0.0.1
    port=3000
    [MyListener1]
    type=listener
    service=MyService1
    port=3006
    [Monitor1]
    type=monitor
    module=mariadbmon
    user=the_user
    password=the_password
    handle_events=false
    monitor_interval=2000ms
    backend_connect_timeout = 3s
    backend_connect_attempts = 5
    servers=Server1, Server2
    
    [Monitor2]
    type=monitor
    module=mariadbmon
    user=the_user
    password=the_password
    handle_events=false
    monitor_interval=2000ms
    backend_connect_timeout = 3s
    backend_connect_attempts = 5
    servers=Server3, Server4
    [Monitor-Common]
    type=include
    module=mariadbmon
    user=the_user
    password=the_password
    handle_events=false
    monitor_interval=2000ms
    backend_connect_timeout = 3s
    backend_connect_attempts = 5
    
    [Monitor1]
    type=monitor
    @include=Monitor-Common
    servers=Server1, Server2
    
    [Monitor2]
    type=monitor
    @include=Monitor-Common
    servers=Server3, Server3
    @include=Some-Common-Attributes, Other-Common-Attributes
    [Monitor2]
    type=monitor
    @include=Monitor-Common
    servers=Server3, Server3
    backend_connect_timeout = 5s
    [Monitor-Common]
    type=include
    @include=Base-Common
    ...
    
    [Monitor2]
    type=monitor
    @include=Monitor1
    ...
    ssl_passphrase=env:MY_SECRET_PASSWORD
    ssl_passphrase=file:/path/to/pass.txt
    ssl_passphrase=pass:MySecretPassword
    ssl_verify_peer_certificate=true
    ssl_verify_peer_host=true
    [server1]
    type=server
    address=10.131.24.62
    port=3306
    ssl=true
    ssl_cert=/usr/local/mariadb/maxscale/ssl/crt.max-client.pem
    ssl_key=/usr/local/mariadb/maxscale/ssl/key.max-client.pem
    ssl_ca_cert=/usr/local/mariadb/maxscale/ssl/crt.ca.maxscale.pem
    [RW-Split-Listener]
    type=listener
    service=RW-Split-Router
    port=3306
    ssl=true
    ssl_cert=/usr/local/mariadb/maxscale/ssl/crt.maxscale.pem
    ssl_key=/usr/local/mariadb/maxscale/ssl/key.csr.maxscale.pem
    ssl_ca_cert=/usr/local/mariadb/maxscale/ssl/crt.ca.maxscale.pem
    # Usage: maxkeys [PATH]
    maxkeys /var/lib/maxscale/
    # Usage: maxpasswd PATH PASSWORD
    maxpasswd /var/lib/maxscale/ MaxScalePw001
    61DD955512C39A4A8BC4BB1E5F116705
    [Split-Service]
    type=service
    router=readwritesplit
    servers=server1,server2,server3,server4
    user=maxscale
    password=61DD955512C39A4A8BC4BB1E5F116705
    ├──────────────┼─────────────────────────────────────────────────────────────┤
    │ Config Sync  │ {                                                           │
    │              │     "checksum": "3dd6b467760d1d2023f2bc3871a60dd903a3341e", │
    │              │     "nodes": {                                              │
    │              │         "maxscale": "OK",                                   │
    │              │         "maxscale2": "OK"                                   │
    │              │     },                                                      │
    │              │     "origin": "maxscale",                                   │
    │              │     "status": "OK",                                         │
    │              │     "version": 2                                            │
    │              │ }                                                           │
    ├──────────────┼─────────────────────────────────────────────────────────────┤
    maxctrl alter maxscale config_sync_cluster ""
    maxscale --export-config=/tmp/maxscale.cnf.combined
    [maxscale]
    key_manager=file
    file.keyfile=/var/lib/maxscale/encryption.key
    
    [NoSQL-Listener]
    type=listener
    service=My-Service
    protocol=nosqlprotocol
    nosqlprotocol.authentication_key_id=1
    nosqlprotocol.authentication_user=my_user
    nosqlprotocol.authentication_password=my_password
    
    # Add services, servers, monitors etc.
    $ openssl rand -hex 32|vault kv put secret/1 data=-
    == Secret Path ==
    secret/data/1
    
    ======= Metadata =======
    Key                Value
    ---                -----
    created_time       2022-06-23T06:50:55.29063873Z
    custom_metadata    <nil>
    deletion_time      n/a
    destroyed          false
    version            1
    $ bin/maxctrl show threads
    ┌────────────────────────┬────────┬────────┬────────┬────────┬─────┐
    │ Id                     │ 0      │ 1      │ 2      │ 3      │ All │
    ├────────────────────────┼────────┼────────┼────────┼────────┼─────┤
    │ State                  │ Active │ Active │ Active │ Active │ N/A │
    ├────────────────────────┼────────┼────────┼────────┼────────┼─────┤
    ...
    $ bin/maxctrl alter maxscale threads=2
    OK
    $ bin/maxctrl show threads
    ┌────────────────────────┬────────┬────────┬──────────┬──────────┬─────────┐
    │ Id                     │ 0      │ 1      │ 2        │ 3        │ All     │
    ├────────────────────────┼────────┼────────┼──────────┼──────────┼─────────┤
    │ State                  │ Active │ Active │ Draining │ Draining │ N/A     │
    ├────────────────────────┼────────┼────────┼──────────┼──────────┼─────────┤
    ...
    ┌────────────────────────┬────────┬────────┬─────────┬──────────┬────────┐
    │ Id                     │ 0      │ 1      │ 2       │ 3        │ All    │
    ├────────────────────────┼────────┼────────┼─────────┼──────────┼────────┤
    │ State                  │ Active │ Active │ Dormant │ Draining │ N/A    │
    ├────────────────────────┼────────┼────────┼─────────┼──────────┼────────┤
    ...
    $ bin/maxctrl show threads
    ┌────────────────────────┬────────┬────────┬──────┐
    │ Id                     │ 0      │ 1      │ All  │
    ├────────────────────────┼────────┼────────┼──────┤
    │ State                  │ Active │ Active │ N/A  │
    ├────────────────────────┼────────┼────────┼──────┤
    ...
    $ bin/maxctrl show threads
    ┌────────────────────────┬────────┬────────┬─────────┬──────────┬────────┐
    │ Id                     │ 0      │ 1      │ 2       │ 3        │ All    │
    ├────────────────────────┼────────┼────────┼─────────┼──────────┼────────┤
    │ State                  │ Active │ Active │ Dormant │ Draining │ N/A    │
    ├────────────────────────┼────────┼────────┼─────────┼──────────┼────────┤
    ...
    $ bin/maxctrl alter maxscale threads=3
    OK
    wikman@johan-P53s:maxscale $ bin/maxctrl show threads
    ┌────────────────────────┬────────┬────────┬────────┬──────────┬────────┐
    │ Id                     │ 0      │ 1      │ 2      │ 3        │ All    │
    ├────────────────────────┼────────┼────────┼────────┼──────────┼────────┤
    │ State                  │ Active │ Active │ Active │ Draining │ N/A    │
    ├────────────────────────┼────────┼────────┼────────┼──────────┼────────┤
    ...
    $ bin/maxctrl show threads
    ┌────────────────────────┬────────┬────────┬────────┬──────┐
    │ Id                     │ 0      │ 1      │ 2      │ All  │
    ├────────────────────────┼────────┼────────┼────────┼──────┤
    │ State                  │ Active │ Active │ Active │ N/A  │
    ├────────────────────────┼────────┼────────┼────────┼──────┤
    ...

    machine.cores_physical

    The number of physical CPU cores on the machine.

    machine.cores_available

    The number of CPU cores available to MaxScale. This number may be smaller than machine.cores_physical, if CPU affinities are used and only a subset of the physical cores are available to MaxScale.

    machine.cores_virtual

    The number of virtual CPU cores available to MaxScale. This number may be a decimal and smaller than machine.cores_available, if MaxScale is running in a container whose CPU quota and period has been restricted. Note that if MaxScale is not, or fails to detect it is running in a container, the value shown will be identical with machine.cores_available.

    $ maxctrl show maxscale
    ...
    ├──────────────┼────────────────────────────────────────────────────────────────────────────┤
    │ System       │ {                                                                          │
    │              │     "machine": {                                                           │
    │              │         "cores_available": 8,                                              │
    │              │         "cores_physical": 8,                                               │
    │              │         "cores_virtual": 4,                                                │
    │              │         "memory_available": 20858544128,                                   │
    │              │         "memory_physical": 41717088256                                     │
    │              │     },                                                                     │
    │              │     "maxscale": {                                                          │
    │              │         "query_classifier_cache_size": 6257563238,                         │
    │              │         "threads": 8                                                       │
    │              │     },                                                                     │
    │              │     "os": {                                                                │
    │              │         "machine": "x86_64",                                               │
    │              │         "nodename": "johan-P53s",                                          │
    │              │         "release": "5.4.0-125-generic",                                    │
    │              │         "sysname": "Linux",                                                │
    │              │         "version": "#141~18.04.1-Ubuntu SMP Thu Aug 11 20:15:56 UTC 2022"  │
    │              │     }                                                                      │
    │              │ }                                                                          │
    └──────────────┴────────────────────────────────────────────────────────────────────────────┘
    [maxscale]
    threads=4
    query_classifier_cache_size=3100000000
    ...
    WatchdogSec=30s

    Objects

    Server

    Monitor

    Filter

    Router

    Service

    Listener

    Include

    Administration

    Administration audit file

    Static Configuration Parameters

    Configuration

    Names

    Dynamic Configuration

    Special Parameter Types

    Booleans

    Sizes

    Durations

    Percent

    Regular Expressions

    Enumerations

    Path Lists

    Global Settings

    core_file

    auto_tune

    threads

    threads_max

    rebalance_period

    rebalance_threshold

    rebalance_window

    skip_name_resolve

    host_cache_size

    auth_connect_timeout

    auth_read_timeout

    auth_write_timeout

    query_retries

    query_retry_timeout

    passive

    ms_timestamp

    syslog

    maxlog

    log_warning

    log_notice

    log_info

    log_debug

    trace_file_dir

    trace_file_size

    log_warn_super_user

    log_augmentation

    log_throttling

    logdir

    datadir

    secretsdir

    libdir

    sharedir

    cachedir

    piddir

    execdir

    connector_plugindir

    persistdir

    module_configdir

    language

    query_classifier

    query_classifier_cache_size

    query_classifier_args

    substitute_variables

    sql_mode

    local_address

    users_refresh_time

    users_refresh_interval

    retain_last_statements

    dump_last_statements

    session_trace

    session_trace_match

    writeq_high_water

    writeq_low_water

    persist_runtime_changes

    load_persisted_configs

    max_auth_errors_until_block

    debug

    require_secure_transport

    REST API Configuration

    admin_host

    admin_port

    admin_root_url

    admin_auth

    admin_ssl_key

    admin_ssl_cert

    admin_ssl_ca_cert

    admin_ssl_ca

    admin_ssl_passphrase

    admin_ssl_version

    admin_ssl_cipher

    admin_ssl_verify_peer_certificate

    admin_ssl_verify_peer_host

    admin_enabled

    admin_gui

    admin_secure_gui

    admin_log_auth_failures

    admin_pam_readwrite_service

    admin_pam_readonly_service

    admin_readwrite_hosts

    admin_readonly_hosts

    admin_jwt_algorithm

    admin_jwt_key

    admin_jwt_max_age

    admin_oidc_url

    admin_oidc_flow

    admin_oidc_client_id

    admin_oidc_client_secret

    admin_oidc_ssl_insecure

    admin_oidc_extra_options

    admin_verify_url

    admin_jwt_issuer

    admin_audit

    admin_audit_file

    admin_audit_exclude_methods

    config_sync_cluster

    config_sync_user

    config_sync_password

    config_sync_db

    config_sync_interval

    config_sync_timeout

    telemetry

    telemetry_attributes

    telemetry_update_interval

    telemetry_ssl_insecure

    telemetry_url

    telemetry_ssl_key

    telemetry_ssl_cert

    telemetry_ssl_ca

    key_manager

    Events

    'authentication_failure'

    'firewall_incident'

    Service

    router

    filters

    targets

    servers

    cluster

    user

    password

    role

    enable_root_user

    localhost_match_wildcard_host

    version_string

    auth_all_servers

    strip_db_esc

    log_auth_warnings

    log_warning

    log_notice

    log_info

    log_debug

    wait_timeout

    max_connections

    session_track_trx_state

    retain_last_statements

    connection_keepalive

    force_connection_keepalive

    net_write_timeout

    max_sescmd_history

    prune_sescmd_history

    disable_sescmd_history

    user_accounts_file

    user_accounts_file_usage

    idle_session_pool_time

    multiplex_timeout

    Filter

    module

    Server

    Monitor

    Listener

    Include

    Available Protocols

    MariaDB or MariaDBClient

    CDC

    nosqlprotocol

    TLS/SSL encryption

    Settings for TLS/SSL Encryption

    ssl

    ssl_key

    ssl_passphrase

    ssl_cert

    ssl_ca_cert

    ssl_ca

    ssl_version

    ssl_cipher

    ssl_cert_verify_depth

    ssl_verify_peer_certificate

    ssl_verify_peer_host

    ssl_crl

    Module Types

    Routing Modules

    Monitor Modules

    Filter Modules

    Encrypting Passwords

    Creating Encrypted Passwords

    Runtime Configuration Changes

    Configuration Synchronization

    Error Handling in Configuration Synchronization

    Synchronization of Encrypted Passwords

    Managing Configuration Synchronization

    Limitations in Configuration Synchronization

    Backing Up Configuration Changes

    Encryption Key Managers

    File-based Key Manager

    Limitations

    Settings for File-based Key Manager

    KMIP Key Manager

    Limitations

    Settings for KMIP Key Manager

    HashiCorp Vault Key Manager

    Limitations

    Settings for HashiCorp Vault Key Manager

    Threads

    Error Reporting

    Limitations

    Performance Optimization

    MaxScale Diagnostics using MaxCtrl

    Configuration

    Example

    Troubleshooting

    Systemd Watchdog

    Administration Tutorial
    include section
    section
    MaxCtrl
    Dynamic Configuration
    admin_audit
    Administration Tutorial
    persisted configuration files directory
    INI
    persistdir
    persist_runtime_changes=false
    load_persisted_configs=false
    PCRE2-library
    syntax
    PCRE2 syntax documentation
    MaxScale Configuration Settings
    boolean
    threads_max
    Threads
    threads
    duration
    boolean
    duration
    a duration
    duration
    boolean
    cooperative monitoring
    boolean
    boolean
    boolean
    logdir
    boolean
    boolean
    boolean
    boolean
    the log directory
    size
    boolean
    duration
    duration
    here
    datadir
    size
    here
    boolean
    enum
    duration
    here
    duration
    enum
    regex
    size
    size type values
    size
    size type values
    boolean
    boolean
    boolean
    boolean
    REST API documentation
    admin_ssl_passphrase
    ssl_passphrase
    enum_mask
    admin_ssl_version
    gnutls_priority_init
    boolean
    ssl_verify_peer_certificate
    admin_ssl_ca
    boolean
    ssl_verify_peer_host
    admin_ssl_verify_peer_certificate
    boolean
    boolean
    boolean
    boolean
    admin_pam_readwrite_service
    enum
    the REST API documentation
    Encryption Key Manager
    Encryption Key Manager
    duration
    enum
    boolean
    Auth0
    boolean
    enum
    Configuration Synchronization
    duration
    duration
    boolean
    duration
    boolean
    enum
    File-based key manager
    KMIP key manager
    Encryption Key Managers
    module
    password
    MySQL protocol authentication documentation
    encrypted password
    user
    MySQL protocol authentication documentation
    Role
    Binlogrouter
    Diff router
    boolean
    boolean
    boolean
    boolean
    boolean
    boolean
    boolean
    boolean
    duration
    MXS-5530
    boolean
    duration
    here
    boolean
    durations
    boolean
    boolean
    enum
    duration
    max_routing_connections
    persistpoolmax
    persistmaxtime
    persistpoolmax
    persistmaxtime
    max_routing_connections
    max_sescmd_history
    prune_sescmd_history
    multiplex_timeout
    routing threads
    duration
    Server Reference
    can be found here
    listen(2)
    Listener Reference
    Change Data Capture Protocol
    NoSQL documentation
    boolean
    ssl_key
    enum_mask
    tls_version
    boolean
    here
    boolean
    ReadConnRoute
    ReadWriteSplit
    SchemaRouter
    Binlogrouter
    MariaDB Monitor
    Galera Monitor
    Filter Tutorial
    Query Log All (QLA) Filter
    Regular Expression Filter
    Tee Filter
    MaxCtrl
    REST-API
    Dynamic Configuration
    MXS-3619
    MXS-4276
    key_manager
    File Key Management Encryption Plugin
    Creating the Key File
    HashiCorp Vault Key Management Plugin
    boolean
    duration
    Limitations
    MaxScale Troubleshooting
    systemd.service.html
    spinner
    Top Filter
    disable_master_failback
    ColumnStore

    MaxScale Configuration Settings

    Browse the comprehensive list of MariaDB MaxScale configuration parameters. This reference details valid values, default settings, and dynamic capabilities for servers, services, and monitors.

    General

    Filter

    module

    • Type: filter

    • Mandatory: Yes

    • Dynamic: No

    • Description: The module parameter specifies the name of the filter module that is included in the routing chain.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: GET

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: /var/log/maxscale/admin_audit.csv

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: true

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: true

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: true

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: "127.0.0.1"

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: auto

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: maxscale

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: 24h

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type: password

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: auto

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type: number

    • Mandatory: No

    • Dynamic: No

    • Default: 8989

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: %

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: true

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Description: Defines additional TLS cipher configuration for the REST API.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: MAX

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    allow_duplicate_servers

    • Type: boolean

    • Default: false

    • Description: Allows multiple server definitions to use the same IP address and port combination.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 10s

    • Type: string list

    • Values: all or list of auto tunable parameters, separated by ,

    • Default: No

    • Type: monitor

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: mysql

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 5s

    • Type: password

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 10s

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: OS Dependent

    • Type:

    • Default: false

    • Dynamic: No

    • Description: Specifies whether a core dump file is generated in the event that MaxScale crashes.

    cors_allow_origin

    • Type: string

    • Default: N/A

    • Description: Enables CORS and sets the Access-Control-Allow-Origin header to the specified value.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: /var/lib/maxscale

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    disable_fcrdns

    • Type: boolean

    • Default: false

    • Description: Disables Forward-Confirmed Reverse DNS (fcRDNS) lookups for client connections.

    disable_module_unloading

    • Type: boolean

    • Default: false

    • Description: Disables the unloading of modules at exit. This provides more accurate Valgrind leak reports when memory is allocated within shared libraries.

    disable_statement_logging

    • Type: boolean

    • Default: true

    • Description: Disables the logging of SQL statements sent by MaxScale to backend servers.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: on_close

    dump_network_traffic

    • Type: boolean

    • Default: false

    • Description: Dumps all raw network traffic to the log as info level messages.

    enable_cors

    • Type: boolean

    • Default: false

    • Description: Enables Cross-Origin Resource Sharing (CORS) support for the MaxScale REST API.

    enable_module_unloading

    • Type: boolean

    • Default: true

    • Description: Re-enables module unloading at exit (overrides disable-module-unloading)

    enable_statement_logging

    • Type: boolean

    • Default: false

    • Description: Enables logging of all SQL statements sent by MaxScale monitors and authenticators to the backend servers.

    exception_frequency

    • Type: integer

    • Default: true

    • Description: Defines the frequency of generated API exceptions.

    gdb_stacktrace

    • Type: boolean

    • Default: true

    • Description: When enabled, MaxScale attempts to use GDB to generate detailed stack traces during a crash. Can be disabled with gdb-stacktrace=false.

    • Type: integer

    • Default: 128

    • Dynamic: Yes

    • Description: Sets the number of entries in the reverse DNS lookup cache for client hostnames.

    • Type:

    • Dynamic: Yes

    • Values: none, file, kmip, vault

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: OS Dependent

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: true

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type: number, ,

    • Mandatory: No

    • Dynamic: Yes

    • Default:

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: /var/log/maxscale

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 10

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: /etc/maxscale.modules.d/

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Default: true

    • Dynamic: No

    • Description: Save runtime configuration changes to disk.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: /var/lib/maxscale/maxscale.cnf.d/

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: /run/maxscale

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: System Dependent

    • Type: number

    • Mandatory: No

    • Dynamic: No

    • Default: 1

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 10s

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0s

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 20

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 10

    redirect_output_to_file

    • Type: boolean

    • Default: false

    • Description: Redirects stdout and stderr to the specified file path.

    • Type:

    • Default: false

    • Dynamic: No

    • Description: Requires SSL for all listeners, servers, and the REST API.

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: /usr/share/maxscale

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: default

    sql_batch_size

    • Type: size

    • Default: 10MiB

    • Description: Sets the maximum batch size for REST API SQL statement processing.

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type: stringlist

    • Default: empty

    • Dynamic: Yes

    • Mandatory: No

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 60s

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: http://localhost:4318/v1/metrics

    • Type: number or auto

    • Mandatory: No

    • Dynamic: No

    • Type: positive integer

    • Default: 256

    • Dynamic: No

    • Description: Hard limit for the number of worker threads.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Description: Directory for low-overhead trace log files.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Description: Amount of log data to keep in trace files.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0s

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 30s

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 65536

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 1024

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type: monitor

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 300s

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type: filter list

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type:

    • Mandatory No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: -1s

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0 in MaxScale, 15 in MaxScale Trial.

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 50

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 60s

    • Type:

    • Mandatory No

    • Dynamic: Yes

    • Default: 0s

    • Type: string

    • Mandatory: Yes

    • Dynamic: Yes

    • Description: Specifies the password the service uses to retrieve user accounts from backends.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: -1

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: router

    • Mandatory: Yes

    • Dynamic: No

    • Description: Defines the router module that a service uses to direct client connections to backend servers.

    • Type: server list

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type: target list

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: string

    • Mandatory: Yes

    • Dynamic: Yes

    • Description: Username for retrieving user account information from backends.

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: add_when_load_ok

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: None

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 28800s

    • Type: path

    • Mandatory: Yes

    • Dynamic: Yes

    • Description: Path to file containing encryption keys.

    • Type: path

    • Default: ""

    • Dynamic: Yes

    • Type: string

    • Default: localhost

    • Dynamic: Yes

    • Type: string

    • Default: secret

    • Dynamic: Yes

    • Type: integer

    • Default: 8200

    • Dynamic: Yes

    • Type:

    • Default: 30s

    • Dynamic: Yes

    • Description: Sets the timeout for requests and connections to the Vault server.

    • Type:

    • Default: true

    • Dynamic: Yes

    • Description: Manages whether encrypted (HTTPS) or unencrypted (HTTP) connections are used when communicating with the Vault server.

    • Type: password

    • Mandatory: Yes

    • Dynamic: Yes

    • Description: Provides the authentication token to access the Vault server.

    • Type: path

    • Default: ""

    • Dynamic: Yes

    • Type: path

    • Mandatory: Yes

    • Dynamic: Yes

    • Description: Client certificate for KMIP authentication.

    • Type: string

    • Mandatory: Yes

    • Dynamic: Yes

    • Type: path

    • Mandatory: Yes

    • Dynamic: Yes

    • Description: Specifies the client private key used for connecting to the KMIP server.

    • Type: integer

    • Mandatory: Yes

    • Dynamic: Yes

    • Description: Defines the port on which the KMIP server listens.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type: path

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type: path

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 9

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type: path

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type: path

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: MAX

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: "::"

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type: path

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type: stringlist

    • Default: character_set_client=auto,character_set_connection=auto,character_set_results=auto,max_allowed_packet=auto,system_time_zone=auto,time_zone=auto,tx_isolation=auto,maxscale=auto

    • Dynamic: Yes

    • Type: number

    • Mandatory: Yes, if socket is not provided.

    • Dynamic: No

    • Type: protocol

    • Mandatory: No

    • Dynamic: No

    • Default: mariadb

    • Type: URL

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type: service

    • Mandatory: Yes

    • Dynamic: No

    • Description: Identifies the service that the listener is connected to.

    • Type: string

    • Mandatory: Yes, if port is not provided.

    • Dynamic: No

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: default

    • Type: path

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type: string

    • Mandatory: Yes, if socket is not provided.

    • Dynamic: Yes

    • Type: Custom

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0

    • Type: enum

    • Mandatory: No

    • Dynamic: Yes

    • Values: down

    • Type: string list

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0 in MaxScale, 15 in MaxScale Trial.

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0s

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 3306

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: primary

    • Type: string

    • Default: None

    • Dynamic: Yes

    • Description: Defines custom options added to replication commands for server.

    • Type: string

    • Mandatory: Yes, if address is not provided.

    • Dynamic: Yes

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    Settings

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: Kerberos Default

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: mariadb/localhost.localdomain

    Settings

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: false

    Settings

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: none

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: None

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: password

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: false

    Settings

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    Settings

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: never

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: shared

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: true

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: true

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: 0s

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: never

    • Type: count

    • Mandatory: No

    • Dynamic: No

    • Default: 0

    • Type: count

    • Mandatory: No

    • Dynamic: No

    • Default: 0

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: 0

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: 0

    • Type: path

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: assume_cacheable

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: 0s

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: storage_inmemory

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default:

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: 5s

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: mixed

    storage_memcached

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: 1Mi

    • Type: The Memcached server address specified as host[:port]

    • Mandatory: Yes

    • Dynamic: No

    storage_redis

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type: The Redis server address specified as host[:port]

    • Mandatory: Yes

    • Dynamic: No

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: false

    • Type: Path to existing readable file.

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type: Path to existing readable file.

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type: Path to existing readable file.

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    Settings

    • Type: string

    • Mandatory: Yes

    • Dynamic: Yes

    • Description: Specifies the comment injected before statements.

    Settings

    • Type: count

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: ignorecase

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 60s

    Settings

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: s3.amazonaws.com

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Description: Defines the S3 access key used for authentication.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type: integer

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0

    • Type: integer

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: us-east-1

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Description: Describes the S3 secret key that is used for verification.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    Settings

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: ignore

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type: path

    • Mandatory: Yes

    • Dynamic: Yes

    • Description: Determines the path to the file containing masking rules.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: never

    Settings

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: empty

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: (no limit)

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 64Ki

    Settings

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: ignorecase

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    Settings

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: milliseconds

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: string

    • Mandatory: Yes

    • Dynamic: No

    • Description: Specifies the base filename for session log files with unique session identifiers appended to create individual output files.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: service

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: session

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: " "

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: case

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: ","

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Description: Defines a regex pattern for excluding requests from specified client IP addresses or hosts from logging.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Description: Defines a regex pattern to include only queries from specific client IP addresses or hosts from logging.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Description: Defines a regex pattern that prevent requests from specific users from being logged.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Description: Specifies a regex pattern to include queries only from specific users for logging.

    Settings

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type:

    • Mandatory: Yes

    • Dynamic: Yes

    • Description: Defines the regex pattern in SQL statements that filter should identify and replace.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: ignorecase

    • Type: string

    • Mandatory: Yes

    • Dynamic: Yes

    • Description: Specifies the string that will replace SQL query parts that

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    Settings

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: Native

    • Type: string

    • Mandatory: Yes

    • Dynamic: Yes

    • Default: No default value

    Settings per template in the template file

    • Type:

    • Default: From maxscale.cnf

    • Description: Overrides the global template configuration to specify whether pattern matching is case-sensitive.

    • Type:

    • Default: false

    • Description: Identifies whether to use subsequent templates on a query once the previous template has been matched and replaced.

    • Type:

    • Default: true

    • Description: Specifies whether whitespace differences between the template and SQL inout should be ignored during matching.

    • Type: string

    • Values: Native, ECMAScript, Posix, EPosix, Awk, Grep, EGrep

    • Type:

    • Default: false

    • Description: Simulates replacements without affecting queries and logs any possible changes to the NOTICE level.

    Settings

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: ignorecase

    • Type: service

    • Mandatory: No

    • Dynamic: Yes

    • Default: none

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type: target

    • Mandatory: No

    • Dynamic: Yes

    • Default: none

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    Settings

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 2s

    • Type: number

    • Mandatory: Yes

    • Dynamic: Yes

    • Description: Sets the maximum number of requests per second allowed for a session during the specific sample period.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 250ms

    • Type:

    • Mandatory: Yes

    • Dynamic: Yes

    • Description: Specifies how long a session can be throttled before being disconnected by MaxScale.

    Settings

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 10

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: string

    • Mandatory: Yes

    • Dynamic: Yes

    • Description: Specifies the base name for session log files, followed by the session ID to generate unique output files.

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: ignorecase

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    Settings

    • Type: path

    • Default: /var/lib/maxscale/wcar/

    • Mandatory: No

    • Dynamic: No

    • Type:

    • Default: 0s

    • Maximum: Unlimited in MaxScale, 5min in MaxScale Lite.

    • Mandatory: No

    • Type:

    • Default: 0

    • Maximum: Unlimited in MaxScale, 10MB in MaxScale Lite.

    • Mandatory: No

    • Type:

    • Default: false

    • Mandatory: No

    • Dynamic: No

    Settings

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 1

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 3s

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 3s

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 3s

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0s

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: master_down

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 28800s

    • Type: string

    • Mandatory: Yes

    • Dynamic: No

    • Description: Specifies which monitor module will be used, such as

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 2s

    • Type: string

    • Mandatory: Yes

    • Dynamic: Yes

    • Description: Defines the password for the user defined in the user parameter; overrides older

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 90s

    • Type: string

    • Mandatory: Yes

    • Dynamic: Yes

    • Description: Provides a comma-separated list of servers that the monitor will track and manage.

    • Type: string

    • Mandatory: Yes

    • Dynamic: Yes

    • Description: Specifies the monitor's username for connecting to backend servers; if defined, this overrides the server's

    Settings

    • Type:

    • Default: false

    • Dynamic: Yes

    • Description: Allows Galera nodes to continue performing normal operations while acting as donors during non-blocking SST methods, preventing them from losing synchronized or read/write state.

    • Type:

    • Default: false

    • Dynamic: Yes

    • Description: Prevents MaxScale from restoring the original node to primary status after a failover; the new primary retains the role while running.

    • Type:

    • Default: false

    • Dynamic: Yes

    • Description: Disables automatic primary and replica role assignment in a Galera cluster; when enabled, only the Synced status is assigned.

    • Type:

    • Default: false

    • Dynamic: Yes

    • Description: Ensures that only the Galera node with

    • Type:

    • Default: false

    • Dynamic: Yes

    • Description: Controls whether the

    • Type:

    • Default: false

    • Dynamic: Yes

    • Description: Allows the monitor to automatically select the writing node and manage controlled node replacements in a Galera cluster while keeping server priorities into account.

    Settings

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: none

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 5

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: none

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: -1

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: none

    Settings for Backup operations

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: path

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 1

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: 1G

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 4444

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type: path

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: number

    • Mandatory: No

    • Dynamic: Yes

    • Default: 22

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 10s

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    Settings for Cluster manipulation operations

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: true

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 90s

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 10s

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: None

    [switchover_on_low_disk_space`**](../reference/maxscale-monitors/mariadb-monitor.md#switchover_on_low_disk_space)

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 90s

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    Settings for Primary server write test

    • Type:

    • Default: log

    • Values: log, failover

    • Type:

    • Dynamic: Yes

    • Default: 0s

    • Description: Sets the interval after which a write test is performed on the primary if no changes are detected.

    • Type: string

    • Dynamic: Yes

    • Default: mxs.maxscale_write_test

    Settings

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    Settings

    • Type: string

    • Mandatory: No

    • Default: "NoSQL"

    • Type: string

    • Mandatory: No

    • Default: ""

    • Type: string

    • Mandatory: No

    • Default: ""

    • Type:

    • Mandatory: No

    • Default: false

    • Type:

    • Mandatory: No

    • Default: false

    • Type: string

    • Mandatory: Yes, if authentication_shared is true.

    • Description: Specifies the user used to access and manage shared NoSQL account information.

    • Type:

    • Mandatory: No

    • Default: false

    • Type:

    • Mandatory: No

    • Default: true

    • Type:

    • Mandatory: No

    • Default: true

    • Type:

    • Mandatory: No

    • Default: 60s

    • Type:

    • Mandatory: No

    • Values: none, in, out, back

    • Type: string

    • Mandatory: No

    • Default: "%"

    • Type: count

    • Mandatory: No

    • Range: [35, 2048]

    • Type: string

    • Mandatory: No

    • Default: ''

    • Description: Specifies the internal cache to use, currently supporting only the

    • Type:

    • Mandatory: No

    • Default: false

    • Type:

    • Mandatory: No

    • Values: return_error, return_empty

    • Type:

    • Mandatory: No

    • Values: atomic, default

    • Type: string

    • Mandatory: No

    • Default: ""

    • Type: string

    • Mandatory: No

    • Default: ""

    Resource Operations

    [Create a filter](../reference/maxscale-rest-api/maxscale-filter-resource.md#Create a filter)

    • Type of the object, must be filters

    • data.attributes.module

    • The filter module to use

    Resource Operations

    [Create a new listener](../reference/maxscale-rest-api/maxscale-listener-resource.md#Create a new listener)

    • Type of the object, must be listeners

    • data.attributes.parameters.port OR data.attributes.parameters.socket

    • The TCP port or UNIX Domain Socket the listener listens on. Only one of the fields can be defined.

    Resource Operations

    [Create a monitor](../reference/maxscale-rest-api/maxscale-monitor-resource.md#Create a monitor)

    • Type of the object, must be monitors

    • data.attributes.module

    • The monitor module to use

    Resource Operations

    [Create a server](../reference/maxscale-rest-api/maxscale-server-resource.md#Create a server)

    • Type of the object, must be servers

    • data.attributes.parameters.address OR data.attributes.parameters.socket

    • The or to use. Only one of the fields can be defined.

    Resource Operations

    [Create a service](../reference/maxscale-rest-api/maxscale-service-resource.md#Create a service)

    • Type of the object, must be services

    • data.attributes.router

    • The router module to use

    Settings

    • Type: string

    • Mandatory: Yes

    • Default: No

    • Dynamic: No

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: none

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: /var/lib/maxscale/binlogs

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: AES_CBC

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type:

    • Dynamic: No

    • Values: purge, archive

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: 0s

    • Type: number

    • Mandatory: No

    • Dynamic: No

    • Default: 2

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: 10s

    • Type: count

    • Mandatory: No

    • Dynamic: No

    • Default: 2

    • Type:

    • Mandatory: No

    • Default: false

    • Dynamic: Yes

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: false

    • Type: count

    • Mandatory: No

    • Dynamic: No

    • Default: 1234

    Settings

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: none

    • Type: non-negative integer

    • Mandatory: No

    • Dynamic: Yes

    • Default: 2

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 15m

    • Type: server

    • Mandatory: Yes

    • Dynamic: No

    • Description: Specifies the primary server from which query results are returned to the client.

    • Type: non-negative integer

    • Mandatory: No

    • Dynamic: Yes

    • Default: 10

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: close

    • Type: count

    • Mandatory: No

    • Dynamic: Yes

    • Min: 1

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: 15m

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: always

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type: non-negative integer

    • Mandatory: No

    • Dynamic: Yes

    • Default: 5

    • Type: non-negative integer

    • Mandatory: No

    • Dynamic: Yes

    • Default: 5

    • Type: count

    • Mandatory: No

    • Dynamic: Yes

    • Min: 100

    • Type: service

    • Mandatory: Yes

    • Dynamic: No

    • Description: Defines the service that Diff will operate on.

    Settings

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: read_only

    • Type: string

    • Mandatory: Yes

    • Dynamic: No

    • Description: Specifies the Exasol ODBC connection string used to connect to the database.

    • Type: String

    • Mandatory: No

    • Dynamic: No

    • Values: auto

    • Type: String

    • Mandatory: No

    • Dynamic: No

    • Default: "UTIL.maria_preprocessor"

    Settings

    • Type: string

    • Mandatory: Yes

    • Dynamic: No

    • Description: Specifies the list of Kafka brokers in host:port

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Values: PLAIN

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type: string

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: false

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type: path

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: true

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type: number

    • Mandatory: No

    • Dynamic: No

    • Default: 1234

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 10s

    • Type: string

    • Mandatory: Yes

    • Dynamic: No

    • Description: Specifies the Kafka topic where replicated events are published.

    Settings

    • Type: count

    • Mandatory: No

    • Dynamic: Yes

    • Default: 100

    • Type: string

    • Mandatory: Yes

    • Dynamic: Yes

    • Description: Specifies the comma-separated list of Kafka broker addresses used to establish connections.

    • Type: string

    • Default: InnoDB

    • Mandatory: No

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: PLAIN

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type: string

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type: path

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type: path

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type: path

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: topic

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 5000ms

    • Type: stringlist

    • Mandatory: Yes

    • Dynamic: Yes

    • Description: Specifies the comma-separated list of topics to subscribe to.

    Settings

    • Type:

    • Mandatory: Yes

    • Dynamic: Yes

    • Values: log

    • Type: string

    • Default: No default value

    • Mandatory: No

    • Dynamic: Yes

    • Type: string

    • Default: No default value

    • Mandatory: No

    • Dynamic: Yes

    • Type: string

    • Default: No default value

    • Mandatory: No

    • Dynamic: Yes

    • Type: target

    • Mandatory: Yes

    • Dynamic: Yes

    • Description: Defines the primary target server whose results are returned to the client and whose availability is required for the session.

    • Type:

    • Default: ignore

    • Mandatory: No

    • Type:

    • Default: always

    • Mandatory: No

    Settings

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0s

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: master

    Settings

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: none

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 10s

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 10s

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: fail_instantly

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true (>= MaxScale 24.02), false(<= MaxScale 23.08)

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0s

    • Type: integer

    • Mandatory: No

    • Dynamic: Yes

    • Min: 0

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type: integer

    • Mandatory: No

    • Dynamic: Yes

    • Default: 255

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: least_current_operations

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true (>= MaxScale 24.02), false (<= MaxScale 23.08)

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: none

    • Type: integer

    • Mandatory: No

    • Dynamic: Yes

    • Min: 1

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 0s

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 10s

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type: integer

    • Mandatory: No

    • Dynamic: Yes

    • Default: 5

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: full

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 1 MiB

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: true

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 30s (>= MaxScale 24.02), 0s (<= MaxScale 23.08)

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Values: master

    Settings

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: false

    • Type: stringlist

    • Mandatory: No

    • Dynamic: Yes

    • Default: ""

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: ""

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 150s

    • Type:

    • Mandatory: No

    • Dynamic: No

    • Default: false

    • Type:

    • Mandatory: No

    • Dynamic: Yes

    • Default: 300s

    Settings

    • Type: target

    • Mandatory: Yes

    • Dynamic: No

    • Description: Identifies the primary target cluster to which all write operations are directed.


    This page is licensed: CC BY-SA / Gnu FDL

    Description: Enables the logging of incoming REST API requests for auditing and monitoring purposes.

    ,
    PUT
    ,
    POST
    ,
    PATCH
    ,
    DELETE
    ,
    HEAD
    ,
    OPTIONS
    ,
    CONNECT
    ,
    TRACE
  • Default: No exclusions

  • Description: Provides a list of HTTP methods to be excluded from REST API audit logging, separated by commas.

  • Description: Defines the location of the REST API audit logs.

  • Description: Allows HTTP Basic authentication for the REST API.

  • Description: Enables or disables the MaxScale admin interface.

  • Description: Enables or disables the graphical user interface (GUI) for the admin interface.

  • Description: Provides the network interface address that the REST API is listening to.

  • ,
    HS256
    ,
    HS384
    ,
    HS512
    ,
    RS256
    ,
    RS384
    ,
    RS512
    ,
    PS256
    ,
    PS384
    ,
    PS512
    ,
    ES256
    ,
    ES384
    ,
    ES512
    ,
    ED25519
    ,
    ED448
  • Default: auto

  • Description: Specifies the algorithm for signing JSON Web Tokens (JWTs) for the REST API.

  • Description: Specifies the issuer ("iss") claim in the REST API-generated JSON Web Tokens.

  • Description: Identifies the encryption key that is used to sign JSON Web Tokens.

  • Description: Specifies the maximum duration of JWTs issued by the REST API.

  • Description: Enables logging of authentication failures for the admin interface.

  • Description: Specifies the client ID for OpenID Connect (OIDC) login authentication requests.

  • Description: Specifies the client secret used for OIDC authentication requests.

  • Description: Defines additional parameters that should be included in authorization requests for OIDC.

  • ,
    implicit
    ,
    code
  • Default: auto

  • Description: Describes the OIDC authentication flow used for SSO.

  • Description: Disables TLS certificate validation while retrieving OIDC certificates.

  • Description: Specifies the OIDC provider's URL, which is needed to validate JWT.

  • Description: Defines the PAM service that is used to verify read-only REST API users.

  • Description: Specifies the PAM service used for authentication REST API users with read and write access.

  • Description: Defines the port at which the REST API waits for incoming connections.

  • Description: Hosts can perform any REST API operation with read and write access.

  • Description: Prefix path added to all links generated by the REST API.

  • Description: Manages whether the GUI are accessible only over secure HTTPS.

  • Description: Path to the CA certificate for outgoing HTTPS requests.

  • Description: Provides the path of the TLS public certificate in PEM format used by the REST API.

  • Description: Indicates the location of the TLS private key in PEM format that the admin interface uses.

  • Description: Provides the passphrase needed to decrypt the admin interface's TLS private key.

  • Description: Verifies the client TLS certificate for REST-API connections (REST-API counterpart of ssl_verify_peer_certificate).

  • Description: Verifies the client host against its certificate for REST-API TLS connections (REST-API counterpart of ssl_verify_peer_host).

  • ,
    TLSv1.0
    ,
    TLSv1.1
    ,
    TLSv1.2
    ,
    TLSv1.3
    ,
    TLSv10
    ,
    TLSv11
    ,
    TLSv12
    ,
    TLSv13
  • Default: MAX

  • Description: Specifies the allowed TLS protocol versions for the REST API.

  • Description: Delegate the validation of tokens to an external server.

  • Description: Sets the connection timeout for retrieving user authentication data from backend servers.

  • Mandatory: No

  • Dynamic: No

  • Description: Allows automatic tuning of specified configuration parameters based on backend server values.

  • Description: Monitor name used for configuration synchronization

  • Description: Identifies the database that contains the maxscale_config table, which is used to synchronize configurations.

  • Description: Specifies how often MaxScale synchronizes configuration changes with the cluster.

  • Description:

  • Description: Timeout for config sync SQL operations.

  • Description: Username used for configuration sync database access across MaxScale instances.

    Description: Specifies the ditrectory that contains MaxScale's MariaDB Connector-C authentication plugins.

  • Description: Specifies the location of MaxScale's data files directory.

  • Description: Defines debug options equivalent to the --debug command line argument.

  • ,
    on_error
    ,
    never
  • Default: never

  • Description: Manages when MaxScale logs the last statements executed by a client session.

  • Default: none

  • Description: Defines the encryption key manager that MaxScale uses.

  • Description: Specifies the directory that MaxScale uses to locate modules.

  • Description: Loads saved runtime changes at startup.

  • Description: Defines what specific local interface to use when connecting to servers.

  • Description: Includes function names to logged messages.

  • Description: Log debug messages when enabled.

  • Description: Log detailed info messages when enabled.

  • Description: Log notice level messages when enabled.

  • 10, 1000ms, 10000ms
  • Description: Manages how frequently repeated errors or warnings are logged.

  • Description: Log warning when a client with SUPER privilege connects.

  • Description: Enable service-level warning logging.

  • Description: Defines the directory where log files are stored.

  • Description: Maximum number of authentication failures before temporarily blocking a host.

  • Description: Enables logging of messages to the MaxScale log file.

  • Description: Directory for module-specific configuration files.

  • Description: Adds millisecond precision to logfile timestamps.

  • Description: Deprecated - use instead.

  • Description: Directory where runtime configuration changes are stored.

  • Description: Specifies the directory containing the MaxScale process ID (PID) file.

  • Description: Sets the maximum size of the query classifier cache.

  • Description: Deprecated and ignored.

  • Description: Deprecated and ignored.

  • Description: Defines the interval for monitoring and rebalancing worker thread load. A value of 0 disables this function.

  • Description: Load difference percentage that triggers thread rebalancing.

  • Description: Manages how many seconds of load to consider for rebalancing.

  • Description: Specifies how many statements MaxScale can store per session.

  • Description: Location of the .secrets file for password encryption.

  • Description: Defines how many log entries are stored in the session trace log.

  • Description: Specifies a refular expression pattern used to filter session trace logs.

  • Description: Defines the directory where static data assets are loaded.

  • Description: Disables reverse DNS lookups of client IP addresses.

  • ,
    oracle
  • Default: default

  • Description: Defines which SQL language mode the query classifier should expect.

  • Description: Allows use of environment variables within MaxScale configuration files.

  • Description: Writes log messages to the system journal via the system logging interface.

  • Description: Enables sending metrics to OpenTelemetry Collector.

    Description: Global attributes to send with every metric.

  • Description: Path to trusted CA certificate (PEM) used for validating TLS connections in telemetry.

  • Description: Specifies the file path to the TLS public certificate in PEM format for telemetry.

  • Description: Disable TLS certificate validation for telemetry.

  • Description: TLS private key for encrypted telemetry.

  • Description: Defines the minimum interval between sending metrics to the telemetry collector.

  • Description: Defines the OpenTelemetry endpoint where MaxScale pushes metrics.

  • Default: auto
  • Description: Manages the number of worker threads for routing client traffic.

  • Description: Defines the interval for automatically refreshing user accounts from backend servers.

  • Description: Maximum frequency for refreshing user accounts from backend servers after authentication failures.

  • Description: High water mark for network write buffer throttling.

  • Description: Low water mark to disable network write throttling.

  • Description: Manages whether authentication data is loaded from one server or aggregated from all servers.

  • Description: Monitor that defines servers for this service.

  • Auto tune:

  • Description: Send pings to keep idle backend connections alive.

  • Description: Disable session command history entirely.

  • Description: Controls whether the root user is allowed to connect through MaxScale to backend servers.

  • Description: Defines a list of filters applied to client requests before routing to backend servers.

  • Description: Send keepalive pings to any backends even when client is idle.

  • Description: Time idle before pooling backend connections.

  • Description: Log authentication failures and warnings.

  • Description: Enable service-level debug logging.

  • Description: Enable service-level info logging.

  • Description: Enable service-level notice logging.

  • Description: Enable service-level warning logging.

  • Minimum: 0 in MaxScale, 1 in MaxScale Trial.

  • Maximum: Unlimited in MaxScale, 15 in MaxScale Trial.

  • Description: Maximum number of simultaneous connections allowed to this service.

  • Description: Maximum session commands to store for replay.

  • Description: Maximum wait time for backend connection.

  • Description: Disconnects connection if data buffered longer than this duration.

  • Description: Prune old session commands when limit exceeded the configured value.

  • Description: Defines the number of statements MaxScale stores per session.

  • Description: Role to activate after connecting to a server.

    Description: Specifies the backend servers associated with the service.

  • Description: Improves accuracy by enabling backend-based transaction state tracking.

  • Description: Remove escape characters from database names when loading users grants from a backend server.

  • Description: Nested services or servers for multi-level routing.

  • Description: Specifies the path to a JSON file containing additional user accounts for client authentication.

  • ,
    file_only_always
  • Default: add_when_load_ok

  • Description: Specifies when the user accounts file is read instead of or alongside server data.

  • Description: Custom version string sent in MySQL handshake.

    (>= MaxScale 24.02.5, 25.01.2),
    0s
    (<= MaxScale 24.02.4, 25.01.1)
  • Auto tune:

  • Description: Specifies the idle timeout for client sessions before termination.

  • Description: Defines the CA certificate used for validating Vault server connections.
    Description: Specifies the hostname of the Vault server.
    Description: Provides the Key-Value mount path in Vault where secrets are stored.
    Description: Defines the port on which the Vault server listens.
    Description: CA ceritficate for KMIP server.

    Description: Enables SSL encryption for connections when set to true.

  • Description: Specifies the CA certificate used to validate the peer’s certificate.

  • Description: Deprecated - use instead.

  • Description: Specifies the maximum depth of the CA chain during verification.

  • Description: Provides the list of TLS ciphers to use for SSL connections.

  • Description: Specifies the CRL file used to validate revoked SSL certificates.

  • Description: Specifies the path to the SSL/TLS private key that is used for secure connections.

  • Description: Defines the passphrase used to decrypt the SSL/TLS private key.

  • Description: Verifies the peer's SSL/TLS certificate against a trusted CA.

  • Description: Verifies the peer's hostname or IP address using its SSL/TLS certificate.

  • ,
    TLSv1.0
    ,
    TLSv1.1
    ,
    TLSv1.2
    ,
    TLSv1.3
    ,
    TLSv10
    ,
    TLSv11
    ,
    TLSv12
    ,
    TLSv13
  • Default: MAX

  • Description: Lists the TLS protocol versions that are allowed for SSL/TLS connections.

  • Description: Indicates the hostname or address that the listener binds to when a connection is made.

  • Description: Specifies the authenticator module used for client authentication.

  • Description: Provides additional configuration settings for the authenticator module.

  • Description: Specifies a file containing SQL statements executed on backend connections after authentication.

  • Mandatory: No
  • Description: Provides the metadata that is given to clients upon connection as a list of key-value pairs separated by commas.

  • Default: 0
  • Description: Specifies the port on which the listener accepts connections.

  • Description: Defines the protocol module that clients and MaxScale use to communicate.

  • Description: Specifies the database URL that clients are sent to following authentication.

  • Default: ""
  • Description: Defines the Unix domain socket that the listener uses to receive inbound connections.

  • ,
    oracle
  • Default: default

  • Description: Specifies the listener's SQL mode, overriding the global sql_mode setting if it is set.

  • Description: Provides optional backend credentials for MariaDB protocol connections, as well as a JSON file that specifies user and group mappings.

  • Default: ""
  • Description: Specifies the hostname or IP address of the backend server to which MaxScale connects.

  • Description: Defines disk usage threshold that triggers warnings or actions when exceeded.

  • Description: Specifies an alternative port that MaxScale uses for administrative connections to the backend server.

  • ,
    up
    ,
    read
    ,
    write
  • Default: down

  • Description: Provides the initial status of the server when it starts or its reconfigured.

  • Description: Specifies a comma-separated list of user-defined labels assigned to the server.

    Minimum: 0 in MaxScale, 1 in MaxScale Trial.

  • Maximum: Unlimited in MaxScale, 15 in MaxScale Trial.

  • Description: Provides the maximum number of routing connections to the server.

  • Description: Specifies the password that is needed to authenticate server-specific monitoring.

    Description: Specifies the username used for authentication in server‑specific monitoring.

  • Description: Shows how long a connection can stay in the persistent pool before being discarded.

  • Description: Defines the server connection pool's maximum size.

  • Description: Identifies the port that connections are accepted by the backend server.

  • Description: Sets the server's priority for selecting the main node.

  • Description: An alternate hostname or IP address is used for internal communications.

  • Description: Allows the original client IP address and port to be forwarded to backend servers using PROXY protocol headers.

  • ,
    secondary
  • Default: primary

  • Description: Specifies the server's priority when making routing decisions.

  • Default: ""
  • Description: Specifies the Unix domain socket route that is used to establish a connection with the backend server.

  • Description: Manages whether service credentials are used for backend authentication before switching to the client user.

  • Description: Specifies the location of the GSSAPI authentication-related Kerberos keytab file.

  • Description: Defines the service principal name used in GSSAPI authentication.

  • Description: Allows tracking of password hash mismatches during authentication.

  • ,
    mariadb
  • Default: none

  • Description: Manages the mapping of PAM-authenticated users to backend authentication.

  • Description: Specifies a JSON file containing passwords for PAM-mapped users.

    ,
    password_2FA
    ,
    suid
  • Default: password

  • Description: Defines the PAM authentication mode for client login.

  • Description: Enables cleartext password authentication between the client and MaxScale when using PAM.

  • Description: Excludes events, which match the specified regular expression.

    Description: Includes only events that match the given regular expression.

    Description: Specifies the replacement pattern that replication events use to rewrite statements.

    Description: Describes the pattern that is used to match statements in replication events for rewriting.

    ,
    read_only_transactions
    ,
    all_transactions
  • Default: all_transactions

  • Description: Manages how the cache is used and updated during transactions.

  • ,
    thread_specific
  • Default: thread_specific

  • Description: Determines whether cached data remains thread-specific or shared across threads.

  • Description: Controls whether the cache is cleared when modifying statements are not parsed correctly.

  • Description: Uses a bitmask value to control the cache's debug logging level.

  • Description: Manages whether the cache is enabled or disabled at startup.

  • (no limit)
  • Description: Specifies how long cached data can last before being deleted and reloaded.

  • ,
    current
  • Default: never

  • Description: Manages how cached data is invalidated when changes occur.

  • (no limit)
  • Description: Specifies the maximum amount of data that cache can store.

  • (no limit)
  • Description: Defines the maximum number of rows in a result set that can be cached.

  • (no limit)
  • Description: Specifies the maximum result set size that can be cached.

  • (no limit)
  • Description: Defines the maximum total size of the cache.

  • (no rules)
  • Description: Specifies the file path containing caching rules.

  • ,
    verify_cacheable
  • Default: assume_cacheable

  • Description: Controls whether SELECT statements are considered to be cacheable or validated before caching.

  • (no limit)
  • Description: Determines how long cached data is used before being refreshed from the backend.

  • Description: Defines the storage module used by the cache.

  • Description: Deprecated. Previously used to pass configuration options to the storage module.

  • Description: Specifies the timeout for processes involving external storage backends.

  • ,
    isolated
  • Default: mixed

  • Description: Manages whether cached data is stored separately for each user or shared between users.

  • Description: Defines the maximum size of a value that can be stored in the cache.

    Description: Specifies the Memcached server address. The default port is 11211 is used when no port is provided.
  • Description: Password used for authentication.

  • Description: Defines the Redis server address. The default port is 6379 is used when no port is provided.
  • Description: Enable SSL when connectign to the Redis server.

  • Description: Specifies the CA certificate used to verify the Redis server certificate.

  • Description: Defines the SSL client certificate used when connecting to the Redis server.

  • Description: Specifies the private key for the SSL client that is used to connect to the Redis server.

  • Description: Username used for authentication.

  • Description: Defines the number of statements that are sent to the primary following a data-modifying statement.

  • Description: Manages whether write activity from a single connection affects routing behavior for all connections.

  • Description: Defines a pattern for queries that should be ignored.

  • Description: Specifies a pattern for statements that cause re-routing of statements.

  • ,
    case
    ,
    extended
  • Default: ignorecase

  • Description: Defines regular expression options used with match and ignore.

  • Description: Determines the time range during which statements are directed to the primary following a data-modifying statement.

  • Description: Specifies the S3 object storage host.

  • Description: TLS certificate verification is disabled for object storage when enabled.

    Description: Defines the port used to connect to the S3 object storage.

    Values: 0, 1, 2

  • Description: Specifies the protocol version used to communicate with object storage.

  • Description: Defines the S3 region that contains the data.

  • Description: Enables unencrypted HTTP communication with the object storage when set to true.

  • Description: Manages whether masking rules are applied to subqueries.

  • Description: Controls whether masking rules are applied to the UNION queries.

  • Description: Manages whether user variables are applied to user variables.

  • ,
    abort
  • Default: abort

  • Description: Controls how payloads larger than 16MB are managed by the masking filter.

  • Description: Manages whether queries using functions on masked columns are rejected.

  • Description: Determines whether statements that cannot be fully parsed are rejected.

  • Description: Manages if functions' string parameters are managed as fields for masking.

  • ,
    always
  • Default: never

  • Description: Controls whether a column with an unsupported type is matched by a masking rule and whether a warning is logged.

  • Description: Manages the level of debug logging for the MaxRows filter.

  • ,
    error
    ,
    ok
  • Default: empty

  • Description: Regulates the response that is sent to the client when the limitations defined by the results are exceeded.

  • Description: Specifies the maximum number of rows allowed in a result set returned to the client.

  • Description: Restricts the size of a resultset that can be returned to the client; larger resultsets are replaced with an empty result.

  • Description: Defines a numbered regex pattern to match SQL queries and apply a corresponding routing target when the pattern is matched.

    ,
    case
    ,
    extended
  • Default: ignorecase

  • Description: Describes the collection and matching process for the matchXY regular expressions (e.g., case sensitivity or extended syntax).

  • Description: Limits the filter to client connections from particular IP addresses or patterns; the regex rules will only be applied to sessions that match.

    Description: Defines the routing hint used to direct queries that match the corresponding matchXY pattern to specific server or roles.

    Description: Limit the filters to sessions authenticated with a specific username; the routing hints and regex rules will only be applied to matching users.

  • Description: Defines whether a new routing hint is added to existing ones or replaces them when applied to matching queries.

  • Description: Defines the time unit used for logging durations.

  • Description: Defines a regex pattern to exclude queries from matching and filtering.

  • Description: Manages whether log files are immediately flushed to disk after each write operation.

  • ,
    session
    ,
    date
    ,
    user
    ,
    reply_time
    ,
    total_reply_time
    ,
    query
    ,
    default_db
    ,
    num_rows
    ,
    reply_size
    ,
    transaction
    ,
    transaction_time
    ,
    num_warnings
    ,
    error_msg
  • Default: date, user, query

  • Description: Specifies the fields, such as query details, user, timing, and execution metadata, that are present in each log entry.

  • ,
    unified
    ,
    stdout
  • Default: session

  • Description: Defines the logging output type, such as per-session files, a unified log file, or standard output.

  • Description: Specifies a regex pattern for queries ti include and process by the filter.

  • Description: Specifies the string that is used to substitute newline characters in logged queries so that the log output is consistent and readable.

  • ,
    ignorecase
    ,
    extended
  • Default: case

  • Description: Defines the regex matching behavior (case sensitivity and extended syntax) for filter queries.

  • Description: Specifies the string used to separate fields within each log entry.

  • Description: Limits logging to sessions that originate from specific client source addresses.

  • Description: Log queries in canonical format, replacing user-defined constants with placeholders to ensure consistent and secure output.

  • Description: Limits logging to sessions initiated by a specific username.

  • Description: Identifies a file where all queries, matched and unmatched, are logged, mainly for diagnostic purposes.

    Description: Allows runtime logging of matched and unmatched queries with replacements at the info level for diagnostic purposes.

    ,
    case
    ,
    extended
  • Default: ignorecase

  • Description: Determines how the match regex pattern is compiled, including case sensitivity and extended syntax.

  • match
    the specific pattern.

    Description: Restricts the match-and-replace filter to client connections originating from a specified address.

    Description: Limits the match-and-replace filter to sessions initiated by a specific username.

    Description: Defines whether template matching is case-sensitive by default.

    Description: Allows logging of query replacements at the NOTICE level for monitoring and debugging.

    Values: Native, ECMAScript, Posix, EPosix, Awk, Grep, EGrep

  • Description: Overrides the template's default regex grammar, allowing it to be used with alternative regex engines such as ECMAScript or Posix.

  • Description: Specifies the file path to the template used by the filter.

  • Default: From maxscale.cnf

  • Description: Defines the default tes such as Native, ECMAScript, and POSIX.

  • Description: Defines a regex pattern to exclude queries from processing or matching.

    Description: Defines a regex pattern to include only queries that match it for processing or filtering.

    ,
    case
    ,
    extended
  • Default: ignorecase

  • Description: Determines how regular expressions are parsed, including case sensitivity and extended syntax.

  • Description: Specifies the service for which queries are replicated; deprecated in favor of the target parameter.

    Description: Limits query replication to sessions that start from a specific client IP address.

  • Description: Allows synchronous routing, ensuring queries are executed on both the main and branch targets before continuing; branch failures close the client connection.

  • Description: Specifies the branch target, which is the service or server where queries will be replicated.

    Description: Restricts query replication to sessions initiated by a specific username.

    Description: Specifies the time interval used to decide when continuous throttling begins and finishes.

    Description: Defines the time interval during which queries per second (QPS) are mesaured for throttling purposes.

  • Description: Sets the number of SQL statements to store and include in the report.

  • Description: Defines a regex pattern that prevents the filter from logging specific queries.

    Description: Defines a regex pattern that only logs requests that match it, while ignoring others.

    ,
    case
    ,
    extended
  • Default: case

  • Description: Determines how the match and exclude regex patterns are handled, including case sensitivity and extended syntax.

  • Description: Limits logging to sessions that start from a specific client IP address.

    Description: Limits logging to sessions initiated by a specific username.

    Description: Specifies the directory in which session capture subdirectories are kept for each filter.

  • Dynamic: No

  • Description: Determines how long a session capture can run; a value of 0 indicates an infinite duration.

  • Dynamic: No

  • Description: Specifies the maximum session capture size in bytes; a value of 0 indicates no size restriction.

  • Description: Determines whether session capture starts automatically when MaxScale starts.

  • Description: Specifies the maximum number of times MaxScale attempts to connect to a backend during each monitoring cycle.

  • Description: Sets the maximum amount of time allowed to connect to a backend server; deprecated in favor of backend timeout.

  • Description: Specifies the timeout for reading query results from a backend server. Deprecated and ignored since MaxScale 25.08.0.

  • Description: Deprecated and ignored since MaxScale 25.10.0.

  • Description: Sets the minimum interval between disk space checks; a value of 0 disables automatic checks.

  • Description: Defines the disk usage limit (per path) that creates alerts. It can be set globally in the monitor or individually per server if disk configurations differ.

    ,
    master_up
    ,
    slave_down
    ,
    slave_up
    ,
    server_down
    ,
    server_up
    ,
    lost_master
    ,
    lost_slave
    ,
    new_master
    ,
    new_slave
  • Default: All events

  • Description: Specifies which server events cause a script to execute; if not provided, it defaults to all events.

  • Description: Sets the maximum age of journal files; older files are deleted when the monitor starts.

  • mariadbmon
    or
    orgaleramon
    .
  • Description: Determines how often the monitor checks and updates the status of servers; shorter intervals result in more frequent checks.

  • passwd
    settings.

    Description: Specifies custom SQL commands to be executed on a primary (Master) server when it achieves Master status or when the monitor starts, allowing for role-based configuration changes.

    Description: Specifies custom SQL commands to run on a replica (Slave) server when they get Slave status or when the monitor starts, allowing role-based configuration changes.

    Description: Specifies a user role to activate when the monitor connects to a server, providing privilege separation between monitoring and service operations.

    Description: Specifies a command to execute when the server status changes, with the help of placeholders (such as $INITIATOR, $EVENT, and $MASTERLIST) that MaxScale replaces with relevant server information; script output is reported based on message prefixes.

  • Description: Sets a maximum period of time a script can execute; if this limit exceeds the allowed duration, the script is issued SIGTERM, followed by SIGKILL if it does not stop.

  • monitoruser
    .
    wsrep_local_index = 0
    can be chosen as the primary for writes, enabling many MaxScale instances to use the same primary node.
    wsrep_sst_donor
    global variable is set on each replica node, listing eligible donor nodes for SST in a sorted order based on priority or
    wsrep_local_index
    .
  • Description: When enabled, the monitor assumes that the server hostnames and ports in the configuration match those provided by the servers, resulting in accurate topology identification and support for cluster actions such as failover and switching.

  • ,
    majority_of_all
    ,
    majority_of_running
  • Default: none

  • Description: Controls how a monitor achieves exclusive locks in multi-MaxScale configurations; decides whether a monitor becomes primary based on the majority of all servers, only running servers, or none at all.

  • Description: Automatically sets read_only on any writable servers that are not the primary and are not under maintenance, ensuring that non-primary servers remain read-only.

  • Description: Automatically sets read_only flag on writable replica servers, allowing only privileged users to write; the primary server is unaffected.

  • Description: Ensures that the primary server is always writable by automatically disabling read-only mode during monitoring.

  • Description: Specifies how many consecutive monitor cycles a primary must fail before being considered down and requiring failover or primary reselection.

  • Description: When disk space is low, non-primary servers are automatically put into maintenance mode, which stops them from being used for sessions or failover unless they are manually removed.

  • ,
    connecting_slave
    ,
    connected_slave
    ,
    running_slave
    ,
    primary_monitor_master
    ,
    disk_space_ok
  • Default: primary_monitor_master, disk_space_ok

  • Description: Specifies additional requirements for a server to be considered primary, such as the availability of connected or running replicas, sufficient disk space, or agreement with supporting monitors.

  • Description: Sets a replication lag threshold (in seconds) that executes the monitor script when exceeded (rlag_above) or returned below (rlag_below); negative values disable this feature.

  • ,
    linked_master
    ,
    running_master
    ,
    writable_master
    ,
    primary_monitor_master
  • Default: none

  • Description: Specifies additional requirements for a server to be identified as a Slave, such as being connected to a running or writable primary; several conditions can be coupled using an enum mask.

  • Description: Provides the backup storage server's hostname or IP address. The server does not have to run MariaDB or be monitored by MaxScale. MaxScale connects via SSH, and the storage must have enough disk space to accommodate all backups.

    Description: Specifies the path to the backup storage host where backups will be saved. The SSH user specified in ssh_user must have full read and write access to this directory.

  • Description: Defines the number of parallel threads to use while running mariadb-backup. This value is used as the --parallel=<val> for mariadb-backup --backup. Increasing this value can accelerate backups on systems with multiple CPUs and fast I/O.

  • Description: Specifies how much memory mariadb-backup should use during the --prepare phase. This value is specified with the --use-memory=<val>. Setting it to an empty string disables the option and allows mariadb-backup to utilize the internal default. Increasing RAM can accelerate backup preparation, especially for large datasets.

  • Description: Specifies the TCP port on which the source server will listen for the rebuild (SST) connection during a state transfer. This port must be open (not blocked by firewalls) and free (not in use by another process). If another process uses the port when the rebuild begins, MaxScale will attempt to terminate it to free up the port.

  • Description: Manages whether MaxScale verifies the SSH host key when connecting to a backend server. When set to true, MaxScale requires that the backend server’s host key is already present in the known_hosts file of the user running MaxScale. This ensures the authenticity of the server during SSH connections.

  • Description: Specifies the SSH private key file used by MaxScale to authenticate when connecting to backend servers.

  • Description: Uses port for SSH connections when executing remote commands on backend servers.

  • Description: Specifies the maximum duration allowed for SSH commands during a rebuild before timing out.

  • Description: Specifies the SSH username for logging in to backend servers to execute commands.

    ,
    on
    ,
    yes
    ,
    1
    ,
    false
    ,
    off
    ,
    no
    ,
    0
    ,
    safe
  • Default: false

  • Description: Enables or disables automated primary failover, which allows MaxScale to select a new primary if the current one fails.

  • Description: Allows automatic redirection of servers to duplicate from the current primary, resulting in a 1-primary-N-replicas architecture.

  • Description: Specifies a SQL file to execute when a server is downgraded; equivalent to promotion_sql_file.

  • Description: Promotes a 1-primary-N-replicas cluster configuration, automatically reconnecting servers and deleting unnecessary replication sources to maintain a simple topology.

  • Description: Sets the maximum time allowed for a failover operation before it is terminated and automatic failover is disabled.

  • Description: Manages whether the monitor tracks and updates scheduled events on servers during offers, demotions, and rejoins.

  • Description: Specifies the duration MaxScale waits before considering a primary server as failed.

  • Description: Specifies a file of SQL statements to execute on a server during promotion to primary.

  • Description: Enables SSL encryption for replication by configuring generated replication commands to use secure connections.

  • Description: Specifies the password used by the replication user for authentication.

    Description: Specifies the username used for replication authentication when configuring replica connections.

  • Description: Lists the servers that are excluded from being promoted to primary during failover or automatic selection.

  • Description: Defines the maximum time allowed for switchover and rejoin operations before timing out.

  • Description: Enables verification of primary server failure using replica status before triggering automatic failover.

  • Dynamic: Yes

  • Description: Defines the action to consider when the primary fails a write text, either logging the failure or triggering a failover.

  • Description: Specifies the fully qualified table used by the monitor to perform primary server write tests.

    Description: Manages whether the replication protocol is permitted through this listener.

    Description: Specifies the database that stores NoSQL account information for authentication.
    Description: Specifies the encryption key ID used to encrypt NoSQL account information in the database.
    Description: Specifies the password for the NoSQL authentication user.
    Description: Determines whether clients are required to authenticate before accessing the service.
    Description: Controls whether NoSQL account information is stored in a shared or private manner.
    Description: Enables or disables NoSQL protocol–level authorization for user management commands.
    Description: Controls whether databases are automatically created when required.
    Description: Controls whether tables are automatically created within existing databases when required.
    Description: Sets the maximum idle time before an inactive cursor is automatically closed.
  • Default: none

  • Description: Manages which protocol events are logged, including incoming commands, backend SQL, and client responses.

  • Description: Specifies the host portion of the MariaDB user account created via the NoSQL protocol.
    *Default: 35
  • Description: Sets the length of the id column for automatically created tables.

  • cache
    filter.
    Description: Determines whether unsupported or unknown client commands are logged for debugging.

    Default: return_error

  • Description: Defines how the system responds to unrecognized client commands, either with an error or an empty result.

  • Default: default

  • Description: Controls whether multi-document inserts are performed completely or individually based on the ordered setting.

  • Description: Specifies the password used for backend connections when the MongoDB client is unauthenticated.
    Description: Specifies the username used for backend connections when the MongoDB client is unauthenticated.

    data.relationships.services.data

  • The service relationships data, must define a JSON object with an id value that defines the service to use and a type value set to services.

  • data.attributes.parameters.user

  • The to use

  • data.attributes.parameters.password

  • The to use

  • data.attributes.parameters.port

  • The to use. Needs to be defined if the address field is defined.

  • data.attributes.parameters.user

  • The to use

  • data.attributes.parameters.password

  • The to use

  • Description: Specifies the directory where files are archived when expiration_mode is set to archive.

    ,
    zstandard
  • Default: none

  • Description: Defines the compression algorithm to use for archived files.

  • Description: Shows the directory where binary log files are stored.

  • Description: When enabled, only DDL events (CREATE, ALTER, DROP) are logged, excluding data changes.

    ,
    AES_CTR
    ,
    AES_GCM
  • Default: AES_GCM

  • Description: Defines the AES encryption mode used for securing data, such as GCM, CBC, or CTR.

  • Description: Specifies the encryption key ID used to encrypt binary logs, requiring a configured key manager.

  • Default: purge

  • Description: Indicates whether expired logs are automatically deleted or archived.

  • Description: Sets the duration after which binary log files expire and are eligible for purge or archiving.

  • Description: Determines the minimum number of binary log files to keep during automatic purging.

  • Description: Sets the network connection and read timeout for the primary server connection.

  • Description: Specifies the minimum number of binary log files to keep up uncompressed.

  • Description: Enables semi-synchronous replication from a MariaDB server by sending acknowledgements for received events.

  • Description: Selects a primary server for replication automatically from a list of servers that are monitored and have Master status.

  • Description: Mentions the server ID used by MaxScale for replication and serving binary logs to replicas.

  • ,
    other
    , `both'
  • Default: both

  • Description: Determines whether queries are EXPLAINed on the main server, other servers, or both.

  • Description: Sets the maximum number of times a canonical statement is EXPLAINed throughout the explain period.

    Description: Defines the time window over which the explain_entries limit applies for EXPLAIN operations.

    Description: Sets the maximum allowed request la on replica servers before SELECTs are skipped to connect with the primary server.

    ,
    ignore
  • Default: ignore

  • Description: Determines whether errors from replica servers close the session or are ignored.

  • Max: 100

  • Default: 99

  • Description: Defines the percentile of samples used to calculate histogram width and bin count.

  • Description: Specifies the time window over which queries per second (QPS) are calculated and logged.

    ,
    on_discrepancy
    ,
    never
  • Default: on_discrepancy

  • Description: Defines when results from main and other executions are logged: always, on discrepancy, or never.

  • Description: Controls whether replication on other is reset and restarted after a read-write Diff session completes.

  • Description: Sets how many of the fastest statements are kept in memory for summary reporting.

    Description: Sets how many of the slowest statements are kept in memory for summary reporting.

    Default: 1000

  • Description: Defines the number of samples collected to determine histrogram bin edges and counts.

  • ,
    read_write
  • Default: read_only

  • Description: Determines whether the Exasolrouter appears as read-only or read-write to other MaxScale components.

  • ,
    activate-only
    ,
    custom:<path>
    ,
    disabled
  • Default: auto

  • Description: Defines how the Exasol preprocessor script is managed: auto-installed, activate-only, custom path, or disabled.

  • Description: Specifies the name of a custom Exasol preprocessor script when using a custom preprocessor path.

    format for connecting to the cluster.
  • Description: Enables coperative replication, allowing multiple MaxScale instances to replicate from the same cluster while ensuring each event is processed only once.

  • Description: Enables idempotent Kafka producer mode to reduce duplicate message delivery and preserve message order.

  • Description: Excludes tables matching a specified pattern from being sent to Kafka.

  • Description: Specifies the initial GTID position for replication; supports newest and oldest special values.

  • ,
    SCRAM-SHA-256
    ,
    SCRAM-SHA-512
  • Default: PLAIN

  • Description: Specifies the SASL authentication mechanism for connecting to Kafka, such as PLAIN or SCRAM-SHA variants.

  • Description: Specifies the password used for SASL authentication with Kafka.

  • Description: Specifies the username used for SASL authentication with Kafka.

  • Description: Enables SSL encryption for Kafka connections.

  • Description: Specifies the path to the CA certificate file for SSL Kafka connections.

  • Description: Specifies the path to the client SSL certificate file for Kafka connections.

  • Description: Specifies the path to the client SSL private key for Kafka connections.

  • Description: Includes only tables whose combined database and table names match the specified pattern for Kafka replication.

  • Description: Determines whether to read the latest GTID from Kafka on startup to resume replication.

  • Description: Controls whether table schema change events are sent as JSON objects into the Kafka stream.

  • Description: Specifies the server ID used when connecting to the primary for replication.

  • Description: Defines the timeout for establishing and reading from the replication stream connection.

  • Description: Defines the maximum number of records to buffer before committing a batch of imported data.

  • Dynamic: Yes
  • Description: Specifies the storage engine used when creating tables for imported Kafka data.

  • ,
    SCRAM-SHA-256
    ,
    SCRAM-SHA-512
  • Default: PLAIN

  • Description: Specifies the SASL authentication mechanism used for Kafka connections.

  • Description: Specifies the SASL password for Kafka authentication, requiring a corresponding username.

  • Description: Specifies the SASL username for Kafka authentication, requiring a corresponding password.

  • Description: Enables or disables SSL encryption for Kafka connections.

  • Description: Specifies the CA certificate file used to verify Kafka SSL connections, or defaults to the system CA.

  • Description: Defines the SSL certificate file for Kafka connections, requiring a corresponding private key.

  • Description: Specifies the SSL private key file for Kafka connections, requiring a corresponding certificate.

  • ,
    key
  • Default: topic

  • Description: Defines whether the Kafka topic or message key is used to determine the target table for data insertion.

  • Description: Sets the timeout for network communication with both Kafka and MariaDB.

  • ,
    file
    ,
    kafka
  • Description: Specifies the destination where metrics are exported, such as log, file, or Kafka.

  • Description: Specifies the file path where metrics are written when the file exporter is enabled.

    Description: Specifies the list of Kafka brokers used to send metrics when the Kafka exporter is enabled.

    Description: Specifies the Kafka topic used to publish metrics when the Kafka exporter is enabled.

    Dynamic: Yes
  • Values: ignore, close

  • Description: Defines how backend connection failures are handled, either by ignoring them or closing the client connection.

  • Dynamic: Yes
  • Values: always, on_conflict

  • Description: Determines when query results are reported to the client, either always or only on conflicts.

  • Description: Determines whether read queries are routed to the primary server when selecting servers.

    Description: Sets the maximum allowed replication lag for a server to be used for routing.

    ,
    slave
    ,
    synced
    ,
    running
  • Default: running

  • Description: Specifies which server roles are eligible for connections when establishing new router sessions.

  • ,
    local
    ,
    global
    ,
    fast
    ,
    fast_global
    ,
    universal
    ,
    fast_universal
  • Default: none

  • Description: Controls causal read behavior to ensure reads reflect prior writes despite replication lag.

  • Description: Defines how long to wait for replica synchronization when using causal reads before timing out.

    Description: Enables retrying failed queries for a limited time before returning an error if no server becomes available.

    Description: Specifies how long to wait before returning an error to the client when delayed retries are enabled.

    Description: Enables on-demand creation of backend connections instead of opening all connections at session start.

    Description: Determines whether the primary server can be used to handle read queries alongside replicas.

    ,
    fail_on_write
    ,
    error_on_write
  • Default: fail_on_write (MaxScale 23.08: fail_instantly)

  • Description: Defines how the router handles primary server failure and client behavior during write operations.

  • Description: Controls whether a session can reconnect to a new primary server if the current one becomes unavailable.

  • Description: Sets the maximum allowed replication lag for replicas to be eligible for routing read queries.

    Max: 255

  • Default: 255

  • Description: Limits the maximum number of replica connections a session can use simultaneously.

  • Description: Determines whether failed autocommit read queries are retried on another replica.

    Description: Specifies the initial number of replica connections a session creates for routing read queries.

    ,
    adaptive_routing
    ,
    least_behind_master
    ,
    least_router_connections
    ,
    least_global_connections
  • Default: least_current_operations

  • Description: Defines the criteria used to select replica servers for routing read queries and balancing load.

  • Description: Ensures that all queries after a multi-statement query are routed to the primary to maintain session consistency.

    Description: Ensures that queries following a stored procedure call are routed to the primary to maintain consistency.

  • Description: Controls whether temporary tables block reconnections, ensuring they are not lost during primary node failovers.

  • ,
    soft
    ,
    hard
  • Default: none

  • Description: Defines how transactions are synchronized across replicas, with options for no synchronization, soft (non-blocking), or hard (blocking) synchronization.

  • Max: 255

  • Default: 1

  • Description: Specifies the minimum number of backend servers required to understand a transaction before it is considered committed.

  • Description: Sets the maximum allowed transaction synchronization latency in soft mode before triggering synchronization.

    Description: Sets the maximum time a transaction waits for synchronization before returning or closing the connection.

    Description: Enables replay of interrupted transactions, automatically retrying them on a replacement server if the current one fails.

    Description: Determines the maximum number of times a transaction will be retried during replay before failing.

    ,
    result_only
    ,
    no_insert_id
  • Default: full

  • Description: Specifies the method for calculating transaction checksums to verify replayed transactions; full ensures complete consistency.

  • Description: Sets the maximum transaction size (in bytes) that can be replayed; larger transactions are not replayed.

    Description: Automatically retries transactions that encounter a deadlock until they succeed or a checksum error occurs.

    Description: Retries transactions that fail due to checksum mismatches during replay, subject to the set limits.

    Description: Prevents replaying transactions that are about to commit to avoid duplicates; enabled by default.

  • Description: Sets the maximum duration for attempting transaction replay; set to 0 to disable.

  • ,
    all
  • Default: all

  • Description: Controls which nodes handle SELECT statements using SQL user variables; defaults to all nodes.

  • Description: Disables the detection of duplicate tables on shards while it is enabled.

  • Description: Specifies a list of full table names to ignore when checking for duplicate tables.

  • Description: Defines a PCRE2 regular expression to ignore specific tables when checking for duplicate databases.

  • Description: Specifies how long stale database map entries can be used by new connections while an update is in progress.

  • Description: Allows the database map to be refreshed when a USE... query fails during a session.

  • Description: Sets the minimum interval between database map refreshes to maintain cluster metadata up to date.

  • Global Settings

    Service

    Settings for File-based Key Manager

    Settings for HashiCorp Vault Key Manager

    Settings for KMIP Key Manager

    Settings for TLS/SSL Encryption

    reference

    Settings

    Settings

    reference/maxscale-authenticators

    reference/maxscale-filters

    reference/maxscale-monitors

    reference/maxscale-protocols

    reference/maxscale-rest-api

    reference/maxscale-routers

    admin_audit
    boolean
    admin_audit_exclude_methods
    enum
    admin_audit_file
    admin_auth
    boolean
    admin_enabled
    boolean
    admin_gui
    boolean
    admin_host
    admin_jwt_algorithm
    enum
    admin_jwt_issuer
    admin_jwt_key
    admin_jwt_max_age
    duration
    admin_log_auth_failures
    boolean
    admin_oidc_client_id
    admin_oidc_client_secret
    admin_oidc_extra_options
    admin_oidc_flow
    enum
    admin_oidc_ssl_insecure
    boolean
    admin_oidc_url
    admin_pam_readonly_service
    admin_pam_readwrite_service
    admin_port
    admin_readwrite_hosts
    admin_root_url
    admin_secure_gui
    boolean
    admin_ssl_ca
    admin_ssl_cert
    admin_ssl_cipher
    admin_ssl_key
    admin_ssl_passphrase
    admin_ssl_verify_peer_certificate
    boolean
    admin_ssl_verify_peer_host
    boolean
    admin_ssl_version
    enum_mask
    admin_verify_url
    auth_connect_timeout
    duration
    auto_tune
    config_sync_cluster
    config_sync_db
    config_sync_interval
    duration
    config_sync_password
    config_sync_timeout
    duration
    config_sync_user
    connector_plugindir
    core_file
    boolean
    datadir
    debug
    dump_last_statements
    enum
    host_cache_size
    key_manager
    enum
    libdir
    load_persisted_configs
    boolean
    local_address
    log_augmentation
    log_debug
    boolean
    log_info
    boolean
    log_notice
    boolean
    log_throttling
    duration
    duration
    log_warn_super_user
    boolean
    log_warning
    boolean
    logdir
    max_auth_errors_until_block
    maxlog
    boolean
    module_configdir
    ms_timestamp
    boolean
    passive
    boolean
    persist_runtime_changes
    boolean
    persistdir
    piddir
    query_classifier_cache_size
    size
    query_retries
    query_retry_timeout
    duration
    rebalance_period
    duration
    rebalance_threshold
    rebalance_window
    require_secure_transport
    boolean
    retain_last_statements
    secretsdir
    session_trace
    session_trace_match
    regex
    sharedir
    skip_name_resolve
    boolean
    sql_mode
    enum
    substitute_variables
    boolean
    syslog
    boolean
    telemetry
    boolean
    telemetry_attributes
    telemetry_ssl_ca
    telemetry_ssl_cert
    telemetry_ssl_insecure
    boolean
    telemetry_ssl_key
    telemetry_update_interval
    duration
    telemetry_url
    threads
    threads_max
    trace_file_dir
    trace_file_size
    size
    users_refresh_interval
    duration
    users_refresh_time
    duration
    writeq_high_water
    size
    writeq_low_water
    size
    auth_all_servers
    boolean
    cluster
    connection_keepalive
    duration
    disable_sescmd_history
    boolean
    enable_root_user
    boolean
    filters
    force_connection_keepalive
    boolean
    idle_session_pool_time
    duration
    log_auth_warnings
    boolean
    log_debug
    boolean
    log_info
    boolean
    log_notice
    boolean
    log_warning
    boolean
    max_connections
    max_sescmd_history
    multiplex_timeout
    duration
    net_write_timeout
    durations
    password
    prune_sescmd_history
    boolean
    retain_last_statements
    role
    router
    servers
    session_track_trx_state
    boolean
    strip_db_esc
    boolean
    targets
    user
    user_accounts_file
    user_accounts_file_usage
    enum
    version_string
    wait_timeout
    duration
    file.keyfile
    vault.ca
    vault.host
    vault.mount
    vault.port
    vault.timeout
    duration
    vault.tls
    boolean
    vault.token
    kmip.ca
    kmip.cert
    kmip.host
    kmip.key
    kmip.port
    ssl
    boolean
    ssl_ca
    ssl_cert
    ssl_cert_verify_depth
    ssl_cipher
    ssl_crl
    ssl_key
    ssl_passphrase
    ssl_verify_peer_certificate
    boolean
    ssl_verify_peer_host
    boolean
    ssl_version
    enum_mask
    address
    authenticator
    authenticator_options
    connection_init_sql_file
    connection_metadata
    port
    protocol
    redirect_url
    service
    socket
    sql_mode
    enum
    user_mapping_file
    address
    disk_space_threshold
    extra_port
    initial_status
    labels
    max_routing_connections
    monitorpw
    monitoruser
    persistmaxtime
    duration
    persistpoolmax
    port
    priority
    private_address
    proxy_protocol
    boolean
    rank
    enum
    replication_custom_options
    socket
    use_service_credentials
    boolean
    gssapi_keytab_path
    principal_name
    log_password_mismatch
    boolean
    pam_backend_mapping
    enumeration
    pam_mapped_pw_file
    pam_mode
    enumeration
    pam_use_cleartext_plugin
    boolean
    exclude
    regex
    match
    regex
    rewrite_dest
    regex
    rewrite_src
    regex
    cache_in_transactions
    enum
    cached_data
    enum
    clear_cache_on_parse_errors
    boolean
    debug
    enabled
    boolean
    hard_ttl
    duration
    invalidate
    enum
    max_count
    max_resultset_rows
    max_resultset_size
    size
    max_size
    size
    rules
    selects
    enum
    soft_ttl
    duration
    storage
    storage_options
    timeout
    duration
    users
    enum
    max_value_size
    size
    server
    password
    server
    ssl
    boolean
    ssl_ca
    ssl_cert
    ssl_key
    username
    inject
    count
    global
    boolean
    ignore
    regex
    match
    regex
    options
    enum
    time
    duration
    host
    key
    no_verify
    boolean
    port
    protocol_version
    region
    secret
    use_http
    boolean
    check_subqueries
    bool
    check_unions
    bool
    check_user_variables
    bool
    large_payload
    enum
    prevent_function_usage
    bool
    require_fully_parsed
    bool
    rules
    treat_string_arg_as_field
    bool
    warn_type_mismatch
    enum
    debug
    max_resultset_return
    enum
    max_resultset_rows
    max_resultset_size
    size
    matchXY
    regex
    options
    enum
    source
    targetXY
    user
    append
    bool
    duration_unit
    exclude
    regex
    filebase
    flush
    bool
    log_data
    enum_mask
    log_type
    enum_mask
    match
    regex
    newline_replacement
    options
    enum_mask
    separator
    source
    source_exclude
    regex
    source_match
    regex
    use_canonical_form
    bool
    user
    user_exclude
    regex
    user_match
    regex
    log_file
    log_trace
    match
    regex
    options
    enum
    replace
    source
    user
    case_sensitive
    boolean
    log_replacement
    boolean
    regex_grammar
    template_file
    case_sensitive
    boolean
    continue_if_matched
    boolean
    ignore_whitespace
    boolean
    regex_grammar
    what_if
    boolean
    exclude
    regex
    match
    regex
    options
    enum
    service
    source
    sync
    boolean
    target
    user
    continuous_duration
    duration
    max_qps
    sampling_duration
    duration
    throttling_duration
    duration
    count
    exclude
    regex
    filebase
    match
    regex
    options
    enum
    source
    user
    capture_dir
    capture_duration
    duration
    capture_size
    size
    start_capture
    boolean
    backend_connect_attempts
    backend_connect_timeout
    duration
    backend_read_timeout
    duration
    backend_write_timeout
    duration
    disk_space_check_interval
    duration
    disk_space_threshold
    events
    enum
    journal_max_age
    duration
    module
    monitor_interval
    duration
    password
    primary_state_sql
    replica_state_sql
    role
    script
    script_timeout
    duration
    servers
    user
    available_when_donor
    boolean
    disable_master_failback
    boolean
    disable_master_role_setting
    boolean
    root_node_as_master
    boolean
    set_donor_nodes
    boolean
    use_priority
    boolean
    assume_unique_hostnames
    boolean
    cooperative_monitoring_locks
    enum
    enforce_read_only_servers
    boolean
    enforce_read_only_slaves
    boolean
    enforce_writable_master
    boolean
    failcount
    maintenance_on_low_disk_space
    boolean
    master_conditions
    enum_mask
    script_max_replication_lag
    slave_conditions
    enum_mask
    backup_storage_address
    backup_storage_path
    mariadb_backup_parallel
    mariadb_backup_use_memory
    rebuild_port
    ssh_check_host_key
    boolean
    ssh_keyfile
    ssh_port
    ssh_timeout
    duration
    ssh_user
    auto_failover
    enum
    auto_rejoin
    boolean
    demotion_sql_file
    enforce_simple_topology
    boolean
    failover_timeout
    duration
    handle_events
    boolean
    master_failure_timeout
    duration
    promotion_sql_file
    replication_master_ssl
    boolean
    replication_password
    replication_user
    servers_no_promotion
    boolean
    switchover_timeout
    duration
    verify_master_failure
    boolean
    write_test_fail_action
    enum
    write_test_interval
    duration
    write_test_table
    allow_replication
    boolean
    authentication_db
    authentication_key_id
    authentication_password
    authentication_required
    boolean
    authentication_shared
    boolean
    authentication_user
    authorization_enabled
    boolean
    auto_create_databases
    boolean
    auto_create_tables
    boolean
    cursor_timeout
    duration
    debug
    enum_mask
    host
    id_length
    internal_cache
    log_unknown_command
    boolean
    on_unknown_command
    enum
    ordered_insert_behavior
    enum
    password
    user
    address
    socket
    archivedir
    compression_algorithm
    enum
    datadir
    ddl_only
    boolean
    encryption_cipher
    enum
    encryption_key_id
    expiration_mode
    enum
    expire_log_duration
    duration
    expire_log_minimum_files
    net_timeout
    duration
    number_of_noncompressed_files
    rpl_semi_sync_slave_enabled
    boolean
    select_master
    boolean
    server_id
    explain
    enum
    explain_entries
    explain_period
    duration
    main
    max_request_lag
    on_error
    enum
    percentile
    qps_window
    duration
    report
    enum
    reset_replication
    boolean
    retain_faster_statements
    retain_slower_statements
    samples
    service
    appearance
    enum
    connection_string
    preprocessor
    preprocessor_script
    bootstrap_servers
    cooperative_replication
    boolean
    enable_idempotence
    boolean
    exclude
    regex
    gtid
    kafka_sasl_mechanism
    enum
    kafka_sasl_password
    kafka_sasl_user
    kafka_ssl
    boolean
    kafka_ssl_ca
    kafka_ssl_cert
    kafka_ssl_key
    match
    regex
    read_gtid_from_kafka
    boolean
    send_schema
    boolean
    server_id
    timeout
    duration
    topic
    batch_size
    bootstrap_servers
    engine
    kafka_sasl_mechanism
    enum
    kafka_sasl_password
    kafka_sasl_user
    kafka_ssl
    boolean
    kafka_ssl_ca
    kafka_ssl_cert
    kafka_ssl_key
    table_name_in
    enum
    timeout
    duration
    topics
    exporter
    enum
    file
    kafka_broker
    kafka_topic
    main
    on_error
    enum
    report
    enum
    master_accept_reads
    boolean
    max_replication_lag
    duration
    router_options
    enum_mask
    causal_reads
    enum
    causal_reads_timeout
    duration
    delayed_retry
    boolean
    delayed_retry_timeout
    duration
    lazy_connect
    boolean
    master_accept_reads
    boolean
    master_failure_mode
    enum
    master_reconnection
    boolean
    max_replication_lag
    duration
    max_slave_connections
    retry_failed_reads
    boolean
    slave_connections
    slave_selection_criteria
    enum
    strict_multi_stmt
    boolean
    strict_sp_calls
    boolean
    strict_tmp_tables
    boolean
    sync_transaction
    enum
    sync_transaction_count
    sync_transaction_max_lag
    duration
    sync_transaction_timeout
    duration
    transaction_replay
    boolean
    transaction_replay_attempts
    transaction_replay_checksum
    enum
    transaction_replay_max_size
    size
    transaction_replay_retry_on_deadlock
    boolean
    transaction_replay_retry_on_mismatch
    boolean
    transaction_replay_safe_commit
    boolean
    transaction_replay_timeout
    duration
    use_sql_variables_in
    enum
    allow_duplicates
    boolean
    ignore_tables
    ignore_tables_regex
    regex
    max_staleness
    duration
    refresh_databases
    boolean
    refresh_interval
    duration
    master
    spinner
    MaxScale
    cooperative monitoring
    Yes
    Yes
    ssl_ca
    user
    password
    port
    user
    password
    maxscale-listeners
    maxscale-servers
    maxscale-gssapi-client-authenticator
    maxscale-mariadb-mysql-authenticator
    maxscale-pam-authenticator
    maxscale-binlog-filter
    maxscale-cache
    maxscale-comment-filter
    maxscale-consistent-critical-read-filter
    maxscale-ldi-filter
    maxscale-masking-filter
    maxscale-maxrows-filter
    maxscale-named-server-filter
    maxscale-query-log-all-filter
    maxscale-regex-filter
    maxscale-rewrite-filter
    maxscale-tee-filter
    maxscale-throttle-filter
    maxscale-top-filter
    maxscale-workload-capture-and-replay
    common-monitor-parameters
    galera-monitor
    mariadb-monitor
    maxscale-mariadb-protocol-module
    maxscale-nosql-protocol-module
    maxscale-filter-resource
    maxscale-listener-resource
    maxscale-monitor-resource
    maxscale-server-resource
    maxscale-service-resource
    maxscale-binlogrouter
    maxscale-diff
    maxscale-exasolrouter
    maxscale-kafkacdc
    maxscale-kafkaimporter
    maxscale-mirror
    maxscale-readconnroute
    maxscale-readwritesplit
    maxscale-schemarouter
    maxscale-smartrouter
    MariaDB 10.11
    ed25519 plugin
    Certificate Creation with OpenSSL
    Rotating Logs on Unix and Linux
    Secure Connections Overview
    enabling core dumps
    how to produce a full stack trace for mysqld
    supported Operating Systems
    mariadb_es_repo_setup
    MariaDB Replication
    mariadb_es_repo_setup
    mariadb_es_repo_setup