【问题标题】:Increasing open files limit on elastic beanstalk EC2 instances for the webapp user为 webapp 用户增加弹性 beanstalk EC2 实例的打开文件限制
【发布时间】:2020-12-11 15:38:13
【问题描述】:

对于 AWS Elastic Beanstalk 上的服务器进程(生成 goroutine),我遇到了 webapp 用户的打开文件限制。

在我的本地环境中,开放 FD 限制为 8k,我可以很好地处理这个问题,但我无法增加 AWS Elastic Beanstalk 上 webapp EC2 用户的限制。

根据 AWS Elastic Beanstalk 上的 Golang 开发说明,我有一个 procfile 用于 web 进程,如下所示:

web: bin/server.sh

server.sh 是:

#!/bin/bash

ulimit -n 32768
./bin/server
exit 0

我在标准输出日志中得到错误:

web: bin/server.sh: line 3: ulimit: open files: cannot modify limit: Operation not permitted

我已经能够通过在部署过程的早期使用.ebextensions 文件夹中的文件来增加实例的硬/软限制,如下面的示例所示:https://github.com/awsdocs/elastic-beanstalk-samples/blob/main/configuration-files/aws-provided/instance-configuration/java-increase-file-descriptors.config 但这对 webapp 用户启动的我的应用程序过程没有任何影响。

提前致谢。

编辑:我意识到我的最后一个问题并不明显。由于webapp 用户似乎没有更改此类限制的权限,我如何在 Elastic Beanstalk 上实现此更改?

【问题讨论】:

  • 您收到此错误,因为webapp 无权更改它。您的bin/server.sh 可能在webapp 用户下执行。

标签: amazon-web-services go amazon-elastic-beanstalk ulimit


【解决方案1】:

我能够按照here提出的概念解决这个问题

所以我的server.sh 看起来像:

#!/bin/bash

ulimit -Sn unlimited
./bin/server
exit 0

现在,我的 web 进程没有太多打开文件的问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-12-17
    • 2017-10-19
    • 2016-06-24
    • 2016-05-16
    • 1970-01-01
    • 2019-11-23
    • 2017-02-05
    相关资源
    最近更新 更多