gpt4 book ai didi

macos - 无法在 Mac OS X 上运行 mongodb

转载 作者:可可西里 更新时间:2023-11-01 09:58:01 24 4
gpt4 key购买 nike

我已经使用 homebrew 安装了 mongodbmongo 命令在终端中按预期运行,但是当我在终端中运行 mongod 时,它返回:

mongod --help for help and startup options
2014-09-27T12:55:42.705+0330 [initandlisten] MongoDB starting : pid=3704 port=27017 dbpath=/data/db 64-bit host=Your-MacBook-Pro.local
2014-09-27T12:55:42.705+0330 [initandlisten]
2014-09-27T12:55:42.705+0330 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2014-09-27T12:55:42.705+0330 [initandlisten] db version v2.6.4
2014-09-27T12:55:42.705+0330 [initandlisten] git version: nogitversion
2014-09-27T12:55:42.705+0330 [initandlisten] build info: Darwin Your-MacBook-Pro.local 13.4.0 Darwin Kernel Version 13.4.0: Sun Aug 17 19:50:11 PDT 2014; root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
2014-09-27T12:55:42.705+0330 [initandlisten] allocator: tcmalloc
2014-09-27T12:55:42.705+0330 [initandlisten] options: {}
2014-09-27T12:55:42.706+0330 [initandlisten] exception in initAndListen: 10309 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
2014-09-27T12:55:42.706+0330 [initandlisten] dbexit:
2014-09-27T12:55:42.706+0330 [initandlisten] shutdown: going to close listening sockets...
2014-09-27T12:55:42.706+0330 [initandlisten] shutdown: going to flush diaglog...
2014-09-27T12:55:42.706+0330 [initandlisten] shutdown: going to close sockets...
2014-09-27T12:55:42.706+0330 [initandlisten] shutdown: waiting for fs preallocator...
2014-09-27T12:55:42.706+0330 [initandlisten] shutdown: lock for final commit...
2014-09-27T12:55:42.706+0330 [initandlisten] shutdown: final commit...
2014-09-27T12:55:42.706+0330 [initandlisten] shutdown: closing all files...
2014-09-27T12:55:42.706+0330 [initandlisten] closeAllFiles() finished
2014-09-27T12:55:42.706+0330 [initandlisten] shutdown: removing fs lock...
2014-09-27T12:55:42.706+0330 [initandlisten] couldn't remove fs lock errno:9 Bad file descriptor
2014-09-27T12:55:42.706+0330 [initandlisten] dbexit: really exiting now

所以我不能在我的 php 应用程序中使用 mongo 类。是不是端口冲突导致的?有什么解决办法吗?

最佳答案

如果您看到异常,它会显示:

exception in initAndListen: 
10309 Unable to create/open lock file: /data/db/mongod.lock
errno:13 Permission denied Is a mongod instance already running?, terminating

由于先前运行的 mongod 实例的不正确终止/关闭,mongod 实例无法创建锁定文件或锁定文件已存在于该位置,并且当前实例无法获取它。

要解决此问题,请手动删除 /data/db/mongod.lock(如果存在)并重新启动 mongod 服务。

sudo rm /data/db/mongod.lock

如果锁定文件不存在,请授予 /data/db 目录的读/写权限并重启实例。

关于macos - 无法在 Mac OS X 上运行 mongodb,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26073266/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com