Part 2 — Install Database Servers
This multi-part series breaks down each section into easy logical steps.
If you have not completed part 1, start here.
MariaDB Enterprise Server Installation
On the remaining three servers, we are going to install MariaDB’s Enterprise Server. MariaDB Enterprise Server is a product that requires a license. You could use a community version instead, but please ensure you meet the licensing requirements.
On the servers running MariaDB Server, 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 servers have a hostname, so that when I have multiple windows open, I know exactly where I am (set the server names accordingly):
hostnamectl set-hostname server1/2/3
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 contain 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 -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --skip-tools --skip-maxscale --mariadb-server-version=mariadb-10.6
Once the repository is created, you can install, enable and start the service, you will also note we are installing the MariaDB-backup tool and pigz for compression:
yum install -y MariaDB-server MariaDB-backup pigz
systemctl enable mariadb
systemctl start mariadb
If you are running the community version, you must also run the secure installation script, this is not required with the enterprise version as it is installed secure by default:
mariadb-secure-installation
MariaDB Server is now installed, and you check the status:
systemctl status mariadb
If everything has gone to plan, you should see that the service is running, you are in particular looking for the line that says:
Active: active (running)
Once your database servers are built, we need to add some basic configuration. This configuration is the minimum required and for a production system, you will need to extend this further.
On each of the database servers, edit the configuration file. I do this with vi, but use whichever editor you are most comfortable with:
vi /etc/my.cnf.d/server.cnf
Locate the [mariadb] section and insert the following. (You will note that it is slightly different for each server):
Server 1
[mariadb]
binlog_format = MIXED
binlog_row_image = MINIMAL
expire_logs_days = 10
gtid_strict_mode = 1
log_basename = server1
log_bin
log_error = /var/log/mariadb/server1.err
log_slave_updates
plugin_load_add = disks
server_id = 1
session_track_system_variables = autocommit,character_set_client,character_set_connection,character_set_results,time_zone,last_gtid
slave_parallel_threads = 4
Server 2
[mariadb]
binlog_format = MIXED
binlog_row_image = MINIMAL
expire_logs_days = 10
gtid_strict_mode = 1
log_basename = server2
log_bin
log_error = /var/log/mariadb/server2.err
log_slave_updates
plugin_load_add = disks
server_id = 2
session_track_system_variables = autocommit,character_set_client,character_set_connection,character_set_results,time_zone,last_gtid
slave_parallel_threads = 4
Server 3
[mariadb]
binlog_format = MIXED
binlog_row_image = MINIMAL
expire_logs_days = 10
gtid_strict_mode = 1
log_basename = server3
log_bin
log_error = /var/log/mariadb/server3.err
log_slave_updates
plugin_load_add = disks
server_id = 3
session_track_system_variables = autocommit,character_set_client,character_set_connection,character_set_results,time_zone,last_gtid
slave_parallel_threads = 4
Once you have inserted the configuration, you need to save the file and then create a folder to be used for logging and set the permissions accordingly on all three servers:
mkdir -p /var/log/mariadb
chown -R mysql:mysql /var/log/mariadb
chmod -R 755 /var/log/mariadb
We finalise our configuration, by restarting the service. If everything has worked, your service will restart with no errors:
systemctl restart mariadb
On server1, we can create a database, to make sure everything is working OK:
mariadb -e "CREATE DATABASE rebuildreplica"
The next step is to create some database users, that will be used by MaxScale, this is done in Part 3.
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.