您的位置:首页 > 文旅 > 旅游 > mongodb中ret resulted in status UnknownError: 24: Too many open files

mongodb中ret resulted in status UnknownError: 24: Too many open files

2025/2/13 9:34:09 来源:https://blog.csdn.net/csdnxyy/article/details/140804030  浏览:    关键词:mongodb中ret resulted in status UnknownError: 24: Too many open files

mongodb使用中遇到的问题
Invariant failure: ret resulted in status UnknownError:24:Too many open files at ***
错误原因为打开文件过多的错误,即“句柄数超出系统显示”。
1.需要更改一下系统的句柄数:
查看一下系统目前设置的句柄数 open files 对应的即为 当前系统的最大句柄数,目前这台服务器为1024,
ulimit -n 2048 #设置句柄数为2048 但是重启后会重置
在这里插入图片描述
2.在mongoDB的bin路径下,重新启动 mongodb服务
#./mongod -f /etc/mongodb/bin/mongodb.conf

3.检查mongoDB服务是否启动:
#ps -def | grep mongod

永久设置方法
vim /etc/security/limits.conf
在最后增加

  • soft nofile 4096
  • hard nofile 4096
    最前的 * 表示全部用户。可依据须要设置某一用户,比如
    fdipzone soft nofile 8192
    fdipzone hard nofile 8192
    改完后注销一下就能生效。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com