jenkins服务器进程限制配置

当应用程序占满进程数后,则会报错如下

Resource temporarily unavailable

新用户的进程数限制一般都是在2048或者4096。

解决方案

1、使用root用户登陆,进入到/etc/security/limits.d/:

zhangsan@ubuntu-server: cd /etc/security/limits.d

2、检查该文件夹下有没有文件,如没有,新建

touch 20-nproc.conf


3、编辑20-nproc.conf,添加以下内容:

* soft nproc 4096
root soft nproc unlimited
zhangsan     soft nproc 60000

4、编辑/etc/security/limits.conf,添加以下内容:

“username” soft nproc 60000
“username” hard nproc 65535
“username” soft nofile 60000
“username” hard bofile 65535

添加后文件为:
* soft nofile 100001
* hard nofile 100002
* soft nproc 60000
* hard nproc 65535
root soft nofile 100001
root hard nofile 100002
root soft nproc 60000
root hard nproc 65535

nproc:表示max number of processes
nofile:表示max number of open file descriptors
hard/soft:soft是一个警告值,而hard则是一个真正意义的阀值,超过就会报错。
username: 想使所有用户就用'*' 代替

5、再次切换到username用户,执行ulimit -a:
zhangsan@ubuntu-server:~/.ssh$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31663
max locked memory (kbytes, -l) 16384
max memory size (kbytes, -m) unlimited
open files (-n) 100001
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 60000
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

posted @ 2021-01-12 13:09  美女爱找茬  阅读(136)  评论(0编辑  收藏  举报