我来自riak和redis,在那里我从未有过这个服务启动或互动的问题。

这是蒙古人普遍存在的问题,我对此一无所知。重启也无济于事。我是蒙哥的新手。

mongo
MongoDB shell version: 2.2.1
connecting to: test
Fri Nov  9 16:44:06 Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:91
exception: connect failed

这是我在日志里看到的。

 now open)
Fri Nov  9 16:44:34 [conn47] end connection 10.29.16.208:5306 (1 connection now open)
Fri Nov  9 16:45:04 [initandlisten] connection accepted from 10.29.16.208:5307 #48 (2 connections now open)
Fri Nov  9 16:45:04 [conn48] end connection 10.29.16.208:5307 (1 connection now open)
Fri Nov  9 16:45:04 [initandlisten] connection accepted from 10.29.16.208:5308 #49 (2 connections now open)
Fri Nov  9 16:45:04 [conn49] end connection 10.29.16.208:5308 (1 connection now open)
Fri Nov  9 16:45:34 [initandlisten] connection accepted from 10.29.16.208:5316 #50 (2 connections now open)
Fri Nov  9 16:45:34 [conn50] end connection 10.29.16.208:5316 (1 connection now open)
Fri Nov  9 16:45:34 [initandlisten] connection accepted from 10.29.16.208:5317 #51 (2 connections now open)
Fri Nov  9 16:45:34 [conn51] end connection 10.29.16.208:5317 (1 connection now open)
Fri Nov  9 16:46:04 [initandlisten] connection accepted from 10.29.16.208:5320 #52 (2 connections now open)
Fri Nov  9 16:46:04 [conn52] end connection 10.29.16.208:5320 (1 connection now open)
Fri Nov  9 16:46:04 [initandlisten] connection accepted from 10.29.16.208:5321 #53 (2 connections now open)
Fri Nov  9 16:46:04 [conn53] end connection 10.29.16.208:5321 (1 conn

当前回答

对于我来说:

操作系统:CentOS 7

错误

> mongo
MongoDB shell version v4.4.2
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn’t connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 caused by Connection refused
connecct@src/mongo/shell/mongo.js 374 17
@(connect) 2 6
exception connect failed 
existing with code 1

原因

Mongod不跑 但如果运行mongod,将不会为没有访问权限的工作

解决方案

使用root命令运行mongod

sudo /data/mongodb/bin/mongod --config /data/mongodb/conf/mongodb.conf &

其他回答

如果mongo shell无法与mongod服务器通信,就会出现这个错误。

这可能是因为地址错误(主机或IP)或它没有运行。需要注意的一件事是,提供的日志跟踪不包括“星期五11月9日16:44:06”的mongo时间戳。

你能:

提供命令行参数(如果有)用于启动您的 mongod过程 提供mongod启动时的日志文件活动以及 mongo shell启动尝试期间的日志? 确认您的mongod进程正在同一节点上启动 机器就像芒果壳?

这工作我:-

以Mongodb 3.2为窗口,启动Mongodb服务。因此,以管理员身份运行命令提示符,然后net start MongoDB

如果以上方法都不奏效:进入service (start>search>services),启动mongodb服务。然后,在cmd提示符中,进入bin后,键入:/>mongo

你必须通过cmd访问你的src C: \ Program Files \ MongoDB \ Server \ 4.4 \ bin,然后你必须打开任务管理器->服务->(选择MongoDB) ->启动它,并通过cmd重新测试,它将得到解决。

Resolved. This problem could be solved by the below mentioned 4 steps 1) Remove .lock file sudo rm /var/lib/mongodb/mongod.lock 2) repair the mongodb mongod -–repair 3) start the mongod server sudo service mongod start 4) start the mongo client mongo For more details take a look at http://shakthydoss.com/error-couldnt-connect-to-server-127-0-0-127017-srcmongoshellmongo-js-exception-connect-failed/ http://shakthydoss.com/technical/error-couldnt-connect-to-server-127-0-0-127017-srcmongoshellmongo-js-exception-connect-failed/