Linux报Resource temporarily unavailable问题解决方案

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

 Resource temporarily unavailable

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

解决方案

  1.  使用root用户登陆,进入到/etc/security/limits.d/:
    1. [root@centos ~]$ cd /etc/security/limits.d/

    2. [root@centos limits.d]$ ll

    3. total 8

    4. -rw-r--r-- 1 root root 195 Aug 29 2017 20-nproc.conf

  2. 编辑20-nproc.conf:
    1. [root@centos limits.d]$ vim 20-nproc.conf
    2. 添加信息 
      1. “username” soft nproc 60000
    3. 添加后的文件内容应该为:
      1. * soft nproc 4096

      2. root soft nproc unlimited

      3. “username” soft nproc 60000

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

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

  4. nproc:表示max number of processes
    nofile:表示max number of open file descriptors
    hard/soft:soft是一个警告值,而hard则是一个真正意义的阀值,超过就会报错。

  5. 再次切换到username用户,执行ulimit -a

    1. [username@VM_3_220_centos ~]$ ulimit -a

    2. core file size (blocks, -c) 0

    3. data seg size (kbytes, -d) unlimited

    4. scheduling priority (-e) 0

    5. file size (blocks, -f) unlimited

    6. pending signals (-i) 7271

    7. max locked memory (kbytes, -l) 64

    8. max memory size (kbytes, -m) unlimited

    9. open files (-n) 65535

    10. pipe size (512 bytes, -p) 8

    11. POSIX message queues (bytes, -q) 819200

    12. real-time priority (-r) 0

    13. stack size (kbytes, -s) 8192

    14. cpu time (seconds, -t) unlimited

    15. max user processes (-u) 65535

    16. virtual memory (kbytes, -v) unlimited

    17. file locks (-x) unlimited

  6. 问题解决

  • 7
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值