# mariadbd-multi

## NAME



           mariadbd-multi - manage multiple MariaDB servers (mariadbd-multi
           is now a symlink to mariadbd-multi)
    


## SYNOPSIS



    
           **mariadbd-multi [**_options_**] {start|stop|report} [**_GNR_**[,**_GNR_**] ...]**
    


## DESCRIPTION



           **mariadbd-multi** is designed to manage several **mariadbd** processes
           that listen for connections on different Unix socket files and
           TCP/IP ports. It can start or stop servers, or report their
           current status.
    
           **mariadbd-multi** searches for groups named [mariadbd _N_] in my.cnf (or
           in the file named by the **--config-file** option).  _N_ can be any
           positive integer. This number is referred to in the following
           discussion as the option group number, or _GNR_. Group numbers
           distinguish option groups from one another and are used as
           arguments to **mariadbd-multi** to specify which servers you want to
           start, stop, or obtain a status report for. Options listed in
           these groups are the same that you would use in the [mariadbd]
           group used for starting **mariadbd**. However, when using multiple
           servers, it is necessary that each one use its own value for
           options such as the Unix socket file and TCP/IP port number.
    
           To invoke **mariadbd-multi** , use the following syntax:
    
               shell> **mariadbd-multi [**_options_**] {start|stop|report} [**_GNR_**[,**_GNR_**] ...]**
    
           start, stop, and report indicate which operation to perform. You
           can perform the designated operation for a single server or
           multiple servers, depending on the _GNR_ list that follows the
           option name. If there is no list, **mariadbd-multi** performs the
           operation for all servers in the option file.
    
           Each _GNR_ value represents an option group number or range of group
           numbers. The value should be the number at the end of the group
           name in the option file. For example, the _GNR_ for a group named
           [mariadbd17] is 17. To specify a range of numbers, separate the
           first and last numbers by a dash. The _GNR_ value 10-13 represents
           groups [mariadbd10] through [mariadbd13]. Multiple groups or group
           ranges can be specified on the command line, separated by commas.
           There must be no whitespace characters (spaces or tabs) in the _GNR_
           list; anything after a whitespace character is ignored.
    
           This command starts a single server using option group
           [mariadbd17]:
    
               shell> **mariadbd-multi start 17**
    
           This command stops several servers, using option groups
           [mariadbd8] and [mariadbd10] through [mariadbd13]:
    
               shell> **mariadbd-multi stop 8,10-13**
    
           For an example of how you might set up an option file, use this
           command:
    
               shell> **mariadbd-multi --example**
    
           **mariadbd-multi** searches for option files as follows:
    
           •   With **--no-defaults** , no option files are read.
    
           •   With **--defaults-file=**_file_name_ , only the named file is read.
    
           •   Otherwise, option files in the standard list of locations are
               read, including any file named by the
               **--defaults-extra-file=**_file_name_ option, if one is given. (If
               the option is given multiple times, the last value is used.)
    
           Option files read are searched for [mariadbd-multi] and
           [mariadbd _N_] option groups. The [mariadbd-multi] group can be used
           for options to **mariadbd-multi** itself.  [mariadbd _N_] groups can be
           used for options passed to specific **mariadbd** instances.
    
           The [mariadbd] or [mariadbd_safe] groups can be used for common
           options read by all instances of **mariadbd** or **mariadbd_safe**. You
           can specify a **--defaults-file=**_file_name_ option to use a different
           configuration file for that instance, in which case the [mariadbd]
           or [mariadbd_safe] groups from that file will be used for that
           instance.
    
           **mariadbd-multi** supports the following options.
    
           •   **--help**
    
               Display a help message and exit.
    
           •   **--example**
    
               Display a sample option file.
    
           •   **--log=**_file_name_
    
               Specify the name of the log file. If the file exists, log
               output is appended to it.
    
           •   **--mariadb-admin=**_prog_name_
    
               The **mariadb-admin** binary to be used to stop servers.
    
           •   **--mariadbd=**_prog_name_
    
               The **mariadbd** binary to be used. Note that you can specify
               **mariadbd_safe** as the value for this option also. If you use
               **mariadbd_safe** to start the server, you can include the
               mariadbd or ledir options in the corresponding [mariadbd _N_]
               option group. These options indicate the name of the server
               that **mariadbd_safe** should start and the path name of the
               directory where the server is located. (See the descriptions
               for these options in **mariadbd_safe**(1).) Example:
    
                   [mariadbd38]
                   mariadbd = mariadbd-debug
                   ledir  = /opt/local/mysql/libexec
    
           •   **--no-log**
    
               Print log information to stdout rather than to the log file.
               By default, output goes to the log file.
    
           •   **--password=**_password_
    
               The password of the MariaDB account to use when invoking
               **mariadb-admin**. Note that the password value is not optional
               for this option, unlike for other MariaDB programs.
    
           •   **--silent**
    
               Silent mode; disable warnings.
    
           •   **--tcp-ip**
    
               Connect to the MariaDB server(s) via the TCP/IP port instead
               of the UNIX socket. This affects stopping and reporting. If a
               socket file is missing, the server may still be running, but
               can be accessed only via the TCP/IP port. By default
               connecting is done via the UNIX socket. This option affects
               stop and report operations.
    
           •   **--user=**_user_name_
    
               The user name of the MariaDB account to use when invoking
               **mariadb-admin**.
    
           •   **--verbose**
    
               Be more verbose.
    
           •   **--version**
    
               Display version information and exit.
    
           •   **--wsrep-new-cluster**
    
               Bootstrap a cluster.
    
           Some notes about **mariadbd-multi** :
    
           •   **Most important** : Before using **mariadbd-multi** be sure that you
               understand the meanings of the options that are passed to the
               **mariadbd** servers and _why_ you would want to have separate
               **mariadbd** processes. Beware of the dangers of using multiple
               **mariadbd** servers with the same data directory. Use separate
               data directories, unless you _know_ what you are doing. Starting
               multiple servers with the same data directory does _not_ give
               you extra performance in a threaded system.
    
           •   **Important** : Make sure that the data directory for each server
               is fully accessible to the Unix account that the specific
               **mariadbd** process is started as.  _Do not_ use the Unix _root_
               account for this, unless you _know_ what you are doing.
    
           •   Make sure that the MariaDB account used for stopping the
               **mariadbd** servers (with the **mariadbadmin** program) has the same
               user name and password for each server. Also, make sure that
               the account has the SHUTDOWN privilege. If the servers that
               you want to manage have different user names or passwords for
               the administrative accounts, you might want to create an
               account on each server that has the same user name and
               password. For example, you might set up a common multi_admin
               account by executing the following commands for each server:
    
                   shell> **mariadb -u root -S /tmp/mariadb.sock -p**
                   Enter password:
                   mariadb> **GRANT SHUTDOWN ON *.***
                       -> **TO 'multi_admin'@'localhost' IDENTIFIED BY 'multipass';**
    
               Change the connection parameters appropriately when connecting
               to each one. Note that the host name part of the account name
               must allow you to connect as multi_admin from the host where
               you want to run **mariadbd-multi**.
    
           •   The Unix socket file and the TCP/IP port number must be
               different for every **mariadbd**. (Alternatively, if the host has
               multiple network addresses, you can use **--bind-address** to
               cause different servers to listen to different interfaces.)
    
           •   The **--pid-file** option is very important if you are using
               **mariadbd-safe** to start **mariadbd**(for example,
               **--mariadbd=mariadbd-safe**) Every **mariadbd** should have its own
               process ID file. The advantage of using **mariadbd-safe** instead
               of **mariadbd** is that **mariadbd-safe** monitors its **mariadbd**
               process and restarts it if the process terminates due to a
               signal sent using kill -9 or for other reasons, such as a
               segmentation fault. Please note that the **mariadbd-safe** script
               might require that you start it from a certain place. This
               means that you might have to change location to a certain
               directory before running **mariadbd-multi**. If you have problems
               starting, please see the **mariadbd-safe** script. Check
               especially the lines:
    
                   ----------------------------------------------------------------
                   MY_PWD=`pwd`
                   # Check if we are starting this relative (for the binary release)
                   if test -d $MY_PWD/data/mariadb -a \
                      -f ./share/mariadb/english/errmsg.sys -a \
                      -x ./bin/mariadbd
                   ----------------------------------------------------------------
    
               The test performed by these lines should be successful, or you
               might encounter problems. See mariadbd-safe(1).
    
           •   You might want to use the **--user** option for **mariadbd** , but to
               do this you need to run the **mariadbd-multi** script as the Unix
               root user. Having the option in the option file doesn't
               matter; you just get a warning if you are not the superuser
               and the **mariadbd** processes are started under your own Unix
               account.
    
           The following example shows how you might set up an option file
           for use with **mariadbd-multi**. The order in which the **mariadbd**
           programs are started or stopped depends on the order in which they
           appear in the option file. Group numbers need not form an unbroken
           sequence. The first and fifth [mariadbd _N_] groups were
           intentionally omitted from the example to illustrate that you can
           have “gaps” in the option file. This gives you more flexibility.
    
               # This file should probably be in your home dir (~/.my.cnf)
               # or /etc/my.cnf
               # Version 2.1 by Jani Tolonen
               [mariadbd-multi]
               mariadbd     = /usr/local/bin/mariadbd-safe
               mariadb-admin = /usr/local/bin/mariadb-admin
               user       = multi_admin
               password   = multipass
               [mariadbd2]
               socket     = /tmp/mariadb.sock2
               port       = 3307
               pid-file   = /usr/local/mysql/var2/hostname.pid2
               datadir    = /usr/local/mysql/var2
               language   = /usr/local/share/mariadb/english
               user       = john
               [mariadbd3]
               socket     = /tmp/mysql.sock3
               port       = 3308
               pid-file   = /usr/local/mysql/var3/hostname.pid3
               datadir    = /usr/local/mysql/var3
               language   = /usr/local/share/mariadb/swedish
               user       = monty
               [mariadbd4]
               socket     = /tmp/mysql.sock4
               port       = 3309
               pid-file   = /usr/local/mysql/var4/hostname.pid4
               datadir    = /usr/local/mysql/var4
               language   = /usr/local/share/mariadb/estonia
               user       = tonu
               [mariadbd6]
               socket     = /tmp/mysql.sock6
               port       = 3311
               pid-file   = /usr/local/mysql/var6/hostname.pid6
               datadir    = /usr/local/mysql/var6
               language   = /usr/local/share/mariadb/japanese
               user       = jani
    


* * *