There are binary installation packages available for RPM and Debian-based distributions, which will pull in all required Galera dependencies.
If these are not available, you will need to build Galera from source.
Starting from MariaDB 10.1, the wsrep API for Galera Cluster is included by default. Follow the usual compiling-mariadb-from-source instructions
MariaDB 10.0 and below are no longer supported. The instructions below have only historical significance.
make cannot manage dependencies for the build process, so the following packages need to be installed first:
RPM-based:
yum-builddep MariaDB-server
Debian-based:
apt-get build-dep mariadb-server
If running on an alternative system, or the commands are available, the following packages are required. You will need to check the repositories for the correct package names on your distribution - these may differ between distributions, or require additional packages:
You can use Git to download the source code, as MariaDB source code is available through GitHub. Clone the repository:
git clone https://github.com/mariadb/server mariadb
cd mariadb git checkout 10.0-galera
The standard and Galera cluster database servers are the same, except that for Galera Cluster, the wsrep API patch is included. Enable the patch with the CMake configuration options WITH_WSREP and WITH_INNODB_DISALLOW_WRITES. To build the database server, run the following commands:
cmake -DWITH_WSREP=ON -DWITH_INNODB_DISALLOW_WRITES=ON . make make install
There are also some build scripts in the BUILD/ directory which may be more convenient to use. For example, the following pre-configures the build options discussed above:
./BUILD/compile-pentium64-wsrep
There are several others as well, so you can select the most convenient.
Besides the server with the Galera support, you will also need a galera provider.
make cannot manage dependencies itself, so the following packages need to be installed first:
apt-get install -y scons check
If running on an alternative system, or the commands are available, the following packages are required. You will need to check the repositories for the correct package names on your distribution - these may differ between distributions, or require additional packages:
Run:
git clone -b mariadb-4.x https://github.com/MariaDB/galera.git
If you are using MariaDB 10.3 or earlier, you should checkout mariadb-3.x instead.
After this, the source files for the Galera provider will be in the galera directory.
The Galera Replication Plugin both implements the wsrep API and operates as the database server's wsrep Provider. To build, cd into the galera/ directory and do:
git submodule init git submodule update ./scripts/build.sh mkdir /usr/lib64/galera cp libgalera_smm.so /usr/lib64/galera
The path to libgalera_smm.so needs to be defined in the my.cnf configuration file.
Building Galera Replication Plugin from source on FreeBSD runs into issues due to Linux dependencies. To overcome these, either install the binary package: pkg install galera, or use the ports build available at /usr/ports/databases/galera.
After building, a number of other steps are necessary:
groupadd mysql useradd -g mysql mysql
cd /usr/local/mysql ./scripts/mariadb-install-db --user=mysql
chown -R mysql /usr/local/mysql chgrp -R mysql /usr/local/mysql
cp /usr/local/mysql/supported-files/mysql.server /etc/init.d/mysql chmod +x /etc/init.d/mysql chkconfig --add mysql
© 2023 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/installing-galera-from-source/