linux - 如何在 Ubuntu 中增加 Neo4j 的最大文件打开限制(ulimit)?

目前 ulimit -n 显示 10000。我想将它增加到 40000。我已经编辑了“/etc/sysctl.conf”并放入了 fs.file-max=40000。我还编辑了 /etc/security/limits.conf 并更新了硬值和软值。但 ulimit 仍然显示 10000。完成所有这些更改后,我重新启动了笔记本电脑。我可以访问 root 密码。

usr_name@usr_name-lap:/etc$ /sbin/sysctl fs.file-max
fs.file-max = 500000

/etc/security/limits.conf 中添加以下行 -

*     soft    nofile          40000
*     hard    nofile          40000

我还在 /etc/pam.d/su-

中添加了以下行
session    required   pam_limits.so

我已经尝试了其他论坛上给出的所有可能的方法,但我最多可以达到 10000 的最大限制,不能超过这个限制。可能是什么问题?

我进行此更改是因为 neo4j 引发最大打开文件限制已达到错误。

最佳答案

您正在做的事情不适用于 root 用户。也许您以 root 身份运行服务,因此您看不到更改。

要增加 root 用户的 ulimit,您应该将 * 替换为 root。 * 不适用于 root 用户。休息和你做的一样。我会在这里重新引用它。

将以下行添加到文件中:/etc/security/limits.conf

root soft  nofile 40000

root hard  nofile 40000

然后在文件中添加以下行:/etc/pam.d/common-session

session required pam_limits.so

这将更新 root 用户的 ulimit。正如评论中提到的,您甚至不必重新启动即可看到更改。

https://stackoverflow.com/questions/21515463/

相关文章:

python - Django 可选 url 参数

linux - 如何强制 'cp' 覆盖目录而不是在里面创建另一个目录?

linux - 如何粘贴到终端?

linux - 在 LINUX 中确定 .a 库/存档是 32 位还是 64 位?

linux - 解压 tar.gz 文件

python - 将一对列表/元组解压缩成两个列表/元组

python - tight_layout() 不考虑数字字幕

python - 通过 'ElementTree' 在 Python 中使用命名空间解析 XML

python - 重命名 Pandas 中的特定列

python - Python 有包/模块管理系统吗?