增加 fs.file-max:其他内核参数需要调整哪些(用于运行 kafka)

增加 fs.file-max:其他内核参数需要调整哪些(用于运行 kafka)

为了运行增加了 500000 个 kafka 服务(使用 jbod 磁盘,我们遇到了由于打开文件太多而出现的问题) ,我们决定在 RHEL 7.x 服务器上LimitNOFILE增加fs.file-maxfrom500000到。1000000

据我了解,增加fs.file它也会对打开更多文件描述符产生影响。

所以我们想了解在增加fs.file-max?时其他内核参数是否也应该更新?

从阅读中,我发现inode-max, 应该“比 file-max 中的值大 3-4 倍,

但我们在我们的服务器上没有找到这个参数

 more /proc/sys/fs/inode-max
/proc/sys/fs/inode-max: No such file or directory


more /etc/sysctl.conf
# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
fs.file-max = 500000
vm.swappiness = 10
vm.vfs_cache_pressure = 50
net.core.somaxconn=1024

答案1

inode-max文件不存在,因为该 sysfs 从 linux-2.4 开始被删除; inode 数量不再有静态限制。

/proc/sys/fs/inode-max(仅在 Linux 2.2 之前存在)此文件包含内存中 inode 的最大数量。该值应比 file-max 中的值大 3-4 倍,因为 stdin、stdout 和网络套接字也需要 inode 来处理它们。当您经常用完 inode 时,您需要增加此值。

  Starting with Linux 2.4, there is no longer a static limit
  on the number of inodes, and this file is removed.

https://man7.org/linux/man-pages/man5/proc.5.html

据我所知,调整 时不需要调整任何其他内核参数fs.file-max

也就是说,在 systemd 系统上;有时您可能需要/etc/systemd/user.conf(针对用户)或/etc/systemd/system.conf(系统范围)设置资源限制,因为在某些情况下,systemd 可能会覆盖或忽略资源限制。

相关内容