← 返回博客列表
发布于 2024.05.07 15:43:11 · 约 74 字

关于报错 too many open files

压测游戏服务器的时候,发现好几个服务 socket 提示 too many open files ,并且加载文件和读取数据库都失败。估计是 fd 上限设置的太小了。 使用 ulimit -a 检查,看到 open files 的值才1024。果然。 修改方法如下,在文件/etc/security/limits.conf 的最后添加

*         hard    nofile      500000
*         soft    nofile      500000
root      hard    nofile      500000
root      soft    nofile      500000

参考 https://www.baeldung.com/linux/error-too-many-open-files#file-descriptor-limits