MariaDBの起動と停止を行う!(Rocky Linux 9)

Rocky Linux 9で稼働するMariaDBの起動と停止を行います

MariaDBの起動状態を確認する!

MariaDBの起動状態を確認します。

# systemctl status mariadb
● mariadb.service - MariaDB 10.11.2 database server
     Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
    Drop-In: /etc/systemd/system/mariadb.service.d
             └─migrated-from-my.cnf-settings.conf
     Active: active (running) since Fri 2023-04-21 07:08:10 JST; 4min 2s ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 757 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCE>
    Process: 769 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/g>
    Process: 874 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCC>
   Main PID: 780 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 8 (limit: 11062)
     Memory: 233.6M
        CPU: 166ms
     CGroup: /system.slice/mariadb.service
             └─780 /usr/sbin/mariadbd

MariaDBを停止する!

MariaDBを停止します。

# systemctl stop mariadb
# systemctl status mariadb
○ mariadb.service - MariaDB 10.11.2 database server
     Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
    Drop-In: /etc/systemd/system/mariadb.service.d
             └─migrated-from-my.cnf-settings.conf
     Active: inactive (dead) since Fri 2023-04-21 07:15:37 JST; 13s ago
   Duration: 7min 26.398s
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 757 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCE>
    Process: 769 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/g>
    Process: 780 ExecStart=/usr/sbin/mariadbd $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, sta>
    Process: 874 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCC>
   Main PID: 780 (code=exited, status=0/SUCCESS)
     Status: "MariaDB server is down"
        CPU: 210ms

MariaDBを起動する!

MariaDBを起動します。

# systemctl start mariadb
# systemctl status mariadb
● mariadb.service - MariaDB 10.11.2 database server
     Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
    Drop-In: /etc/systemd/system/mariadb.service.d
             └─migrated-from-my.cnf-settings.conf
     Active: active (running) since Fri 2023-04-21 07:16:11 JST; 1s ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 1506 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCC>
    Process: 1507 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/>
    Process: 1525 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUC>
   Main PID: 1515 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 10 (limit: 11062)
     Memory: 165.7M
        CPU: 176ms
     CGroup: /system.slice/mariadb.service
             └─1515 /usr/sbin/mariadbd

MariaDBを再起動する!

MariaDBを再起動します。

# systemctl restart mariadb
# systemctl status mariadb
● mariadb.service - MariaDB 10.11.2 database server
     Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
    Drop-In: /etc/systemd/system/mariadb.service.d
             └─migrated-from-my.cnf-settings.conf
     Active: active (running) since Fri 2023-04-21 07:16:34 JST; 2s ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 1531 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCC>
    Process: 1532 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/>
    Process: 1550 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUC>
   Main PID: 1540 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 10 (limit: 11062)
     Memory: 84.3M
        CPU: 113ms
     CGroup: /system.slice/mariadb.service
             └─1540 /usr/sbin/mariadbd

おわりに

Rocky Linux 9で稼働するMariaDBの起動と停止は、Systemdで行うことができま

参考情報

関連記事

関連書籍(Amazon商品リンク)