It is possible to run multiple MariaDB Server processes on the same server, but there are certain things that need to be kept in mind. This page will go over some of those things.
If multiple MariaDB Server process are running on the same server, then at minimum, you will need to ensure that the different instances do not use the same datadir
, port
, and socket
. The following example shows these options set in an option file:
[client] # TCP port to use to connect to mysqld server port=3306 # Socket to use to connect to mysqld server socket=/tmp/mysql.sock [mariadb] # TCP port to make available for clients port=3306 # Socket to make available for clients socket=/tmp/mysql.sock # Where MariaDB should store all its data datadir=/usr/local/mysql/data
The above values are the defaults. If you would like to run multiple MariaDB Server instances on the same server, then you will need to set unique values for each instance.
There may be additional options that also need to be changed for each instance. Take a look at the full list of options for mysqld
.
To see the current values set for an instance, see Checking Program Options for how to do so.
To list the default values, check the end of:
mysqld --help --verbose
There are several different methods to start or stop the MariaDB Server process. There are two primary categories that most of these methods fall into: starting the process with the help of a service manager, and starting the process manually. See Starting and Stopping MariaDB for more information.
sysVinit and systemd are the most common Linux service managers. launchd is used in MacOS X. Upstart is a less common service manager.
RHEL/CentOS 7 and above, Debian 8 Jessie and above, and Ubuntu 15.04 and above use systemd by default.
For information on how to start and stop multiple MariaDB Server processes on the same server with this service manager, see systemd: Interacting with Multiple MariaDB Server Processes.
mysqld
is the actual MariaDB Server binary. It can be started manually on its own.
If you want to force each instance to read only a single option file, then you can use the --defaults-file
option:
mysqld --defaults-file=/etc/my_instance1.cnf
mysqld_safe
is a wrapper that can be used to start the mysqld
server process. The script has some built-in safeguards, such as automatically restarting the server process if it dies. See mysqld_safe for more information.
If you want to force each instance to read only a single option file, then you can use the --defaults-file
option:
mysqld_safe --defaults-file=/etc/my_instance1.cnf
mysqld_multi
is a wrapper that can be used to start the mysqld
server process if you plan to run multiple server processes on the same host. See mysqld_multi for more information.
In some cases, there may be easier ways to run multiple MariaDB Server instances on the same server, such as::
© 2019 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/running-multiple-mariadb-server-processes/