Part 1 — Install MaxScale
This multi-part series breaks down each section into easy logical steps.
MaxScale
MaxScale is a fantastic product produced by MariaDB, which has, over time, been developed into a must-have tool for anyone running MariaDB. It is unfair to think of it as ‘just’ a database proxy as it brings with it many key enterprise toolsets. It can provide high availability, automatic failover, transaction replay, scalability and security benefits to your MariaDB installation. On top of this, MaxScale can also act as a gateway into your database for CDC, Kafka streams and even NoSQL queries.
You can read more about storing JSON data in MariaDB here.
Since MaxScale 22.08 was released, another fantastic feature was added, Replica Rebuild. This feature is implemented within what MaxScale calls, “The Monitor”, and more specifically the MariaDB Monitor — mariadbmon.
Requirements
To complete this blog, you will need a server with network connectivity and external internet access. Make sure to open the relevant firewalls. For testing purposes, high-specification servers are not required. You can use local virtual machines instead. In this guide, we will be using Digital Ocean Droplets with 2 vCPUs and 4GB RAM. All commands will be executed as the root user on the servers, using a RockyLinux 9 operating system. However, you can also use other flavours of Linux, such as CentOS.
MariaDB MaxScale requires some ports to be open on your firewall, these can be changed from default if required:
22 for SSH
3306 for the database
4444 for the replica rebuild stream
MaxScale Installation
On one server, install MariaDB MaxScale. MaxScale is a product that requires licensing when used in production environments so I will be using an enterprise version. You could use a community version instead, but please ensure you meet the licensing requirements.
On the server running MaxScale, please ensure the server is up to date and install the Linux wget package:
yum update -y
yum install -y wget
I like to ensure my server has a unique hostname so that when I have multiple windows open, I know exactly where I am:
hostnamectl set-hostname maxscale1
Once you have set the hostname, log out and log back in again, and the hostname will be displayed.
Next, I will set an environment variable to be my customer download token. As an enterprise customer, this is available to you from your customer service portal:
CUSTOMER_DOWNLOAD_TOKEN=0000-1111-2222-3333-4444
Then you can go ahead and download the MariaDB enterprise repository:
wget https://dlm.mariadb.com/enterprise-release-helpers/mariadb_es_repo_setup
chmod +x mariadb_es_repo_setup
./mariadb_es_repo_setup --token="$CUSTOMER_DOWNLOAD_TOKEN" --apply --skip-tools
If you are using the community version, use the command below to connect to the community repositories. (You will need to ensure the Linux Package curl is available):
yum install -y curl
curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash -s -- --skip-tools
Once the repository is created, install, enable and start the service:
yum install -y maxscale MariaDB-client
systemctl enable maxscale
systemctl start maxscale
Note that I have also installed the MariaDB Client so that I can connect to, and run, SQL commands against the database.
Once MaxScale is installed, check the status:
systemctl status maxscale
When the service is running correctly, you should see the following line within the output:
Active: active (running)
The next step is to install the database servers. This is done in Part 2.
Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7 | Part 8 | Part 9
Leave a Reply
You must be logged in to post a comment.