修改limit

修改: /etc/security/limits.conf 
添加如下:
*       soft    nproc   262144
*       hard    nproc   262144
*       hard    nofile  262144
*       soft    nofile  262144
*       soft    stack 10240
*       hard    stack 10240
配置最大文件数、最大进程,最大堆栈大小

进程还需要在 :/etc/security/limits.d/20-nproc.conf  中添加,普通用户才可生效
*       soft    nproc   262144
*       hard    nproc   262144

配置文件详解

#
#此文件为通过PAM登录的用户设置资源限制。
#它不会影响系统服务的资源限制。
#
#还要注意/etc/security/limits.d目录中的配置文件,
#按字母顺序读取,覆盖此中的设置
#文件,以防域相同或更具体。
#这意味着,例如,在此处设置通配符域的限制
#可以用配置文件中的通配符设置覆盖
#子目录,但此处的用户特定设置只能被重写
#在子目录中使用特定于用户的设置。
#
#每行以以下形式描述用户的限制:
#<domain><type><item><value>
#其中:
#<domain>可以是:
#-用户名
#-组名,使用@group语法
#-通配符*,用于默认条目
#-通配符%也可以与%group语法一起使用,
#对于maxlogin限制
#
#<type> can have the two values:
#        - "soft" for enforcing the soft limits
#        - "hard" for enforcing hard limits
#<type>可以有两个值:
#-“软”用于执行软限制
#-执行硬限制的“困难”

语法格式:<domain> <type> <item> <value>

#<item> can be one of the following:
#<item>可以是以下之一:
#        - core - limits the core file size (KB)
#-核心-限制核心文件大小(KB)
#        - data - max data size (KB)
#-数据-最大数据大小(KB)
#        - fsize - maximum filesize (KB)
#-fsize-最大文件大小(KB)
#        - memlock - max locked-in-memory address space (KB)
#-memlock-最大锁定内存地址空间(KB)
#        - nofile - max number of open file descriptors
#-nofile-打开文件描述符的最大数目
#        - rss - max resident set size (KB)
#-rss-最大驻留集大小(kb)
#        - stack - max stack size (KB)
#-堆栈-最大堆栈大小(KB)
#        - cpu - max CPU time (MIN)
#-CPU-最大CPU时间(分钟)
#        - nproc - max number of processes
#-nproc-最大进程数
#        - as - address space limit (KB)
#-as-地址空间限制(KB)
#        - maxlogins - max number of logins for this user
#-max logins-此用户的最大登录次数
#        - maxsyslogins - max number of logins on the system
#-maxsyslogins-系统上的最大登录次数
#        - priority - the priority to run user process with
#-优先级-运行用户进程的优先级
#        - locks - max number of file locks the user can hold
#-locks-用户可以持有的最大文件锁定数
#        - sigpending - max number of pending signals
#-sigpending-挂起信号的最大数目
#        - msgqueue - max memory used by POSIX message queues (bytes)
#-msgqueue-POSIX消息队列使用的最大内存(字节)
#        - nice - max nice priority allowed to raise to values: [-20, 19]
#-nice-允许提升到值的最大nice优先级:[-20,19]
#        - rtprio - max realtime priority
#-rtprio-最大实时优先级

如:
*  hard nofile 6553555
*  soft  nofile 6555355


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容