Step 5: Start and Configure MariaDB MaxScale

Overview

This page details step 5 of the 6-step procedure "Deploy Xpand Topology".

This step starts and configures MaxScale.

Interactive commands are detailed. Alternatively, the described operations can be performed using automation.

Several of the actions on this page use MaxCtrl. For additional information about MaxCtrl, see "MaxCtrl (MaxScale 22.08)". Alternative configuration options are available.

Replace Default Configuration File

The default configuration file for MaxScale contains an example configuration that is not needed for this topology. Replace the /etc/maxscale.cnf file on the MaxScale node with the following configuration:

[maxscale]
threads          = auto
admin_host       = 0.0.0.0
admin_secure_gui = false

For additional information, see "Global Parameters (MaxScale 22.08)" and "Module Parameters (MaxScale 22.08)".

Configure Proxy Protocol

If you plan to use the proxy protocol, the proxy protocol must also be enabled in MaxScale by setting the proxy_protocol parameter in the configuration:

[maxscale]
...
proxy_protocol = true

Start the MaxScale Service

The MaxScale service must be started.

This action is performed on the MaxScale node.

Use the restart command to ensure that MaxScale picks up the new configuration.

To start the MaxScale process:

$ sudo systemctl restart maxscale

Configure Server Objects

Use the maxctrl create server to create a server module for each Xpand node.

This action is performed on the MaxScale node.

To configure MaxScale to recognize each server:

$ maxctrl create server xpand1 192.0.2.1
$ maxctrl create server xpand2 192.0.2.2
$ maxctrl create server xpand3 192.0.2.3

In this example:

  • xpand1, xpand2, and xpand3 are server names.

  • 192.0.2.1, 192.0.2.2, and 192.0.2.3 are the IP addresses for those servers.

For additional information, see "Module Parameters (MaxScale 22.08)".

Configure Xpand Monitor

Use the maxctrl create monitor command to create a monitor service for Xpand.

This action is performed on the MaxScale node.

To configure MaxScale to start the monitor:

$ maxctrl create monitor xpand_monitor xpandmon \
     user=mxs \
     password='MAXSCALE_USER_PASSWORD' \
     --servers xpand1 xpand2 xpand3

In this example:

  • xpand_monitor is an arbitrary name that is used to identify the new monitor.

  • xpandmon is the name of the module that implements the Xpand Monitor.

  • user=MAXSCALE_USER sets the user parameter to the database user account that MaxScale uses to monitor the Xpand nodes.

  • password='MAXSCALE_USER_PASSWORD' sets the password parameter to the password used by the database user account that MaxScale uses to monitor the Xpand nodes.

  • --servers sets the servers parameter to the set of nodes that MaxScale should monitor. All non-option arguments after --servers are interpreted as server names.

  • Other Module Parameters supported by xpandmon in MaxScale 22.08 can also be specified.

Configure Read/Write Split Router

Use the maxctrl create service command to create a Read/Write Split routing service for Xpand.

This action is performed on the MaxScale node.

MaxScale Read/Write Split Router is used to load balance traffic.

To configure MaxScale to start the router:

$ maxctrl create service xpand_service readwritesplit \
     user=mxs \
     password='MAXSCALE_USER_PASSWORD' \
     --servers xpand1 xpand2 xpand3

In this example:

  • xpand_service is an arbitrary name that is used to identify the new service.

  • readwritesplit is the name of the module that implements the Read/Write Split Router.

  • user=MAXSCALE_USER sets the user parameter to the database user account that MaxScale uses to connect to the Xpand nodes.

  • password=MAXSCALE_USER_PASSWORD sets the password parameter to the password used by the database user account that MaxScale uses to connect to the Xpand nodes.

  • --servers sets the servers parameter to the set of nodes to which MaxScale should route queries. All non-option arguments after --servers are interpreted as server names.

  • Other Module Parameters supported by readwritesplit in MaxScale 22.08 can also be specified.

Configure the Router's Listener

Use the maxscale create listener command to create a listener for the router.

This action is performed on the MaxScale node.

These instructions reference TCP port 3306. You may alternatively use a different TCP port. The TCP port used must not be bound by any other listener.

To configure MaxScale to start the router's listener:

$ maxctrl create listener xpand_service xpand_listener 3306 \
     protocol=MariaDBClient

In this example:

  • xpand_service is the name of the readwritesplit service that was previously created.

  • xpand_listener is an arbitrary name that is used to identify the new listener.

  • 3307 is the TCP port.

  • protocol=MariaDBClient sets the protocol parameter.

  • Other Module Parameters supported by listeners in MaxScale 22.08 can also be specified.

Next Step

Navigation in the procedure "Deploy Xpand Topology":

  • This page was step 5 of 6.