我已经使用 homebrew 安装了 mongodb,但是mongod
没有运行。
我收到此错误:
2015-03-09T14:47:22.418+0000 I CONTROL [initandlisten] MongoDB starting : pid=10510 port=27017 dbpath=/data/db 64-bit host=Sanjays-MacBook.local
2015-03-09T14:47:22.419+0000 I CONTROL [initandlisten] db version v3.0.0
2015-03-09T14:47:22.419+0000 I CONTROL [initandlisten] git version: nogitversion
2015-03-09T14:47:22.419+0000 I CONTROL [initandlisten] build info: Darwin miniyosemite.local 14.1.0 Darwin Kernel Version 14.1.0: Mon Dec 22 23:10:38 PST 2014; root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
2015-03-09T14:47:22.419+0000 I CONTROL [initandlisten] allocator: system
2015-03-09T14:47:22.419+0000 I CONTROL [initandlisten] options: {}
2015-03-09T14:47:22.424+0000 I STORAGE [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
2015-03-09T14:47:22.425+0000 I CONTROL [initandlisten] dbexit: rc: 100
我觉得我把某些东西安装错了地方,但我不太确定。我做错了什么?
答案1
2015-03-09T14:47:22.424+0000 I STORAGE [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
读取该死的日志行。检查是否存在/data/db/
,然后检查是否存在锁定文件/data/db/mongod.lock
。它可能在那里,但由另一个用户(可能是 root)拥有。