无法在Mac OS X上运行mongod

 ranger 发布于 2022-12-19 14:26

我已经安装mongodb使用homebrew.该mongo命令在终端中按预期运行,但是当我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类.是由一些端口冲突引起的吗?这有什么解决方案吗?

1 个回答
  • 如果你看到Exception,它会说:

    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目录的读/写权限并重新启动实例.

    2022-12-19 14:29 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有