Crmgo Blog

CentOS: Preventing OOM from Killing Our Required Service (MySQL Example) When Memory Is Low

CentOS: Preventing OOM from Killing Our Required Service (MySQL Example) When Memory Is Low

For CentOS 6: vim /etc/init.d/mysqld Add to the start section: pgrep -f "mysql" | while read PID; do echo -17 > /proc/$PID/oom_adj; done Another method For CentOS 7: vim /etc/systemd/system/mysqld OOMScoreAdjust=-1000 Info: http://geckich.blogspot.com/2013/12/linux-out-of-memory-killer-oom.html https://habrahabr.ru/company/infobox/blog/241237/ https://habrahabr.ru/company/centosadmin/blog/255845/

CentOS: Preventing OOM from Killing Our Required Service (MySQL Example) When Memory Is Low

For CentOS 6:

vim /etc/init.d/mysqld

Add to the start section

pgrep -f "mysql" | while read PID; do echo -17 > /proc/$PID/oom_adj; done

Another method for CentOS 7:

vim /etc/systemd/system/mysqld

OOMScoreAdjust=-1000

Info:

http://geckich.blogspot.com/2013/12/linux-out-of-memory-killer-oom.html

https://habrahabr.ru/company/infobox/blog/241237/

https://habrahabr.ru/company/centosadmin/blog/255845/

Note: This post may be AI-assisted and then human-edited. Editorial responsibility: Dmytro Lomaka, Kaltenkirchen.