Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

修改 Linux 使用者最大開啟檔案數與行程數

當 Jenkins 或其他服務出現 fork: retry: Resource temporarily unavailable,可能是使用者可開啟檔案數或行程數已達上限。

可用 ulimit -a 查看目前限制。若 open files 或 max user processes 偏低,可修改 /etc/security/limits.conf。

方法一:limits.conf

以使用者 hades 為例,加入:

@hades soft nofile 65535
@hades hard nofile 65535
@hades soft nproc 65535
@hades hard nproc 65535

通常不需要立即重啟伺服器,重新登入 shell 後即可生效。

方法二:bash_profile

也可在使用者的 .bash_profile 中加入:

ulimit -n 65535

這種方式只對該使用者 shell 生效,較為局部。

Copyright © Linux教程網 All Rights Reserved