mariadb systemctl stop等待很长时间并且命令退出后mysql进程正在运行

mariadb systemctl stop等待很长时间并且命令退出后mysql进程正在运行

我有 Mariadb在操作系统10.3上运行。CentOS Linux release 8.2.2004 (Core)在启动期间,mariadb 启动正常。

但是当我这样做时systemctl stop mariadb它挂起

系统文件

# systemctl cat mariadb|egrep -v '^$|#'
[Unit]
Description=MariaDB 10.3 database server
Documentation=man:mysqld(8)
Documentation=https://mariadb.com/kb/en/library/systemd/
After=network.target
[Install]
WantedBy=multi-user.target
Alias=mysql.service
Alias=mysqld.service
[Service]
Type=notify
User=mysql
Group=mysql
ExecStartPre=/usr/libexec/mysql-check-socket
ExecStartPre=/usr/libexec/mysql-prepare-db-dir %n
ExecStart=/usr/libexec/mysqld --basedir=/usr $MYSQLD_OPTS $_WSREP_NEW_CLUSTER
ExecStartPost=/usr/libexec/mysql-check-upgrade
PrivateNetwork=false
KillMode=process
KillSignal=SIGTERM
SendSIGKILL=no
Restart=on-abort
RestartSec=5s
UMask=007
TimeoutSec=300
PrivateTmp=true

停止命令

#systemctl stop mariadb
# pstree -a 89243
systemctl stop mariadb
  └─systemd-tty-ask --watch



# systemctl status mariadb -l
● mariadb.service - MariaDB 10.3 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
   Active: failed (Result: timeout) since Fri 2020-12-04 18:14:05 EST; 2min 50s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 1256 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
  Process: 995 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mariadb.service (code=exited, status=0/SUCCESS)
  Process: 918 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
 Main PID: 1057
   Status: "Taking your SQL requests now..."
    Tasks: 30 (limit: 11053)
   Memory: 19.6M
   CGroup: /system.slice/mariadb.service
           └─1057 /usr/libexec/mysqld --basedir=/usr

Dec 03 12:27:42 dbserver01 mysql-check-socket[918]: No process is using /var/lib/mysql/mysql.sock, which means it is a garbage, so it will be removed automatically.
Dec 03 12:27:42 dbserver01 mysql-prepare-db-dir[995]: Database MariaDB is probably initialized in /var/lib/mysql already, nothing is done.
Dec 03 12:27:42 dbserver01 mysql-prepare-db-dir[995]: If this is not the case, make sure the /var/lib/mysql is empty before running mysql-prepare-db-dir.
Dec 03 12:27:42 dbserver01 mysqld[1057]: 2020-12-03 12:27:42 0 [Note] /usr/libexec/mysqld (mysqld 10.3.17-MariaDB) starting as process 1057 ...
Dec 03 12:27:43 dbserver01 systemd[1]: Started MariaDB 10.3 database server.
Dec 04 18:04:05 dbserver01 systemd[1]: Stopping MariaDB 10.3 database server...
Dec 04 18:09:05 dbserver01 systemd[1]: mariadb.service: State 'stop-sigterm' timed out. Skipping SIGKILL.
Dec 04 18:14:05 dbserver01 systemd[1]: mariadb.service: State 'stop-final-sigterm' timed out. Skipping SIGKILL. Entering failed mode.
Dec 04 18:14:05 dbserver01 systemd[1]: mariadb.service: Failed with result 'timeout'.
Dec 04 18:14:05 dbserver01 systemd[1]: Stopped MariaDB 10.3 database server.

进程仍在运行

# ps -fed |grep mysql
mysql       1057       1  0 Dec03 ?        00:00:47 /usr/libexec/mysqld --basedir=/usr

如何解决这个问题?

谢谢SR

相关内容