Start and Stop Services

Overview

The services for MariaDB Enterprise Server and MariaDB MaxScale are managed by systemd in most environments, but other options are supported in some cases.

Compatibility

  • MariaDB Enterprise Server 10.3

  • MariaDB Enterprise Server 10.4

  • MariaDB Enterprise Server 10.5

  • MariaDB Enterprise Server 10.6

  • MariaDB MaxScale 2.5

  • MariaDB MaxScale 6

  • MariaDB MaxScale 22.08

  • MariaDB MaxScale 23.02

systemd

MariaDB Enterprise Server

In environments that use systemd for service management, the systemctl command is used to start and stop the MariaDB Enterprise Server service:

Operation

Command

Start

sudo systemctl start mariadb

Stop

sudo systemctl stop mariadb

Restart

sudo systemctl restart mariadb

Enable during startup

sudo systemctl enable mariadb

Disable during startup

sudo systemctl disable mariadb

Status

sudo systemctl status mariadb

View systemd journal

sudo journalctl -u mariadb

Bootstrap a Galera Cluster

sudo galera_new_cluster

Recover Galera Cluster's position

sudo galera_recovery

MariaDB MaxScale

In environments that use systemd for service management, the systemctl command is used to start and stop the MariaDB MaxScale service:

Operation

Command

Start

sudo systemctl start maxscale

Stop

sudo systemctl stop maxscale

Restart

sudo systemctl restart maxscale

Enable during startup

sudo systemctl enable maxscale

Disable during startup

sudo systemctl disable maxscale

Status

sudo systemctl status maxscale

View systemd journal

sudo journalctl -u maxscale

Enterprise Server Shutdown Considerations

Shutdown via SQL

MariaDB Enterprise Server can be shutdown via SQL using the SHUTDOWN statement:

SHUTDOWN;

This statement requires the SHUTDOWN privilege.

Shutdown via mariadb-admin

MariaDB Enterprise Server can be shutdown via the mariadb-admin shutdown command:

$ sudo mariadb-admin --user=root shutdown

The database user account requires the SHUTDOWN privilege.

Shutdown via SIGTERM

On Linux, MariaDB Enterprise Server performs a shutdown if it receives a SIGTERM (signal 15).

To shutdown MariaDB Enterprise Server by sending it a SIGTERM:

  1. Find the process ID of mariadbd:

    $ export MARIADBD_PID=$(sudo pidof mariadbd)
    
  2. Send SIGTERM to the process using the kill utility:

    $ sudo kill -SIGTERM $MARIADBD_PID
    

Shutdown for Upgrades

When preparing to perform an upgrade, MariaDB recommends setting the innodb_fast_shutdown system variable to 0 before shutting down the mariadbd process. The system variable can be configured dynamically using the SET GLOBAL statement:

SET GLOBAL innodb_fast_shutdown=0;

This statement requires the SUPER privilege.

Shutdown a Primary Server

In some cases, special care must be taken when shutting down a primary server when using MariaDB Replication.

For additional information, see "Stop a Primary Node".

Bootstrap a Galera Cluster

When a Galera Cluster node starts by default, it tries to establish a connection to the other cluster nodes configured in the wsrep_cluster_address system variable. The node does not become active until it connects to another cluster node that belongs to the Primary Component. Consequently, if all nodes in a cluster are offline, you must start the first node using a special method, so that it does not abort startup when it can't establish a connection with any other cluster nodes. The special method is known as bootstrapping the cluster.

For information on how to bootstrap a Galera Cluster, see "Bootstrap a Galera Cluster".