Building MariaDB 11.x
Below versions of MariaDB are available in respective distributions at the time of creation of these build instructions:
- RHEL (7.8, 7.9) have
5.5.68
- RHEL (8.6, 8.8, 8.9) have
10.3.39
- RHEL (9.0, 9.2, 9.3) have
10.5.22
- SLES 12 SP5 has
10.2.44
- SLES 15 SP5 has
10.6.15
- Ubuntu 20.04 has
10.3.38
- Ubuntu 22.04 has
10.6.12
- Ubuntu 23.10 has
10.11.4
The instructions provided below specify the steps to build MariaDB v11.2.2 on Linux on IBM Z for the following distributions:
- RHEL (7.8, 7.9)
- Ubuntu 23.10
Note: For RHEL (8.x, 9.x), SLES (12, 15), Ubuntu (20.04, 22.04), please refer to this link to download and install MariaDB from the community MariaDB repository.
General Notes:
-
When following the steps below please use a standard permission user unless otherwise specified.
-
A directory
/<source_root>/
will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.
If you want to build MariaDB using manual steps, go to STEP 2.
Use the following commands to build MariaDB using the build script. Please make sure you have wget
installed.
wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/MariaDB/11.2.2/build_mariadb.sh
# Build MariaDB
bash build_mariadb.sh [Provide -t option for executing build with tests]
If the build completes successfully, go to STEP 3.7. In case of error, check logs
for more details or go to STEP 2 to follow manual build steps.
export SOURCE_ROOT=/<source_root>/
-
RHEL (7.8, 7.9)
sudo subscription-manager repos --enable=rhel-7-server-for-system-z-rhscl-rpms sudo yum install -y devtoolset-7-gcc-c++ devtoolset-7-gcc make wget curl \ libcurl-devel rh-git227-git.s390x tar cmake openssl-devel ncurses-devel \ bison boost-devel check-devel perl-Test-Simple perl-Time-HiRes openssl \ libpcre3-dev pam-devel patch hostname source /opt/rh/devtoolset-7/enable source /opt/rh/rh-git227/enable
-
Ubuntu 23.10
sudo apt-get update sudo apt-get install -y make wget curl tar cmake openssl bison git gcc g++ libssl-dev libncurses-dev bison libboost-dev libboost-program-options-dev check libpam0g-dev zlib1g-dev
-
Build CMake v3.7.3 (For RHEL 7.x only)
cd $SOURCE_ROOT wget https://cmake.org/files/v3.7/cmake-3.7.2.tar.gz tar xzf cmake-3.7.2.tar.gz cd cmake-3.7.2 ./configure --prefix=/usr/ ./bootstrap --system-curl --parallel=16 make -j$(nproc) sudo make install export PATH=/usr/local/bin:$PATH cmake --version
3.1) Get MariaDB source
cd $SOURCE_ROOT
git clone https://github.com/MariaDB/server.git
cd server
git checkout mariadb-11.2.2
git submodule update --init --recursive
3.2) Build and install
mkdir $SOURCE_ROOT/build_mariadb
cd $SOURCE_ROOT/build_mariadb
cmake $SOURCE_ROOT/server
make -j$(nproc)
sudo make install
sudo ln -sf /usr/local/mysql/bin/mysqladmin /usr/bin/mysqladmin
3.3) Create a user and group with name mysql
export PATH=$PATH:/usr/sbin
sudo groupadd mysql
sudo useradd -g mysql mysql
3.4) Give owner permission to the mysql directory
cd /usr/local/mysql
sudo chown -R mysql .
sudo chmod -R o+rwx .
3.5) Create database and populate test data into database
sudo scripts/mysql_install_db --user=mysql
3.6) Copy script to start and stop MySQL server
sudo cp support-files/mysql.server /etc/init.d/mysql
3.7) Start MySQL server
sudo /usr/local/mysql/bin/mysqld_safe --user=mysql &
3.8) Display version
sudo -u mysql mysqladmin version --user=mysql
The output should look similar to this:
mysqladmin from 11.2.2-MariaDB, client 9.1 for Linux (s390x)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Server version 11.2.2-MariaDB
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /tmp/mysql.sock
Uptime: 16 min 3 sec
Threads: 1 Questions: 1 Slow queries: 0 Opens: 17 Open tables: 10 Queries per second avg: 0.001
cd $SOURCE_ROOT/build_mariadb/mysql-test
./mtr --suite=unit --force --max-test-fail=0
Note: All test cases should pass successfully.
The Galera wsrep ("write set replication") provider is a library that extends a number of database products (including MariaDB) with replication capabilities. It will need to be installed before MariaDB clustering can be enabled.
5.1) Clone the Galera source code from the official GitHub repository, then check out 26.4.11 release:
cd $SOURCE_ROOT
git clone https://github.com/codership/galera.git
cd galera
git checkout release_26.4.14
git submodule init
git submodule update
5.2) Issue following commands to build and install the Galera arbitration daemon (garbd) and the wsrep provider library:
mkdir build
cd build
cmake ..
make
make test
sudo make install
Note: ssl related tests from gu_tests++ module fail both on intel as well as s390x because the ca cert has expired. Community will fix it in next Galera release. More details can be found here.
The MariaDB configuration file, for example /etc/my.cnf, needs to be updated as well. The exact configuration values will be different for each installation. The following is an example for a two-node cluster:
[mysqld]
user=mysql
binlog_format=ROW
bind-address=0.0.0.0
default_storage_engine=innodb
innodb_autoinc_lock_mode=2
innodb_flush_log_at_trx_commit=0
innodb_buffer_pool_size=122M
wsrep_provider=/usr/local/lib/libgalera_smm.so
wsrep_on=1
wsrep_debug=1
wsrep_provider_options="gcache.size=300M; gcache.page_size=300M"
wsrep_cluster_name="example_cluster"
wsrep_node_name='dbnode1'
wsrep_cluster_address='gcomm://<node1>,<node2>'
wsrep_node_address=<node1>
wsrep_node_incoming_address=<node2>
wsrep_sst_method=rsync
Please refer wsrep.cnf for more configuration details. MariaDB is now ready for clustering. Refer to following tutorials and documentation for more information on setting up and configuring a Galera cluster
The information provided in this article is accurate at the time of writing, but on-going development in the open-source projects involved may make the information incorrect or obsolete. Please open issue or contact us on IBM Z Community if you have any questions or feedback.