为了账号安全,请及时绑定邮箱和手机立即绑定

mac终端上无法启动mongo(3.6.2)

mac终端上无法启动mongo(3.6.2)

Cats萌萌 2019-05-23 11:56:48
【问题】第一次使用MongoDB,安装了但是无法通过终端进入搜索了相关资料也不知道问题所在何处希望有人能稍微指点一下,感激不尽【环境】终端:macosMongoDB:3.6.2【相关代码】登入MongoDBhimiMacBookPro:binhimi$sudomongod--port27017--dbpath/data/db或者himiMacBookPro:binhimi$sudomongodmac的$path是设定好的了↓得到下面2018-02-12T21:01:38.228+0900ICONTROL[initandlisten]MongoDBstarting:pid=24899port=27017dbpath=/data/db64-bithost=himiMacBookPro.local2018-02-12T21:01:38.228+0900ICONTROL[initandlisten]dbversionv3.6.22018-02-12T21:01:38.228+0900ICONTROL[initandlisten]gitversion:489d177dbd0f0420a8ca04d39fd78d0a2c5394202018-02-12T21:01:38.228+0900ICONTROL[initandlisten]OpenSSLversion:OpenSSL0.9.8zc15Oct20142018-02-12T21:01:38.228+0900ICONTROL[initandlisten]allocator:system2018-02-12T21:01:38.228+0900ICONTROL[initandlisten]modules:none2018-02-12T21:01:38.228+0900ICONTROL[initandlisten]buildenvironment:2018-02-12T21:01:38.228+0900ICONTROL[initandlisten]distarch:x86_642018-02-12T21:01:38.229+0900ICONTROL[initandlisten]target_arch:x86_642018-02-12T21:01:38.229+0900ICONTROL[initandlisten]options:{net:{port:27017},storage:{dbPath:"/data/db"}}2018-02-12T21:01:38.229+0900I-[initandlisten]Detecteddatafilesin/data/dbcreatedbythe'wiredTiger'storageengine,sosettingtheactivestorageengineto'wiredTiger'.2018-02-12T21:01:38.229+0900ISTORAGE[initandlisten]wiredtiger_openconfig:create,cache_size=7680M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),2018-02-12T21:01:38.701+0900ISTORAGE[initandlisten]WiredTigermessage[1518436898:701666][24899:0x7fff75831300],txn-recover:Mainrecoveryloop:startingat6/48642018-02-12T21:01:38.826+0900ISTORAGE[initandlisten]WiredTigermessage[1518436898:826287][24899:0x7fff75831300],txn-recover:Recoveringlog6through72018-02-12T21:01:38.921+0900ISTORAGE[initandlisten]WiredTigermessage[1518436898:921309][24899:0x7fff75831300],txn-recover:Recoveringlog7through72018-02-12T21:01:39.125+0900ICONTROL[initandlisten]2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]**WARNING:Accesscontrolisnotenabledforthedatabase.2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]**Readandwriteaccesstodataandconfigurationisunrestricted.2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]**WARNING:Youarerunningthisprocessastherootuser,whichisnotrecommended.2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]**WARNING:Thisserverisboundtolocalhost.2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]**Remotesystemswillbeunabletoconnecttothisserver.2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]**Starttheserverwith--bind_iptospecifywhichIP2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]**addressesitshouldserveresponsesfrom,orwith--bind_ip_allto2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]**bindtoallinterfaces.Ifthisbehaviorisdesired,startthe2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]**serverwith--bind_ip127.0.0.1todisablethiswarning.2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]2018-02-12T21:01:39.131+0900IFTDC[initandlisten]Initializingfull-timediagnosticdatacapturewithdirectory'/data/db/diagnostic.data'2018-02-12T21:01:39.131+0900INETWORK[initandlisten]waitingforconnectionsonport27017这里会停留很长时间照理说这个出来之后就应该进入mongo↓但是过了很久会出现以下内容2018-02-12T21:06:39.153+0900ISTORAGE[thread1]createCollection:config.system.sessionswithgeneratedUUID:c16f1163-15d8-4132-8a66-5a2e61d855b12018-02-12T21:06:39.238+0900IINDEX[thread1]buildindexon:config.system.sessionsproperties:{v:2,key:{lastUse:1},name:"lsidTTLIndex",ns:"config.system.sessions",expireAfterSeconds:1800}2018-02-12T21:06:39.238+0900IINDEX[thread1]buildingindexusingbulkmethod;buildmaytemporarilyuseupto500megabytesofRAM2018-02-12T21:06:39.260+0900IINDEX[thread1]buildindexdone.scanned0totalrecords.0secs2018-02-12T21:06:39.262+0900ICOMMAND[thread1]commandconfig.$cmdcommand:createIndexes{createIndexes:"system.sessions",indexes:[{key:{lastUse:1},name:"lsidTTLIndex",expireAfterSeconds:1800}],$db:"config"}numYields:0reslen:98locks:{Global:{acquireCount:{r:1,w:1}},Database:{acquireCount:{W:1}},Collection:{acquireCount:{w:1}}}protocol:op_msg115ms然后就没有其他内容了.等了半个小时也没有变化↓如果在上面的等待的时候control+c,会出现以下内容^C2018-02-12T22:04:41.601+0900ICONTROL[signalProcessingThread]gotsignal2(Interrupt:2),willterminateaftercurrentcmdends2018-02-12T22:04:41.601+0900INETWORK[signalProcessingThread]shutdown:goingtocloselisteningsockets...2018-02-12T22:04:41.601+0900INETWORK[signalProcessingThread]removingsocketfile:/tmp/mongodb-27017.sock2018-02-12T22:04:41.603+0900IFTDC[signalProcessingThread]Shuttingdownfull-timediagnosticdatacapture2018-02-12T22:04:41.605+0900ISTORAGE[signalProcessingThread]WiredTigerKVEngineshuttingdown2018-02-12T22:04:41.803+0900ISTORAGE[signalProcessingThread]shutdown:removingfslock...2018-02-12T22:04:41.805+0900ICONTROL[signalProcessingThread]nowexiting2018-02-12T22:04:41.805+0900ICONTROL[signalProcessingThread]shuttingdownwithcode:0用了其他的看似是相关的命令,也不是很清楚这代表了什么himiMacBookPro:~himi$sudo/usr/local/mongodb/bin/mongod2018-02-12T20:31:44.076+0900ICONTROL[initandlisten]MongoDBstarting:pid=24718port=27017dbpath=/data/db64-bithost=himiMacBookPro.local2018-02-12T20:31:44.076+0900ICONTROL[initandlisten]dbversionv3.6.22018-02-12T20:31:44.076+0900ICONTROL[initandlisten]gitversion:489d177dbd0f0420a8ca04d39fd78d0a2c5394202018-02-12T20:31:44.076+0900ICONTROL[initandlisten]OpenSSLversion:OpenSSL0.9.8zc15Oct20142018-02-12T20:31:44.076+0900ICONTROL[initandlisten]allocator:system2018-02-12T20:31:44.076+0900ICONTROL[initandlisten]modules:none2018-02-12T20:31:44.076+0900ICONTROL[initandlisten]buildenvironment:2018-02-12T20:31:44.076+0900ICONTROL[initandlisten]distarch:x86_642018-02-12T20:31:44.076+0900ICONTROL[initandlisten]target_arch:x86_642018-02-12T20:31:44.076+0900ICONTROL[initandlisten]options:{}2018-02-12T20:31:44.078+0900ISTORAGE[initandlisten]exceptionininitAndListen:DBPathInUse:Unabletolockthelockfile:/data/db/mongod.lock(Resourcetemporarilyunavailable).Anothermongodinstanceisalreadyrunningonthe/data/dbdirectory,terminating2018-02-12T20:31:44.078+0900ICONTROL[initandlisten]nowexiting2018-02-12T20:31:44.078+0900ICONTROL[initandlisten]shuttingdownwithcode:100【自己查找相关资料】http://www.runoob.com/mongodb...http://blog.csdn.net/xht555/a...https://stackoverflow.com/que...https://www.jianshu.com/p/116...
查看完整描述

2 回答

?
交互式爱情

TA贡献1712条经验 获得超3个赞

mongod是开启数据库进程并不是mongo,实际已经启动了数据库,你只需要再打开一个terminal(终端)然后输入mongo就可以了.
mongo是mongodb管理工具,mongod是mongodb数据库进程.
                            
查看完整回答
反对 回复 2019-05-23
?
慕标琳琳

TA贡献1830条经验 获得超9个赞

你第一张图用mongod开机后得到下面这个信息并且一直停留在这个信息是正确的然后你需要保持这个终端不动,重新开启一个终端输入mongo
2018-02-12T21:01:38.228+0900ICONTROL[initandlisten]MongoDBstarting:pid=24899port=27017dbpath=/data/db64-bithost=himiMacBookPro.local2018-02-12T21:01:38.228+0900ICONTROL[initandlisten]dbversionv3.6.22018-02-12T21:01:38.228+0900ICONTROL[initandlisten]gitversion:489d177dbd0f0420a8ca04d39fd78d0a2c5394202018-02-12T21:01:38.228+0900ICONTROL[initandlisten]OpenSSLversion:OpenSSL0.9.8zc15Oct20142018-02-12T21:01:38.228+0900ICONTROL[initandlisten]allocator:system2018-02-12T21:01:38.228+0900ICONTROL[initandlisten]modules:none2018-02-12T21:01:38.228+0900ICONTROL[initandlisten]buildenvironment:2018-02-12T21:01:38.228+0900ICONTROL[initandlisten]distarch:x86_642018-02-12T21:01:38.229+0900ICONTROL[initandlisten]target_arch:x86_642018-02-12T21:01:38.229+0900ICONTROL[initandlisten]options:{net:{port:27017},storage:{dbPath:"/data/db"}}2018-02-12T21:01:38.229+0900I-[initandlisten]Detecteddatafilesin/data/dbcreatedbythe'wiredTiger'storageengine,sosettingtheactivestorageengineto'wiredTiger'.2018-02-12T21:01:38.229+0900ISTORAGE[initandlisten]wiredtiger_openconfig:create,cache_size=7680M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),2018-02-12T21:01:38.701+0900ISTORAGE[initandlisten]WiredTigermessage1518436898:701666,txn-recover:Mainrecoveryloop:startingat6/48642018-02-12T21:01:38.826+0900ISTORAGE[initandlisten]WiredTigermessage1518436898:826287,txn-recover:Recoveringlog6through72018-02-12T21:01:38.921+0900ISTORAGE[initandlisten]WiredTigermessage1518436898:921309,txn-recover:Recoveringlog7through72018-02-12T21:01:39.125+0900ICONTROL[initandlisten]2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]**WARNING:Accesscontrolisnotenabledforthedatabase.2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]**Readandwriteaccesstodataandconfigurationisunrestricted.2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]**WARNING:Youarerunningthisprocessastherootuser,whichisnotrecommended.2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]**WARNING:Thisserverisboundtolocalhost.2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]**Remotesystemswillbeunabletoconnecttothisserver.2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]**Starttheserverwith--bind_ip
tospecifywhichIP2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]**addressesitshouldserveresponsesfrom,orwith--bind_ip_allto2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]**bindtoallinterfaces.Ifthisbehaviorisdesired,startthe2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]**serverwith--bind_ip127.0.0.1todisablethiswarning.2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]2018-02-12T21:01:39.131+0900IFTDC[initandlisten]Initializingfull-timediagnosticdatacapturewithdirectory'/data/db/diagnostic.data'2018-02-12T21:01:39.131+0900INETWORK[initandlisten]waitingforconnectionsonport27017
                            
查看完整回答
反对 回复 2019-05-23
  • 2 回答
  • 0 关注
  • 358 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信