修改: /etc/security/limits.conf
添加如下:
* soft nproc 262144
* hard nproc 262144
* hard nofile 262144
* soft nofile 262144
* soft stack 10240
* hard stack 10240
配置最大文件數(shù)、最大進(jìn)程,最大堆棧大小
進(jìn)程還需要在 :/etc/security/limits.d/20-nproc.conf 中添加,普通用戶才可生效
* soft nproc 262144
* hard nproc 262144
配置文件詳解
#
#此文件為通過PAM登錄的用戶設(shè)置資源限制。
#它不會影響系統(tǒng)服務(wù)的資源限制。
#
#還要注意/etc/security/limits.d目錄中的配置文件,
#按字母順序讀取,覆蓋此中的設(shè)置
#文件,以防域相同或更具體。
#這意味著,例如,在此處設(shè)置通配符域的限制
#可以用配置文件中的通配符設(shè)置覆蓋
#子目錄,但此處的用戶特定設(shè)置只能被重寫
#在子目錄中使用特定于用戶的設(shè)置。
#
#每行以以下形式描述用戶的限制:
#<domain><type><item><value>
#其中:
#<domain>可以是:
#-用戶名
#-組名,使用@group語法
#-通配符*,用于默認(rèn)條目
#-通配符%也可以與%group語法一起使用,
#對于maxlogin限制
#
#<type> can have the two values:
# - "soft" for enforcing the soft limits
# - "hard" for enforcing hard limits
#<type>可以有兩個值:
#-“軟”用于執(zhí)行軟限制
#-執(zhí)行硬限制的“困難”
語法格式:<domain> <type> <item> <value>
#<item> can be one of the following:
#<item>可以是以下之一:
# - core - limits the core file size (KB)
#-核心-限制核心文件大?。↘B)
# - data - max data size (KB)
#-數(shù)據(jù)-最大數(shù)據(jù)大小(KB)
# - fsize - maximum filesize (KB)
#-fsize-最大文件大?。↘B)
# - memlock - max locked-in-memory address space (KB)
#-memlock-最大鎖定內(nèi)存地址空間(KB)
# - nofile - max number of open file descriptors
#-nofile-打開文件描述符的最大數(shù)目
# - rss - max resident set size (KB)
#-rss-最大駐留集大?。╧b)
# - stack - max stack size (KB)
#-堆棧-最大堆棧大小(KB)
# - cpu - max CPU time (MIN)
#-CPU-最大CPU時間(分鐘)
# - nproc - max number of processes
#-nproc-最大進(jìn)程數(shù)
# - as - address space limit (KB)
#-as-地址空間限制(KB)
# - maxlogins - max number of logins for this user
#-max logins-此用戶的最大登錄次數(shù)
# - maxsyslogins - max number of logins on the system
#-maxsyslogins-系統(tǒng)上的最大登錄次數(shù)
# - priority - the priority to run user process with
#-優(yōu)先級-運行用戶進(jìn)程的優(yōu)先級
# - locks - max number of file locks the user can hold
#-locks-用戶可以持有的最大文件鎖定數(shù)
# - sigpending - max number of pending signals
#-sigpending-掛起信號的最大數(shù)目
# - msgqueue - max memory used by POSIX message queues (bytes)
#-msgqueue-POSIX消息隊列使用的最大內(nèi)存(字節(jié))
# - nice - max nice priority allowed to raise to values: [-20, 19]
#-nice-允許提升到值的最大nice優(yōu)先級:[-20,19]
# - rtprio - max realtime priority
#-rtprio-最大實時優(yōu)先級
如:
* hard nofile 6553555
* soft nofile 6555355