麻烦在Mac OSX上运行MongoDB

时间:2015-02-01 19:46:50

标签: javascript ios node.js macos mongodb

所以我已经在我的macbook上成功安装了mongodb。当我运行'brew install mongodb'命令行时,我说这个bc说:'mongodb-2.6.7已安装。我运行了命令'mkdir -p / data / db',虽然我无法真正遵循它做的事情(我已经尝试通过SO和Mongo网站上的其他一些线程,但不明白如何解决问题; sry我有点蠢蠢欲动,并不真正理解这个问题)。但是,当我输入mongod以查看它是否成功运行时,我得到以下错误/输出

2015-02-01T14:37:30.575-0500 [initandlisten] MongoDB starting : pid=41932 port=27017 dbpath=/data/db 64-bit host=[removed]-mbp.home
2015-02-01T14:37:30.575-0500 [initandlisten] 
2015-02-01T14:37:30.575-0500 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2015-02-01T14:37:30.575-0500 [initandlisten] db version v2.6.7
2015-02-01T14:37:30.575-0500 [initandlisten] git version: nogitversion
2015-02-01T14:37:30.575-0500 [initandlisten] build info: Darwin minimavericks.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
2015-02-01T14:37:30.575-0500 [initandlisten] allocator: tcmalloc
2015-02-01T14:37:30.575-0500 [initandlisten] options: {}
2015-02-01T14:37:30.577-0500 [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
2015-02-01T14:37:30.577-0500 [initandlisten] dbexit: 
2015-02-01T14:37:30.577-0500 [initandlisten] shutdown: going to close listening sockets...
2015-02-01T14:37:30.577-0500 [initandlisten] shutdown: going to flush diaglog...
2015-02-01T14:37:30.577-0500 [initandlisten] shutdown: going to close sockets...
2015-02-01T14:37:30.577-0500 [initandlisten] shutdown: waiting for fs preallocator...
2015-02-01T14:37:30.577-0500 [initandlisten] shutdown: lock for final commit...
2015-02-01T14:37:30.577-0500 [initandlisten] shutdown: final commit...
2015-02-01T14:37:30.578-0500 [initandlisten] shutdown: closing all files...
2015-02-01T14:37:30.578-0500 [initandlisten] closeAllFiles() finished
2015-02-01T14:37:30.578-0500 [initandlisten] shutdown: removing fs lock...
2015-02-01T14:37:30.578-0500 [initandlisten] couldn't remove fs lock errno:9 Bad file descriptor
2015-02-01T14:37:30.578-0500 [initandlisten] dbexit: really exiting now

列出的一个问题是“软限制太低”,但我的理解是因为我只是为了开发而不是生产目的这样做而无关紧要。有人可以提供如何解决此错误?这是一个类似的线程,但我不知道该怎么做:

Trouble installing mongodb using Homebrew

运行sudo chown $ USER / data / db之后我现在得到:

mongod --help for help and startup options
2015-02-01T15:48:06.940-0500 [initandlisten] MongoDB starting : pid=43297 port=27017 dbpath=/data/db 64-bit host=shus-mbp.home
2015-02-01T15:48:06.941-0500 [initandlisten] 
2015-02-01T15:48:06.941-0500 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2015-02-01T15:48:06.941-0500 [initandlisten] db version v2.6.7
2015-02-01T15:48:06.941-0500 [initandlisten] git version: nogitversion
2015-02-01T15:48:06.941-0500 [initandlisten] build info: Darwin minimavericks.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
2015-02-01T15:48:06.941-0500 [initandlisten] allocator: tcmalloc
2015-02-01T15:48:06.941-0500 [initandlisten] options: {}
2015-02-01T15:48:06.949-0500 [initandlisten] journal dir=/data/db/journal
2015-02-01T15:48:06.950-0500 [initandlisten] recover : no journal files present, no recovery needed
2015-02-01T15:48:06.972-0500 [initandlisten] allocating new ns file /data/db/local.ns, filling with zeroes...
2015-02-01T15:48:07.025-0500 [FileAllocator] allocating new datafile /data/db/local.0, filling with zeroes...
2015-02-01T15:48:07.025-0500 [FileAllocator] creating directory /data/db/_tmp
2015-02-01T15:48:07.125-0500 [FileAllocator] done allocating datafile /data/db/local.0, size: 64MB,  took 0.099 secs
2015-02-01T15:48:07.154-0500 [initandlisten] build index on: local.startup_log properties: { v: 1, key: { _id: 1 }, name: "_id_", ns: "local.startup_log" }
2015-02-01T15:48:07.165-0500 [initandlisten]     added index to empty collection
2015-02-01T15:48:07.165-0500 [initandlisten] command local.$cmd command: create { create: "startup_log", size: 10485760, capped: true } ntoreturn:1 keyUpdates:0 numYields:0  reslen:37 193ms
2015-02-01T15:48:07.165-0500 [initandlisten] waiting for connections on port 27017
2015-02-01T15:49:06.978-0500 [clientcursormon] mem (MB) res:34 virt:2637
2015-02-01T15:49:06.978-0500 [clientcursormon]  mapped (incl journal view):160
2015-02-01T15:49:06.978-0500 [clientcursormon]  connections:0

这是否意味着它现在正在运作?

1 个答案:

答案 0 :(得分:0)

是的,这是有效的。当您运行“mongod”并看到此“waiting for connections on port 27017”时,您的mongodb运行良好,您可以开始查询它。