I got this error mysql systemd[1]: [/usr/lib/systemd/system/mysqld.service:39] Failed to parse resource value, ignoring: 40000
on Centos 7 with mysql 5.7 when I set the LimitMEMLOCK
limit for MYSQL 5.7.
LimitMEMLOCK=40000
- Why it is not possible to set a numeric limit for
LimitMEMLOCK
? - What is the purpose of
LimitMEMLOCK
? - Is the only soultion
LimitMEMLOCK=infinity
?
*
#cat /etc/*-release
CentOS Linux release 7.3.1611 (Core)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
CentOS Linux release 7.3.1611 (Core)
CentOS Linux release 7.3.1611 (Core)
*
service mysqld status
Redirecting to /bin/systemctl status mysqld.service
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2016-12-19 23:21:24 UTC; 9s ago
Main PID: 11170 (mysqld)
CGroup: /system.slice/mysqld.service
└─11170 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
mysql systemd[1]: Starting MySQL Server...
mysql mysqld_pre_systemd[11143]: /usr/sbin/restorecon: Warning no default label for /mnt/data/mysql
mysql systemd[1]: Started MySQL Server.
mysql systemd[1]: [/usr/lib/systemd/system/mysqld.service:39] Failed to parse resource value, ignoring: 40000
I do not see this error message on other Centos 7 version (CentOS Linux release 7.2.1511 (Core)
) when mysqld.service
set up with LimitMEMLOCK=40000
.
cat /etc/*-release
CentOS Linux release 7.2.1511 (Core)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
CentOS Linux release 7.2.1511 (Core)
CentOS Linux release 7.2.1511 (Core)
Let's start with the systemd documentation:
For MEMLOCK, that man page explains:
Locking memory into RAM prevents the kernel from swapping it out. This isn't often done, but for certain performance-critical stuff it is quite useful. Databases are one of those things that can make good use of this.
Setting this value to 40000 makes no sense. Even if you could do it, it would cripple the database and probably cause it to crash. MySQL locks memory when large page support is enabled and the documentation states that memlock must be unlimited (
infinity
in your systemd unit).