不使用sudo Mac OS X启动MongoDB

时间:2015-05-06 13:57:31

标签: macos mongodb sudo

我在Mac OS X上设置并安装了MongoDB。我目前可以使用以下命令正确运行它

sudo mongod

虽然,当我尝试使用mongod命令运行服务器时,我得到以下输出

2015-05-06T09:51:19.436-0400 [initandlisten] MongoDB starting : pid=753 port=27017 dbpath=/data/db 64-bit host=wificlient-10-201-122-48.uc.cl
2015-05-06T09:51:19.437-0400 [initandlisten] 
2015-05-06T09:51:19.437-0400 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2015-05-06T09:51:19.437-0400 [initandlisten] db version v2.6.4
2015-05-06T09:51:19.437-0400 [initandlisten] git version: nogitversion
2015-05-06T09:51:19.437-0400 [initandlisten] build info: Darwin minimavericks.local 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun  3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
2015-05-06T09:51:19.437-0400 [initandlisten] allocator: tcmalloc
2015-05-06T09:51:19.437-0400 [initandlisten] options: {}
2015-05-06T09:51:19.486-0400 [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-05-06T09:51:19.486-0400 [initandlisten] dbexit: 
2015-05-06T09:51:19.486-0400 [initandlisten] shutdown: going to close listening sockets...
2015-05-06T09:51:19.486-0400 [initandlisten] shutdown: going to flush diaglog...
2015-05-06T09:51:19.486-0400 [initandlisten] shutdown: going to close sockets...
2015-05-06T09:51:19.486-0400 [initandlisten] shutdown: waiting for fs preallocator...
2015-05-06T09:51:19.486-0400 [initandlisten] shutdown: lock for final commit...
2015-05-06T09:51:19.486-0400 [initandlisten] shutdown: final commit...
2015-05-06T09:51:19.486-0400 [initandlisten] shutdown: closing all files...
2015-05-06T09:51:19.487-0400 [initandlisten] closeAllFiles() finished
2015-05-06T09:51:19.487-0400 [initandlisten] shutdown: removing fs lock...
2015-05-06T09:51:19.487-0400 [initandlisten] couldn't remove fs lock errno:9 Bad file descriptor
2015-05-06T09:51:19.487-0400 [initandlisten] dbexit: really exiting now
顺便说一句,我还没有运行另一个mongo实例,我用sudo ps -ef | grep mongo检查了它。如何在不必每次都使用sudo命令的情况下启动并运行MongoDB?我知道滥用sudo可能会导致未来泄密。

1 个答案:

答案 0 :(得分:0)

尝试使用BREW进行安装。你不再需要使用sudo了: Installing MongoDB

或者您可以将String tipoOper = request.getParameter("tipoOper"); 添加到默认命令