码迷,mamicode.com
首页 > 其他好文 > 详细

centos7 systemd 修改服务的文件打开限制

时间:2019-06-27 09:13:03      阅读:782      评论:0      收藏:0      [点我收藏+]

标签:mysq   join   default   uri   inf   alt   hit   str   watchdog   

之前修改/etc/security/limits.conf 就全局生效,现在这个配置只对登陆用户有效

比如mysqld 的服务 使用systemctl 开启服务后,文件打开限制仍然是默认的1024

修改服务对应的service文件 调整文件打开限制
比如:

/usr/lib/systemd/system/mysqld.service

或者

/etc/systemd/system

在以下段添加即可

[service]
LimitNOFILE=100000

需要重新reload

sudo systemctl daemon-reload

然后重启服务

sudo systemctl reload mysqld

或者修改服务的【默认】配置

cat /etc/systemd/system.conf 
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See systemd-system.conf(5) for details.

[Manager]
#LogLevel=info
#LogTarget=journal-or-kmsg
#LogColor=yes
#LogLocation=no
#DumpCore=yes
#CrashShell=no
#ShowStatus=yes
#CrashChVT=1
#CtrlAltDelBurstAction=reboot-force
#CPUAffinity=1 2
#JoinControllers=cpu,cpuacct net_cls,net_prio
#RuntimeWatchdogSec=0
#ShutdownWatchdogSec=10min
#CapabilityBoundingSet=
#SystemCallArchitectures=
#TimerSlackNSec=
#DefaultTimerAccuracySec=1min
#DefaultStandardOutput=journal
#DefaultStandardError=inherit
#DefaultTimeoutStartSec=90s
#DefaultTimeoutStopSec=90s
#DefaultRestartSec=100ms
#DefaultStartLimitInterval=10s
#DefaultStartLimitBurst=5
#DefaultEnvironment=
#DefaultCPUAccounting=no
#DefaultBlockIOAccounting=no
#DefaultMemoryAccounting=no
#DefaultTasksAccounting=no
#DefaultTasksMax=
#DefaultLimitCPU=
#DefaultLimitFSIZE=
#DefaultLimitDATA=
#DefaultLimitSTACK=
#DefaultLimitCORE=
#DefaultLimitRSS=
#DefaultLimitNOFILE=
#DefaultLimitAS=
#DefaultLimitNPROC=
#DefaultLimitMEMLOCK=
#DefaultLimitLOCKS=
#DefaultLimitSIGPENDING=
#DefaultLimitMSGQUEUE=
#DefaultLimitNICE=
#DefaultLimitRTPRIO=
#DefaultLimitRTTIME=

centos7 systemd 修改服务的文件打开限制

标签:mysq   join   default   uri   inf   alt   hit   str   watchdog   

原文地址:https://blog.51cto.com/axe999/2413806

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!