我正在尝试运行一个脚本,以便在本地mongo数据库上构建一个mongo模式,但脚本执行到一半时失败了,并显示以下错误:
Exception in thread "main" com.mongodb.MongoCommandException:
Command failed with error 8: '24: Too many open files' on server 127.0.0.1:27017.
The full response is { "ok" : 0.0, "errmsg" : "24: Too many open files", "code" : 8 }我在MacOS高中希拉10.13.3号。我已经尝试了如下所示的修复:https://superuser.com/questions/433746/is-there-a-fix-for-the-too-many-open-files-in-system-error-on-os-x-10-7-1。当我执行ulimit -n并且数量超过1000时,它在没有sudo的情况下失败,并且当我使用sudo执行相同的命令时,它不会将限制更改为超过1000。我还尝试关闭了许多正在运行的应用程序,设置了kern.maxfiles=20480 kern.maxfilesperproc=18000的值。我在运行ulimit命令的同一个shell中运行mongo。有没有人知道这是怎么回事,或者怎么解决这个问题?我以前能够成功地完成mongo模式的构建。
发布于 2019-06-21 14:03:26
我也遇到过类似的问题。我通过brew安装的。如果我用as brew服务启动mongod,它工作得很好。
Brew服务启动mongodb@3.6
如果我通过命令行运行,我仍然不确定失败的根本原因。
https://stackoverflow.com/questions/49242764
复制相似问题