【問題】
第一次使用MongoDB,安裝了但是無法通過終端進(jìn)入
搜索了相關(guān)資料也不知道問題所在何處
希望有人能稍微指點(diǎn)一下,感激不盡
【環(huán)境】
終端: mac os
MongoDB:3.6.2
【相關(guān)代碼】
登入MongoDB
himiMacBookPro:bin himi$ sudo mongod --port 27017 --dbpath /data/db
或者
himiMacBookPro:bin himi$ sudo mongod
mac的$path是設(shè)定好的了
↓得到下面
2018-02-12T21:01:38.228+0900 I CONTROL [initandlisten] MongoDB starting : pid=24899 port=27017 dbpath=/data/db 64-bit host=himiMacBookPro.local
2018-02-12T21:01:38.228+0900 I CONTROL [initandlisten] db version v3.6.2
2018-02-12T21:01:38.228+0900 I CONTROL [initandlisten] git version: 489d177dbd0f0420a8ca04d39fd78d0a2c539420
2018-02-12T21:01:38.228+0900 I CONTROL [initandlisten] OpenSSL version: OpenSSL 0.9.8zc 15 Oct 2014
2018-02-12T21:01:38.228+0900 I CONTROL [initandlisten] allocator: system
2018-02-12T21:01:38.228+0900 I CONTROL [initandlisten] modules: none
2018-02-12T21:01:38.228+0900 I CONTROL [initandlisten] build environment:
2018-02-12T21:01:38.228+0900 I CONTROL [initandlisten] distarch: x86_64
2018-02-12T21:01:38.229+0900 I CONTROL [initandlisten] target_arch: x86_64
2018-02-12T21:01:38.229+0900 I CONTROL [initandlisten] options: { net: { port: 27017 }, storage: { dbPath: "/data/db" } }
2018-02-12T21:01:38.229+0900 I - [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2018-02-12T21:01:38.229+0900 I STORAGE [initandlisten] wiredtiger_open config: 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+0900 I STORAGE [initandlisten] WiredTiger message [1518436898:701666][24899:0x7fff75831300], txn-recover: Main recovery loop: starting at 6/4864
2018-02-12T21:01:38.826+0900 I STORAGE [initandlisten] WiredTiger message [1518436898:826287][24899:0x7fff75831300], txn-recover: Recovering log 6 through 7
2018-02-12T21:01:38.921+0900 I STORAGE [initandlisten] WiredTiger message [1518436898:921309][24899:0x7fff75831300], txn-recover: Recovering log 7 through 7
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten]
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten]
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server.
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten]
2018-02-12T21:01:39.131+0900 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2018-02-12T21:01:39.131+0900 I NETWORK [initandlisten] waiting for connections on port 27017
這里會(huì)停留很長時(shí)間
照理說這個(gè)出來之后就應(yīng)該進(jìn)入mongo
↓但是過了很久會(huì)出現(xiàn)以下內(nèi)容
2018-02-12T21:06:39.153+0900 I STORAGE [thread1] createCollection: config.system.sessions with generated UUID: c16f1163-15d8-4132-8a66-5a2e61d855b1
2018-02-12T21:06:39.238+0900 I INDEX [thread1] build index on: config.system.sessions properties: { v: 2, key: { lastUse: 1 }, name: "lsidTTLIndex", ns: "config.system.sessions", expireAfterSeconds: 1800 }
2018-02-12T21:06:39.238+0900 I INDEX [thread1] building index using bulk method; build may temporarily use up to 500 megabytes of RAM
2018-02-12T21:06:39.260+0900 I INDEX [thread1] build index done. scanned 0 total records. 0 secs
2018-02-12T21:06:39.262+0900 I COMMAND [thread1] command config.$cmd command: createIndexes { createIndexes: "system.sessions", indexes: [ { key: { lastUse: 1 }, name: "lsidTTLIndex", expireAfterSeconds: 1800 } ], $db: "config" } numYields:0 reslen:98 locks:{ Global: { acquireCount: { r: 1, w: 1 } }, Database: { acquireCount: { W: 1 } }, Collection: { acquireCount: { w: 1 } } } protocol:op_msg 115ms
然后就沒有其他內(nèi)容了.
等了半個(gè)小時(shí)也沒有變化
↓如果在上面的等待的時(shí)候control+c,會(huì)出現(xiàn)以下內(nèi)容
^C2018-02-12T22:04:41.601+0900 I CONTROL [signalProcessingThread] got signal 2 (Interrupt: 2), will terminate after current cmd ends
2018-02-12T22:04:41.601+0900 I NETWORK [signalProcessingThread] shutdown: going to close listening sockets...
2018-02-12T22:04:41.601+0900 I NETWORK [signalProcessingThread] removing socket file: /tmp/mongodb-27017.sock
2018-02-12T22:04:41.603+0900 I FTDC [signalProcessingThread] Shutting down full-time diagnostic data capture
2018-02-12T22:04:41.605+0900 I STORAGE [signalProcessingThread] WiredTigerKVEngine shutting down
2018-02-12T22:04:41.803+0900 I STORAGE [signalProcessingThread] shutdown: removing fs lock...
2018-02-12T22:04:41.805+0900 I CONTROL [signalProcessingThread] now exiting
2018-02-12T22:04:41.805+0900 I CONTROL [signalProcessingThread] shutting down with code:0
用了其他的看似是相關(guān)的命令,也不是很清楚這代表了什么
himiMacBookPro:~ himi$ sudo /usr/local/mongodb/bin/mongod
2018-02-12T20:31:44.076+0900 I CONTROL [initandlisten] MongoDB starting : pid=24718 port=27017 dbpath=/data/db 64-bit host=himiMacBookPro.local
2018-02-12T20:31:44.076+0900 I CONTROL [initandlisten] db version v3.6.2
2018-02-12T20:31:44.076+0900 I CONTROL [initandlisten] git version: 489d177dbd0f0420a8ca04d39fd78d0a2c539420
2018-02-12T20:31:44.076+0900 I CONTROL [initandlisten] OpenSSL version: OpenSSL 0.9.8zc 15 Oct 2014
2018-02-12T20:31:44.076+0900 I CONTROL [initandlisten] allocator: system
2018-02-12T20:31:44.076+0900 I CONTROL [initandlisten] modules: none
2018-02-12T20:31:44.076+0900 I CONTROL [initandlisten] build environment:
2018-02-12T20:31:44.076+0900 I CONTROL [initandlisten] distarch: x86_64
2018-02-12T20:31:44.076+0900 I CONTROL [initandlisten] target_arch: x86_64
2018-02-12T20:31:44.076+0900 I CONTROL [initandlisten] options: {}
2018-02-12T20:31:44.078+0900 I STORAGE [initandlisten] exception in initAndListen: DBPathInUse: Unable to lock the lock file: /data/db/mongod.lock (Resource temporarily unavailable). Another mongod instance is already running on the /data/db directory, terminating
2018-02-12T20:31:44.078+0900 I CONTROL [initandlisten] now exiting
2018-02-12T20:31:44.078+0900 I CONTROL [initandlisten] shutting down with code:100
【自己查找相關(guān)資料】
http://www.runoob.com/mongodb...
http://blog.csdn.net/xht555/a...
https://stackoverflow.com/que...
https://www.jianshu.com/p/116...
你第一張圖 用mongod開機(jī)后得到下面這個(gè)信息并且一直停留在這個(gè)信息是正確的 然后你需要保持這個(gè)終端不動(dòng),重新開啟一個(gè)終端 輸入mongo
2018-02-12T21:01:38.228+0900 I CONTROL [initandlisten] MongoDB starting : pid=24899 port=27017 dbpath=/data/db 64-bit host=himiMacBookPro.local
2018-02-12T21:01:38.228+0900 I CONTROL [initandlisten] db version v3.6.2
2018-02-12T21:01:38.228+0900 I CONTROL [initandlisten] git version: 489d177dbd0f0420a8ca04d39fd78d0a2c539420
2018-02-12T21:01:38.228+0900 I CONTROL [initandlisten] OpenSSL version: OpenSSL 0.9.8zc 15 Oct 2014
2018-02-12T21:01:38.228+0900 I CONTROL [initandlisten] allocator: system
2018-02-12T21:01:38.228+0900 I CONTROL [initandlisten] modules: none
2018-02-12T21:01:38.228+0900 I CONTROL [initandlisten] build environment:
2018-02-12T21:01:38.228+0900 I CONTROL [initandlisten] distarch: x86_64
2018-02-12T21:01:38.229+0900 I CONTROL [initandlisten] target_arch: x86_64
2018-02-12T21:01:38.229+0900 I CONTROL [initandlisten] options: { net: { port: 27017 }, storage: { dbPath: "/data/db" } }
2018-02-12T21:01:38.229+0900 I - [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2018-02-12T21:01:38.229+0900 I STORAGE [initandlisten] wiredtiger_open config: 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+0900 I STORAGE [initandlisten] WiredTiger message 1518436898:701666, txn-recover: Main recovery loop: starting at 6/4864
2018-02-12T21:01:38.826+0900 I STORAGE [initandlisten] WiredTiger message 1518436898:826287, txn-recover: Recovering log 6 through 7
2018-02-12T21:01:38.921+0900 I STORAGE [initandlisten] WiredTiger message 1518436898:921309, txn-recover: Recovering log 7 through 7
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten]
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten]
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server.
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
2018-02-12T21:01:39.125+0900 I CONTROL [initandlisten]
2018-02-12T21:01:39.131+0900 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2018-02-12T21:01:39.131+0900 I NETWORK [initandlisten] waiting for connections on port 27017
北大青鳥APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國家
北大青鳥中博軟件學(xué)院創(chuàng)立于2003年,作為華東區(qū)著名互聯(lián)網(wǎng)學(xué)院和江蘇省首批服務(wù)外包人才培訓(xùn)基地,中博成功培育了近30000名軟件工程師走向高薪崗位,合作企業(yè)超4
中公教育集團(tuán)創(chuàng)建于1999年,經(jīng)過二十年潛心發(fā)展,已由一家北大畢業(yè)生自主創(chuàng)業(yè)的信息技術(shù)與教育服務(wù)機(jī)構(gòu),發(fā)展為教育服務(wù)業(yè)的綜合性企業(yè)集團(tuán),成為集合面授教學(xué)培訓(xùn)、網(wǎng)
達(dá)內(nèi)教育集團(tuán)成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機(jī)構(gòu),是中國一站式人才培養(yǎng)平臺(tái)、一站式人才輸送平臺(tái)。2014年4月3日在美國成功上市,融資1
曾工作于聯(lián)想擔(dān)任系統(tǒng)開發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項(xiàng)目經(jīng)理從事移動(dòng)互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍(lán)懿科技有限責(zé)任公司從事總經(jīng)理職務(wù)負(fù)責(zé)iOS教學(xué)及管理工作。
浪潮集團(tuán)項(xiàng)目經(jīng)理。精通Java與.NET 技術(shù), 熟練的跨平臺(tái)面向?qū)ο箝_發(fā)經(jīng)驗(yàn),技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點(diǎn)難點(diǎn)突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫,具有快速界面開發(fā)的能力,對(duì)瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁制作和網(wǎng)頁游戲開發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開發(fā)經(jīng)驗(yàn)。曾經(jīng)歷任德國Software AG 技術(shù)顧問,美國Dachieve 系統(tǒng)架構(gòu)師,美國AngelEngineers Inc. 系統(tǒng)架構(gòu)師。