AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 821695
Accepted
Berlin
Berlin
Asked: 2016-12-20 15:28:48 +0800 CST2016-12-20 15:28:48 +0800 CST 2016-12-20 15:28:48 +0800 CST

systemd 的 mysqld.service - 无法解析资源值,忽略:40000 - LimitMEMLOCK

  • 772

当我为 MYSQL 5.7mysql systemd[1]: [/usr/lib/systemd/system/mysqld.service:39] Failed to parse resource value, ignoring: 40000设置限制时,我在使用 mysql 5.7 的 Centos 7 上遇到了这个错误。LimitMEMLOCK

LimitMEMLOCK=40000
  1. 为什么不能为 设置数字限制LimitMEMLOCK?
  2. 目的是LimitMEMLOCK什么?
  3. 是唯一的灵魂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

在其他 Centos 7 版本 ( CentOS Linux release 7.2.1511 (Core))mysqld.service上使用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)
mysql centos7 systemd
  • 1 1 个回答
  • 2435 Views

1 个回答

  • Voted
  1. Best Answer
    Michael Hampton
    2016-12-20T15:57:04+08:002016-12-20T15:57:04+08:00

    让我们从systemd 文档开始:

    LimitCPU=, LimitFSIZE=, LimitDATA=, LimitSTACK=, LimitCORE=, LimitRSS=, LimitNOFILE=, LimitAS=, LimitNPROC=, LimitMEMLOCK=, LimitLOCKS=, LimitSIGPENDING=, LimitMSGQUEUE=, LimitNICE=, LimitRTPRIO=, LimitRTTIME=

    对已执行进程的各种资源设置软限制和硬限制。有关资源限制概念的详细信息,请参见setrlimit(2)。

    对于 MEMLOCK,该手册页解释说:

       RLIMIT_MEMLOCK
              The maximum number of bytes of memory that may be locked into
              RAM.  In effect this limit is rounded down to the nearest
              multiple of the system page size.  This limit affects mlock(2)
              and mlockall(2) and the mmap(2) MAP_LOCKED operation.  Since
              Linux 2.6.9 it also affects the shmctl(2) SHM_LOCK operation,
              where it sets a maximum on the total bytes in shared memory
              segments (see shmget(2)) that may be locked by the real user
              ID of the calling process.  The shmctl(2) SHM_LOCK locks are
              accounted for separately from the per-process memory locks
              established by mlock(2), mlockall(2), and mmap(2) MAP_LOCKED;
              a process can lock bytes up to this limit in each of these two
              categories.
    
              In Linux kernels before 2.6.9, this limit controlled the
              amount of memory that could be locked by a privileged process.
              Since Linux 2.6.9, no limits are placed on the amount of
              memory that a privileged process may lock, and this limit
              instead governs the amount of memory that an unprivileged
              process may lock.
    

    将内存锁定在 RAM 中可防止内核将其换出。这并不经常这样做,但对于某些性能关键的东西来说它非常有用。数据库是可以充分利用这一点的东西之一。

    将此值设置为 40000 没有任何意义。即使你能做到,它也会削弱数据库并可能导致它崩溃。MySQL 在启用大页面支持时锁定内存,并且文档指出 memlock 必须是无限的(infinity在您的 systemd 单元中)。

    • 4

相关问题

  • 开源与专有关系 db mgt 系统的优缺点是什么?

  • 在 solaris 10 上为 mysql 设置 max_allowed_pa​​cket

  • 如何移动 MySQL 的数据目录?

  • 通过 VPN 连接什么是远程服务器 IP?

  • mysql崩溃

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve