- ประเด็นคือ MySQL เราขึ้นสถานะ Active: deactivating เมื่อตรวจสอบสถานะด้วยคำสั่ง
$ sudo systemctl status mysql
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: deactivating (stop-sigterm) since Mon 2025-01-20 03:00:02 +07; 12h ago
Process: 6894 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=exited, status=0/SUCCESS)
Process: 6855 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 6896 (mysqld)
Tasks: 26 (limit: 4915)
CGroup: /system.slice/mysql.service
└─6896 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
- จะสั่ง restart ก็ไม่ได้ ค้างเลยคับ
$ sudo systemctl stop mysql && sudo systemctl start mysql
- ปกติจะ restart server แต่วันนี้เราไม่ต้องทำแบบนั้นแล้ว
$ sudo killall -9 mysqld$ sudo systemctl stop mysql && sudo systemctl start mysql && sudo systemctl status mysql
- จบโดยไม่ต้อง restart server แล้ว
- อาการนี้ประมาณ service พยายาม่จะ stop ตัวเองแต่ไม่สำเร็จ เลยแสดงแบบนี้
- อาจเนื่องจาก connection เยอะ ใช้ resource เยอะทำให้ไม่พอ service จึงพยายามหยุดทำงานด้วยตัวเอง
If systemctl status mysql
shows Active: deactivating (stop-sigterm)
, it indicates that the MySQL service is in the process of stopping but has not yet successfully completed the shutdown. This can happen for several reasons, such as:
Possible Causes
- Hanging Shutdown Process: MySQL might be stuck shutting down due to active connections or unresponsive processes.
- Configuration Errors: Misconfigured options in the MySQL configuration files (
/etc/my.cnf
or/etc/mysql/my.cnf
) might prevent clean shutdowns. - High Workload: If MySQL has a large number of open connections or is processing heavy queries, the shutdown might take longer than expected.
- Insufficient Permissions: The MySQL process might lack the necessary permissions to shut down gracefully.
- Corrupted Database Files: MySQL may be trying to clean up corrupted files during shutdown.
No comments:
Post a Comment