Step 7: Start and Configure MariaDB MaxScale
This page is part of MariaDB's MariaDB Documentation.
The parent of this page is: Deploy ColumnStore Shared Local Storage Topology with MariaDB Enterprise Server 10.5
Topics on this page:
Overview
This page details step 7 of the 9-step procedure "Deploy ColumnStore Shared Local Storage Topology".
This step starts and configures MariaDB MaxScale 2.5.
Interactive commands are detailed. Alternatively, the described operations can be performed using automation.
Replace the Default Configuration File
MariaDB MaxScale installations include a configuration file with some example objects. This configuration file should be replaced.
On the MaxScale node, replace the default /etc/maxscale.cnf
with the following configuration:
[maxscale]
threads = auto
admin_host = 0.0.0.0
admin_secure_gui = false
For additional information, see "Global Parameters".
Restart MaxScale
On the MaxScale node, restart the MaxScale service to ensure that MaxScale picks up the new configuration:
$ sudo systemctl restart maxscale
Configure Server Objects
On the MaxScale node, use maxctrl create server to create a server object for each Enterprise ColumnStore node:
$ maxctrl create server mcs1 192.0.2.101
$ maxctrl create server mcs2 192.0.2.102
$ maxctrl create server mcs3 192.0.2.103
Configure MariaDB Monitor
MaxScale uses monitors to retrieve additional information from the servers. This information is used by other services in filtering and routing connections based on the current state of the node. For MariaDB Enterprise ColumnStore, use the MariaDB Monitor (mariadbmon
).
On the MaxScale node, use maxctrl create monitor to create a MariaDB Monitor:
$ maxctrl create monitor columnstore_monitor mariadbmon \
--monitor-user mxs --monitor-password 'maxscale_passwd' \
replication_user=repl_user replication_password=repl_pass \
--servers mcs1 mcs2 mcs3
In this example:
columnstore_monitor
specifies an arbitrary name for the monitoring service.mariadbmon
indicates the monitor MaxScale uses to track changes in the node status.--monitor-user
specifies the user account MaxScale uses in connecting to the servers.--monitor-password
specifies the password for the user account on the servers.replication_user=USER
specifies the user account for the replication user.replication_password=PASS
specifies the password for the user account for the replication user.--servers
indicates the nodes MaxScale should monitor with this service.
Choose a MaxScale Router
Routers control how MaxScale balances the load between Enterprise ColumnStore nodes. Each router uses a different approach to routing queries. Consider the specific use case of your application and database load and select the router that best suits your needs.
Router | Configuration Procedure | Description |
---|---|---|
| ||
|
Configure Read Connection Router
Use MaxScale Read Connection Router (readconnroute) to route connections to replica servers for a read-only pool.
On the MaxScale node, use maxctrl create service to create a router:
$ maxctrl create service connection_router_service readconnroute \
user=mxs password=mxs_passwd \
router_options=slave \
--servers mcs1 mcs2 mcs3
In this example:
connection_router_service
is the arbitrary name of this routing service.readconnroute
is the specific router to use with this service, the Read Connection Router.user
indicates the user account MaxScale uses to connect to the servers.password
indicates the password for the user account.slave
is the router_options parameter, specified as akey=value
pair. With this value, connections will only route to Enterprise ColumnStore nodes designated as replica servers.--servers indicates the configured servers to which MaxScale should route queries.
Configure Listener for the Read Connection Router
These instructions reference TCP port 3308. You can use a different TCP port. The TCP port used must not be bound by any other listener.
On the MaxScale node, use the maxctrl create listener command to configure MaxScale to use a listener for the Read Connection Router (readconnroute):
$ maxctrl create listener connection_router_service connection_router_listener 3308 \
--protocol=MariaDBClient
In this example:
connection_router_service
is the name of the service that uses the Read Connection Router (readconnroute).connection_router_listener
is the name of the new listener.3308
is the TCP port.MariaDBClient
is the protocol, specified with the --protocol option.Other Module Parameters supported by listeners in MaxScale 2.5 can also be specified.
Configure Read/Write Split Router for Queries
MaxScale Read/Write Split Router (readwritesplit) performs query-based load balancing. The router routes write queries to the primary and read queries to the replicas.
On the MaxScale node, use the maxctrl create service command to configure MaxScale to use the Read/Write Split Router (readwritesplit):
$ maxctrl create service query_router_service readwritesplit \
user=mxs \
password=mxs_passwd \
--servers mcs1 mcs2 mcs3
In this example:
query_router_service
is the name of the new service that uses the Read/Write Split Router (readwritesplit).readwritesplit
is the name of the module that implements the Read/Write Split Router.mxs
is the database user account for MaxScale, specified as akey=value
pair.mxs_passwd
is the password for the database user account, specified as akey=value
pair.mcs1
,mcs2
, andmcs3
are the names of the configured server objects, specified with the--servers
option.Other Module Parameters supported by readwritesplit in MaxScale 2.5 can also be specified.
Configure a Listener for the Read/Write Split Router
These instructions reference TCP port 3307. You can use a different TCP port. The TCP port used must not be bound by any other listener.
On the MaxScale node, use the maxctrl create listener command to configure MaxScale to use a listener for the Read/Write Split Router (readwritesplit):
$ maxctrl create listener query_router_service query_router_listener 3307 \
--protocol=MariaDBClient
In this example:
query_router_service
is the name of the service that uses the Read/Write Split Router (readwritesplit).query_router_listener
is the name of the new listener.3307
is the TCP port.MariaDBClient
is the protocol, specified with the--protocol
option.Other Module Parameters supported by listeners in MaxScale 2.5 can also be specified.
Start Services
To start the services and monitors, on the MaxScale node use maxctrl start services:
$ maxctrl start services
Next Step
Navigation in the procedure "Deploy ColumnStore Shared Local Storage Topology":
This page was step 7 of 9.