【发布时间】: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