Deploy a Primary Server with MariaDB Enterprise Server 10.5
Topics on This Page:
These instructions detail the deployment of MariaDB Enterprise Server 10.5 in a Primary Server configuration on a range of supported Operating Systems. Instructions for specific operating systems are available.
These instructions detail how to deploy a primary server in a MariaDB Replication deployment, which is suited for a transactional or OLTP workload that requires high availability (HA).
Dependencies
These instructions assume that one or more replica MariaDB Server instances will also be deployed.
See the following resources for how to deploy a replica server:
MariaDB Platform Components
These instructions detail the deployment of the following MariaDB Platform components:
Component |
Description |
---|---|
|
MariaDB Enterprise Server Components
These instructions detail the deployment of the following MariaDB Enterprise Server components:
Component |
Description |
---|---|
|
|
|
Term Definitions
Term |
Definition |
---|---|
row database |
|
primary server |
|
replica server |
|
Installation
MariaDB Corporation provides package repositories for YUM (RHEL/CentOS), APT (Debian/Ubuntu), and ZYpp (SLES).
MariaDB Enterprise Server does not require any additional software to operate as a node in MariaDB Replication.
Install via YUM (RHEL/CentOS)
Retrieve your Customer Download Token at https://customers.mariadb.com/downloads/token/ and substitute for
customer_download_token
in the following directions.Configure the YUM package repository. Installable versions of MariaDB Enterprise Server are
10.5
,10.4
,10.3
, and10.2
. Pass the version to install using the--mariadb-server-version
flag to mariadb_es_repo_setup. The following directions reference10.5
.To configure YUM package repositories:
$ sudo yum install wget $ wget https://dlm.mariadb.com/enterprise-release-helpers/mariadb_es_repo_setup $ echo "99c7f4a3473a397d824d5f591274c2a4f5ebf6dc292eea154800bbaca04ddc7e mariadb_es_repo_setup" \ | sha256sum -c - $ chmod +x mariadb_es_repo_setup $ sudo ./mariadb_es_repo_setup --token="customer_download_token" --apply \ --mariadb-server-version="10.5"
Install MariaDB Enterprise Server and package dependencies:
$ sudo yum install MariaDB-server MariaDB-backup
Configure MariaDB.
Installation only loads MariaDB Enterprise Server to the system. MariaDB Enterprise Server requires configuration before the database server is ready for use.
See Configuration.
Install via APT (Debian/Ubuntu)
Retrieve your Customer Download Token at https://customers.mariadb.com/downloads/token/ and substitute for
customer_download_token
in the following directions.Configure the APT package repository.
Installable versions of MariaDB Enterprise Server are
10.5
,10.4
,10.3
, and10.2
. Pass the version to install using the--mariadb-server-version
flag to mariadb_es_repo_setup. The following directions reference10.5
.To configure APT package repositories:
$ sudo apt install wget $ wget https://dlm.mariadb.com/enterprise-release-helpers/mariadb_es_repo_setup $ echo "99c7f4a3473a397d824d5f591274c2a4f5ebf6dc292eea154800bbaca04ddc7e mariadb_es_repo_setup" \ | sha256sum -c - $ chmod +x mariadb_es_repo_setup $ sudo ./mariadb_es_repo_setup --token="customer_download_token" --apply \ --mariadb-server-version="10.5" $ sudo apt update
Install MariaDB Enterprise Server and package dependencies:
$ sudo apt install mariadb-server mariadb-backup
Configure MariaDB.
Installation only loads MariaDB Enterprise Server to the system. MariaDB Enterprise Server requires configuration before the database server is ready for use.
See Configuration.
Install via ZYpp (SLES)
Retrieve your Customer Download Token at https://customers.mariadb.com/downloads/token/ and substitute for
customer_download_token
in the following directions.Configure the ZYpp package repository.
Installable versions of MariaDB Enterprise Server are
10.5
,10.4
,10.3
, and10.2
. Pass the version to install using the--mariadb-server-version
flag to mariadb_es_repo_setup. The following directions reference10.5
.To configure ZYpp package repositories:
$ sudo zypper install wget $ wget https://dlm.mariadb.com/enterprise-release-helpers/mariadb_es_repo_setup $ echo "99c7f4a3473a397d824d5f591274c2a4f5ebf6dc292eea154800bbaca04ddc7e mariadb_es_repo_setup" \ | sha256sum -c - $ chmod +x mariadb_es_repo_setup $ sudo ./mariadb_es_repo_setup --token="customer_download_token" --apply \ --mariadb-server-version="10.5"
Install MariaDB Enterprise Server and package dependencies
$ sudo zypper install MariaDB-server MariaDB-backup
Configure MariaDB.
Installation only loads MariaDB Enterprise Server to the system. MariaDB Enterprise Server requires configuration before the database server is ready for use.
See Configuration.
Configuration
MariaDB Enterprise Server can be configured in the following ways:
System variables and options can be set in a configuration file (such as
/etc/my.cnf
). MariaDB Enterprise Server must be restarted to apply changes made to the configuration file.System variables and options can be set on the command-line.
If a system variable supports dynamic changes, then it can be set on-the-fly using the SET statement.
Configuration Files
MariaDB's packages include several bundled configuration files. It is also possible to create custom configuration files.
On RHEL, CentOS, and SLES, MariaDB's packages bundle the following configuration files:
/etc/my.cnf
/etc/my.cnf.d/client.cnf
/etc/my.cnf.d/mariadb-enterprise.cnf
/etc/my.cnf.d/mysql-clients.cnf
/etc/my.cnf.d/server.cnf
And on RHEL, CentOS, and SLES, custom configuration files from the following directories are read by default:
/etc/my.cnf.d/
On Debian and Ubuntu, MariaDB's packages bundle the following configuration files:
/etc/mysql/my.cnf
/etc/mysql/mariadb.cnf
/etc/mysql/mariadb.conf.d/50-client.cnf
/etc/mysql/mariadb.conf.d/50-mysql-clients.cnf
/etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf
/etc/mysql/mariadb.conf.d/50-server.cnf
/etc/mysql/mariadb.conf.d/60-galera.cnf
/etc/mysql/mariadb.conf.d/mariadb-enterprise.cnf
And on Debian and Ubuntu, custom configuration files from the following directories are read by default:
/etc/mysql/conf.d/
/etc/mysql/mariadb.conf.d/
Configuring MariaDB
Determine which system variables and options you need to configure.
Mandatory system variables and options for a Primary Server include:
System Variable/Option
Description
Set this option to enable the Binary Log.
Sets the numeric Server ID for this MariaDB Enterprise Server. Must be unique in the deployment.
Useful system variables and options for MariaDB Enterprise Server include:
System Variable/Option
Description
Sets the path to the data directory. MariaDB Enterprise Server writes data files to this directory, including tablespaces, logs, and schemas. Change it to use a non-standard location or to start the Server on a different data directory for testing.
Sets the local TCP/IP address on which MariaDB Enterprise Server listens for incoming connections. Bind to 0.0.0.0 to make the Server accessible through any network interface.
Sets the port MariaDB Enterprise Server listens on. Use this system variable to use a non-standard port or when running multiple Servers on the same host for testing.
Sets the maximum number of simultaneous connections MariaDB Enterprise Server allows.
Sets how MariaDB Enterprise Server handles threads for client connections.
Sets the file name for the error log.
Sets the amount of memory InnoDB reserves for the Buffer Pool.
Sets the size for each Redo Log file and innodb_log_files_in_group sets the number of Redo Log files used by InnoDB.
Sets the maximum number of I/O operations per second that InnoDB can use.
Useful system variables and options for a Primary Server include:
System Variable/Option
Description
Sets Binary Log events as row-based, statement-based, or a mix of rows and statements.
Sets the numeric domain identifier to use in Global Transaction ID's.
Sets MariaDB Enterprise Server to enforce global ordering for Global Transaction ID's.
Choose a configuration file in which to configure your system variables and options.
It not recommended to make custom changes to one of the bundled configuration files. Instead, it is recommended to create a custom configuration file in one of the included directories. Configuration files in included directories are read in alphabetical order. If you want your custom configuration file to override the bundled configuration files, then it is a good idea to prefix the custom configuration file's name with a string that will be sorted last, such as
z-
.On RHEL, CentOS, and SLES, a good custom configuration file would be:
/etc/my.cnf.d/z-custom-my.cnf
On Debian and Ubuntu, a good custom configuration file would be:
/etc/mysql/mariadb.conf.d/z-custom-my.cnf
Set your system variables and options in the configuration file.
They need to be set in a group that will be read by mariadbd, such as
[mariadb]
or[server]
.For example:
[mariadb] # Server Configuration log_error = mariadbd.err innodb_buffer_pool_size = 1G # Replication Configuration (Primary Server) log_bin = mariadb-bin server_id = 1 binlog_format = ROW
Group Commit
Group commit can help performance by reducing I/O.
If you would like to configure parallel replication on the Replica, then it is also required to configure group commit on the Primary.
System Variable |
Description |
Sets the number of transactions that the server commits as a group to the binary log. |
|
Sets the number of microseconds that the server waits for transactions to group commit before it commits the current group. |
Semi-Synchronous Replication
MariaDB Replication deployments that use MariaDB Enterprise Server 10.2 have the option of enabling semi-synchronous replication for Primary Servers through the semisync_master plugin.
Mandatory additional options and system variables for Semi-Synchronous Replication:
System Variable/Option |
Description |
Set this option to |
|
Set to enable semi-synchronous replication. |
Useful system variables for Semi-Synchronous Replication:
System Variable |
Description |
Sets the number of milliseconds which the Primary Server waits for commit acknowledgments from the Replica Server. If this threshold is crossed, the Primary Server reverts to asynchronous replication. |
|
Sets whether MariaDB Enterprise Server waits for semi-sync acknowledgment after synchronizing the Binary Log or after committing in the storage engine. |
Starting the Primary Server
The Primary Server is a MariaDB Enterprise Server that provides binary logs to Replica Servers in a MariaDB Replication deployment. Once MariaDB Enterprise Server has been configured, start the Primary Server, then start replication on the Replica Servers.
For distributions that use systemd (most supported OSes), you can manage the Server process using the systemctl
command:
Operation |
Command |
Start |
|
Stop |
|
Restart |
|
Enable during startup |
|
Disable during startup |
|
Status |
|
Configure the Replication User
Replica Servers replicate from the Primary Server through client connections. In order for them to access the Primary Server, the Replica Servers require a user account with sufficient privileges.
Connect to the Primary Server using MariaDB Client using the
root@localhost
user account:$ sudo mariadb
Create the user account with the CREATE USER statement:
CREATE USER repl@'%' IDENTIFIED BY 'repl_passwd';
Grant the user account the
REPLICATION SLAVE
privilege with the GRANT statement:GRANT REPLICATION SLAVE ON *.* TO repl@'%';
After you deploy the Replica Server, provide these account credentials to the CHANGE MASTER TO statement as the
MASTER_USER
andMASTER_PASSWORD
options.
Testing
When you have the Primary Server up and running, you should test that it is working and that there weren't any issues during startup. You should also ensure that the Server is correctly configured before starting replication on the Replica Servers.
Connect to the server using MariaDB Client using the
root@localhost
user account:$ sudo mariadb Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 38 Server version: 10.5.9-6-MariaDB-Enterprise MariaDB Enterprise Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>
Execute the SHOW MASTER STATUS statement to ensure that binary logging is enabled:
SHOW MASTER STATUS;
+--------------------+----------+--------------+------------------+ | File | Position | binlog_Do_DB | Binlog_Ignore_DB | +--------------------+----------+--------------+------------------+ | mariadb-bin.000003 | 4919 | | | +--------------------+----------+--------------+------------------+
The statement returns a result-set similar to the above when Binary Logging is enabled and you can move on to setting up the Replica Servers. An empty set means that Binary Logging is disabled and must be enabled before the Server can operate as a Primary Server.
Next steps: