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

【问题】第一次使用MongoDB,安装了但是无法通过终端进入搜索了相关资料也不知道问题所在何处
希望有人能稍微指点一下,感激不尽
【环境】终端:macosMongoDB:3.6.2
【相关代码】
登入MongoDB
himiMacBookPro:binhimi$sudomongod--port27017--dbpath/data/db
或者
himiMacBookPro:binhimi$sudomongod
mac的$path是设定好的了
↓得到下面
2018-02-12T21:01:38.228+0900ICONTROL[initandlisten]MongoDBstarting:pid=24899port=27017dbpath=/data/db64-bithost=himiMacBookPro.local
2018-02-12T21:01:38.228+0900ICONTROL[initandlisten]dbversionv3.6.2
2018-02-12T21:01:38.228+0900ICONTROL[initandlisten]gitversion:489d177dbd0f0420a8ca04d39fd78d0a2c539420
2018-02-12T21:01:38.228+0900ICONTROL[initandlisten]OpenSSLversion:OpenSSL0.9.8zc15Oct2014
2018-02-12T21:01:38.228+0900ICONTROL[initandlisten]allocator:system
2018-02-12T21:01:38.228+0900ICONTROL[initandlisten]modules:none
2018-02-12T21:01:38.228+0900ICONTROL[initandlisten]buildenvironment:
2018-02-12T21:01:38.228+0900ICONTROL[initandlisten]distarch:x86_64
2018-02-12T21:01:38.229+0900ICONTROL[initandlisten]target_arch:x86_64
2018-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/4864
2018-02-12T21:01:38.826+0900ISTORAGE[initandlisten]WiredTigermessage[1518436898:826287][24899:0x7fff75831300],txn-recover:Recoveringlog6through7
2018-02-12T21:01:38.921+0900ISTORAGE[initandlisten]WiredTigermessage[1518436898:921309][24899:0x7fff75831300],txn-recover:Recoveringlog7through7
2018-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
tospecifywhichIP
2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]**addressesitshouldserveresponsesfrom,orwith--bind_ip_allto
2018-02-12T21:01:39.125+0900ICONTROL[initandlisten]**bindtoallinterfaces.Ifthisbehaviorisdesired,startthe
2018-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-5a2e61d855b1
2018-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;buildmaytemporarilyuseupto500megabytesofRAM
2018-02-12T21:06:39.260+0900IINDEX[thread1]buildindexdone.scanned0totalrecords.0secs
2018-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),willterminateaftercurrentcmdends
2018-02-12T22:04:41.601+0900INETWORK[signalProcessingThread]shutdown:goingtocloselisteningsockets...
2018-02-12T22:04:41.601+0900INETWORK[signalProcessingThread]removingsocketfile:/tmp/mongodb-27017.sock
2018-02-12T22:04:41.603+0900IFTDC[signalProcessingThread]Shuttingdownfull-timediagnosticdatacapture
2018-02-12T22:04:41.605+0900ISTORAGE[signalProcessingThread]WiredTigerKVEngineshuttingdown
2018-02-12T22:04:41.803+0900ISTORAGE[signalProcessingThread]shutdown:removingfslock...
2018-02-12T22:04:41.805+0900ICONTROL[signalProcessingThread]nowexiting
2018-02-12T22:04:41.805+0900ICONTROL[signalProcessingThread]shuttingdownwithcode:0
用了其他的看似是相关的命令,也不是很清楚这代表了什么
himiMacBookPro:~himi$sudo/usr/local/mongodb/bin/mongod
2018-02-12T20:31:44.076+0900ICONTROL[initandlisten]MongoDBstarting:pid=24718port=27017dbpath=/data/db64-bithost=himiMacBookPro.local
2018-02-12T20:31:44.076+0900ICONTROL[initandlisten]dbversionv3.6.2
2018-02-12T20:31:44.076+0900ICONTROL[initandlisten]gitversion:489d177dbd0f0420a8ca04d39fd78d0a2c539420
2018-02-12T20:31:44.076+0900ICONTROL[initandlisten]OpenSSLversion:OpenSSL0.9.8zc15Oct2014
2018-02-12T20:31:44.076+0900ICONTROL[initandlisten]allocator:system
2018-02-12T20:31:44.076+0900ICONTROL[initandlisten]modules:none
2018-02-12T20:31:44.076+0900ICONTROL[initandlisten]buildenvironment:
2018-02-12T20:31:44.076+0900ICONTROL[initandlisten]distarch:x86_64
2018-02-12T20:31:44.076+0900ICONTROL[initandlisten]target_arch:x86_64
2018-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,terminating
2018-02-12T20:31:44.078+0900ICONTROL[initandlisten]nowexiting
2018-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...
Cats萌萌
浏览 359回答 2
2回答

交互式爱情

mongod是开启数据库进程并不是mongo,实际已经启动了数据库,你只需要再打开一个terminal(终端)然后输入mongo就可以了.mongo是mongodb管理工具,mongod是mongodb数据库进程.

慕标琳琳

你第一张图用mongod开机后得到下面这个信息并且一直停留在这个信息是正确的然后你需要保持这个终端不动,重新开启一个终端输入mongo2018-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_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
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript