MariaDB MaxScale Offline Installation for CentOS 8
For offline installation, a number of things have to be configured in the first place: SELinux is disabled, or set permissive mode. A mysql client is optional but recommended to test out…

For offline installation, a number of things have to be configured in the first place:
- SELinux is disabled, or set permissive mode.
- A mysql client is optional but recommended to test out the client connectivity from MaxScale server. This requires local repository to be configured correctly.
In this example, we are going to deploy our MaxScale with the following configuration:
| Monitoring user | maxscale_monitor |
| Monitoring password | Th7sdJLKp2w |
| Read/write split port | 3306 |
| Round robin port | 3307 |
| Cluster Type | MariaDB 10.4 Galera Cluster |
Installation & Configuration
Download the MaxScale installer from the MariaDB download page. Choose the latest GA version and CentOS 8 as the operating system. In this example, the link that we got was:
https://dlm.mariadb.com/1092012/MaxScale/2.5.1/centos/8/x86_64/maxscale-2.5.1-1.centos.8.x86_64.rpmTransfer the downloaded package into the MaxScale server.
Install MariaDB MaxScale using yum:
yum localinstall maxscale-2.5.1-1.centos.8.x86_64.rpmCreate a monitoring user that will be used by MaxScale on one of the MariaDB servers:
CREATE USER `maxscale_monitor`@`192.168.10.220` IDENTIFIED BY 'Th7sdJLKp2'; GRANT SELECT ON mysql.* TO `maxscale_monitor`@`192.168.10.220`; GRANT SHOW DATABASES ON *.* TO `maxscale_monitor`@`192.168.10.220`;Where, 192.168.10.220 is the IP address of our MaxScale server.
It is unsafe to store the monitoring user password inside the MaxScale configuration file in plain text. Therefore, we have to use encryption. MaxScale provide a tool to generate encrypted secrets called maxkeys and maxpasswd. Firstly, generate a key:
$ maxkeys Generating .secrets file in /var/lib/maxscale.Then, generate the encrypted value of our password “Th7sdJLKp2w”:
$ maxpasswd Th7sdJLKp2w D91DB5813F7C815B351CCF7D7F1ED6DBNow we can use the generated value above in our MaxScale configuration at
/etc/maxscale.cnf:[maxscale] threads=auto # Server definitions # # Set the address of the server to the network # address of a MariaDB server. # [mariadbgalera1] type=server address=192.168.10.201 port=3306 protocol=MariaDBBackend priority=1 [mariadbgalera2] type=server address=192.168.10.202 port=3306 protocol=MariaDBBackend priority=2 [mariadbgalera3] type=server address=192.168.10.203 port=3306 protocol=MariaDBBackend priority=3 # Monitor for the servers # # This will keep MaxScale aware of the state of the servers. # MariaDB Monitor documentation: # https://mariadb.com/kb/en/mariadb-maxscale-24-mariadb-monitor/ [MariaDB-Monitor] type=monitor module=galeramon servers=mariadbgalera1,mariadbgalera2,mariadbgalera3 user=maxscale_monitor password=D91DB5813F7C815B351CCF7D7F1ED6DB monitor_interval=2000 available_when_donor=true # Service definitions # # Service Definition for a read-only service and # a read/write splitting service. # [Read-Write-Service] type=service router=readwritesplit servers=mariadbgalera1,mariadbgalera2,mariadbgalera3 user=maxscale_monitor password=D91DB5813F7C815B351CCF7D7F1ED6DB [Round-Robin-Service] type=service router=readconnroute servers=mariadbgalera1,mariadbgalera2,mariadbgalera3 user=maxscale_monitor password=D91DB5813F7C815B351CCF7D7F1ED6DB router_options=slave # Listener definitions for the services # # These listeners represent the ports the # services will listen on. # [Read-Write-Listener] type=listener service=Read-Write-Service protocol=MariaDBClient port=3306 address=0.0.0.0 [Round-Robin-Listener] type=listener service=Round-Robin-Service protocol=MariaDBClient port=3307 address=0.0.0.0Start and enable the MaxScale service on boot:
systemctl start maxscale systemctl enable maxscale
Verification
We can verify if MaxScale is running correctly by using:
$ 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 Thu 2020-07-30 03:33:54 UTC; 2min 35s ago
Main PID: 5112 (maxscale)
CGroup: /system.slice/maxscale.service
└─5112 /usr/bin/maxscale
Jul 30 03:33:54 mxb1.local maxscale[5112]: [MariaDBAuth] [Round-Robin-Service] Loaded 13 MySQL users for listener 'Round-Robin-Listener' from server 'mariadbgalera1' with c... 0x92ff8486.
Jul 30 03:33:54 mxb1.local maxscale[5112]: Listening for connections at [0.0.0.0]:3307
Jul 30 03:33:54 mxb1.local maxscale[5112]: Service 'Round-Robin-Service' started (2/3)
Jul 30 03:33:54 mxb1.local maxscale[5112]: Removing stale journal file for monitor 'MariaDB-Monitor'.
Jul 30 03:33:54 mxb1.local systemd[1]: Started MariaDB MaxScale Database Proxy.
Jul 30 03:33:54 mxb1.local maxscale[5112]: Server changed state: mariadbgalera1[192.168.10.201:3306]: new_slave. [Running] -> [Slave, Synced, Running]
Jul 30 03:33:54 mxb1.local maxscale[5112]: Server changed state: mariadbgalera2[192.168.10.202:3306]: new_slave. [Running] -> [Slave, Synced, Running]
Jul 30 03:33:54 mxb1.local maxscale[5112]: Server changed state: mariadbgalera3[192.168.10.203:3306]: new_master. [Running] -> [Master, Synced, Running] Or,
$ netstat -tulpn | grep maxscale
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 5112/maxscale
tcp 0 0 0.0.0.0:3307 0.0.0.0:* LISTEN 5112/maxscale
tcp 0 0 127.0.0.1:8989 0.0.0.0:* LISTEN 5112/maxscale Take note at the ports that are configured for MaxScale and make sure they are listening correctly.
Furthermore, you can observe the MaxScale log at:
tail -f /var/log/maxscale/maxscale.log