MaxScale
Configuration & Usage Scenarios
Mark Riddoch
Last Updated: 2nd July 2014
h1(#contents). Contents
[[TOC]]
h1(#document-history). Document History
Date
|
Change
|
Who
|
21st July 2013
|
Initial version
|
Mark Riddoch
|
23rd July 2013
|
Addition of default user and password for a monitor and discussion of monitor user requirements New monitor documented for Galera clusters Addition of example Galera cluster configuration
|
Mark Riddoch
|
13th November 2013
|
state for Galera Monitor is "synced"
|
Massimiliano Pinto
|
2nd December 2013
|
Updated the description of the command line arguments to match the code updates. Improved descriptions and general documentation. Enhanced example configurations
|
Mark Riddoch
|
6th February 2014
|
Added “enable_root_user” as a service parameter
|
Massimiliano Pinto
|
7th February 2014
|
Addition of bind address information Clarification of user configuration required for monitoring users and the user needed to fetch the user data
|
Mark Riddoch
|
3rd March 2014
|
MySQL authentication with hostnames
|
Massimiliano Pinto
|
3rd March 2014
|
Addition of section that describes authentication requirements and the rules for creating user credentials
|
Mark Riddoch
|
28th March 2014
|
Unix socket support
|
Massimiliano Pinto
|
8th May 2014
|
Added “version_string” parameter in service
|
Massimiliano Pinto
|
29th May 2014
|
Added troubleshooting section
|
Massimiliano Pinto
|
2nd June 2014
|
Correction of some typos, clarification of the meaning of session modification statements and the default user for the CLI. Addition of debugcli configuration option for developer and user modes.
|
Mark Riddoch
|
4th June 2014
|
Addition of “monitor_interval” for monitors
|
Massimiliano Pinto
|
6th June 2014
|
Addition of filters sections
|
Mark Riddoch
|
27th June 2014
|
Addition of server weighting, the configuration for the maxadmin client
|
Mark Riddoch
|
2nd July 2014
|
Addition of new readwritesplit router options with description and examples.
|
Vilho Raatikka
|
h1(#introduction). Introduction
The purpose of this document is to describe how to configure MaxScale and to discuss some possible usage scenarios for MaxScale. MaxScale is designed with flexibility in mind, and consists of an event processing core with various support functions and plugin modules that tailor the behaviour of the MaxScale itself.
h2(#terms). Terms
Term
|
Description
|
service
|
A service represents a set of databases with a specific access mechanism that is offered to clients of MaxScale. The access mechanism defines the algorithm that MaxScale will use to direct particular requests to the individual databases.
|
server
|
A server represents an individual database server to which a client can be connected via MaxScale.
|
router
|
A router is a module within MaxScale that will route client requests to the various database servers which MaxScale provides a service interface to.
|
connection routing
|
Connection routing is a method of handling requests in which 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 quests on a connection and it will not move that connection once it is established.
|
statement routing
|
Statement routing is a method of handling requests in which each request within a connection will be handled individually. Requests may be sent to one or more servers and connections may be dynamically added or removed from the session.
|
protocol
|
A protocol is a module of software that is used to communicate with another software entity within the system. MaxScale supports the dynamic loading of protocol modules to allow for increased flexibility.
|
module
|
A module is a separate code entity that may be loaded dynamically into MaxScale to increase the available functionality. Modules are implemented as run-time loadable shared objects.
|
monitor
|
A monitor is a module that can be executed within MaxScale to monitor the state of a set of database. The use of an internal monitor is optional, monitoring may be performed externally to MaxScale.
|
listener
|
A listener is the network endpoint that is used to listen for connections to MaxScale from the client applications. A listener is associated to a single service, however a service may have many listeners.
|
connection failover
|
When a connection currently being used between MaxScale and the database server fails a replacement will be automatically created to another server by MaxScale without client intervention
|
backend database
|
A term used to refer to a database that sits behind MaxScale and is accessed by applications via MaxScale.
|
filter
|
A module that can be placed between the client and the MaxScale router module. All client data passes through the filter module and may be examined or modified by the filter modules.
Filters may be chained together to form processing pipelines.
|
h1(#configuration). Configuration
The MaxScale configuration is read from a file which can be located in a number of placing, MaxScale will search for the configuration file in a number of locations.
# If the environment variable MAXSCALE_HOME is set then MaxScale will look for a configuration file called MaxScale.cnf in the directory $MAXSCALE_HOME/etc
# If MAXSCALE_HOME is not set or the configuration file is not in the location above MaxScale will look for a file in /etc/MaxScale.cnf
Alternatively MaxScale can be started with the -c flag and the path of the MaxScale home directory tree.
An explicit path to a configuration file can be passed by using the -f option to MaxScale.
The configuration file itself is based on the "ini" file format and consists of various sections that are used to build the configuration, these sections define services, servers, listeners, monitors and global settings.
h2(#global-settings). Global Settings
The global settings, in a section named [MaxScale], allow various parameters that affect MaxScale as a whole to be tuned. Currently the only setting that is supported is the number of threads to use to handle the network traffic. MaxScale will also accept the section name of [gateway] for global settings. This is for backward compatibility with versions prior to the naming of MaxScale.
h3(#threads). Threads
To control the number of threads that poll for network traffic set the parameter threads to a number. It is recommended that you start with a single thread and add more as you find the performance is not satisfactory. MaxScale is implemented to be very thread efficient, so a small number of threads is usually adequate to support reasonably heavy workloads. Adding more threads may not improve performance and can consume resources needlessly.
@# Valid options are:@
@# threads=