错误:无法连接到服务器127.0.0.1:27017,连接尝试失败mongodb

时间:2019-04-20 03:58:29

标签: mongodb

MongoDB之前未连接到我的nodejs应用,但运行正常,但我不知道为什么在尝试使用shell运行时无法运行

C:\Users\adity>mongo
MongoDB shell version v3.6.5
connecting to: mongodb://127.0.0.1:27017
2019-04-20T09:25:45.799+0530 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017 after 5000ms milliseconds, giving up.
2019-04-20T09:25:45.802+0530 E QUERY    [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:251:13
@(connect):1:6
exception: connect failed

我遵循了我在StackOverflow中找到的答案,即link,但仍然给出相同的错误。

任何人请帮助我解决此问题。

尝试启动mongod时我得到了

C:\Users\adity>mongod
2019-04-19T21:12:16.552-0700 I CONTROL  [initandlisten] MongoDB starting : pid=8888 port=27017 dbpath=C:\data\db\ 64-bit host=DESKTOP-H4VG30N
2019-04-19T21:12:16.552-0700 I CONTROL  [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2019-04-19T21:12:16.555-0700 I CONTROL  [initandlisten] db version v3.6.5
2019-04-19T21:12:16.558-0700 I CONTROL  [initandlisten] git version: a20ecd3e3a174162052ff99913bc2ca9a839d618
2019-04-19T21:12:16.558-0700 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2o-fips  27 Mar 2018
2019-04-19T21:12:16.559-0700 I CONTROL  [initandlisten] allocator: tcmalloc
2019-04-19T21:12:16.559-0700 I CONTROL  [initandlisten] modules: none
2019-04-19T21:12:16.560-0700 I CONTROL  [initandlisten] build environment:
2019-04-19T21:12:16.560-0700 I CONTROL  [initandlisten]     distmod: 2008plus-ssl
2019-04-19T21:12:16.561-0700 I CONTROL  [initandlisten]     distarch: x86_64
2019-04-19T21:12:16.562-0700 I CONTROL  [initandlisten]     target_arch: x86_64
2019-04-19T21:12:16.562-0700 I CONTROL  [initandlisten] options: {}
2019-04-19T21:12:16.566-0700 I STORAGE  [initandlisten] exception in initAndListen: NonExistentPath: Data directory C:\data\db\ not found., terminating
2019-04-19T21:12:16.569-0700 I CONTROL  [initandlisten] now exiting
2019-04-19T21:12:16.569-0700 I CONTROL  [initandlisten] shutting down with code:100

0 个答案:

没有答案