连接Econnrefuse 127.0.0.1:27017在MongoDB指南针中
我重新启动了计算机以尝试更新它,在重新启动之前,我还在研究另一个项目。现在,我带有node.js后端的项目给了我这个错误:
reason: TopologyDescription {
type: 'Single',
setName: null,
maxSetVersion: null,
maxElectionId: null,
servers: Map(1) {
'localhost:27017' => ServerDescription {
address: 'localhost:27017',
error: Error: connect ECONNREFUSED 127.0.0.1:27017
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1132:16) {
name: 'MongoNetworkError'
},
roundTripTime: -1,
lastUpdateTime: 58154302,
lastWriteDate: null,
opTime: null,
type: 'Unknown',
topologyVersion: undefined,
minWireVersion: 0,
maxWireVersion: 0,
hosts: [],
passives: [],
arbiters: [],
tags: []
}
},
stale: false,
compatible: true,
compatibilityError: null,
logicalSessionTimeoutMinutes: null,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
commonWireVersion: null
}
我的mongodb指南针给了我:Connect Econnrefuse 127.0.0.0.1:27017
。我的操作系统是Macos Big Sur。
在另一篇文章中,有人建议重新启动mongod
进程并再次连接。我尝试按照这些说明进行操作 mac-mongodb ,但是当我从新的终端转到'时,请发出以下内容:mongosh
'我的终端给我找不到
连接拒绝。命令:蒙古
。 I also tried testing it with PATH="/usr/local/opt/[email ; preected] /bin“ mongo mongodb shell版本v4.4.13
,我仍然有错误:无法连接到服务器127.0.0.1:27017,
,
有人知道如何解决这个问题吗?我真的很感谢任何帮助或建议。谢谢你!
I restarted my computer to try to update it, and before restarting, I was also working on another project. Now, my project with a node.js backend is giving me this error:
reason: TopologyDescription {
type: 'Single',
setName: null,
maxSetVersion: null,
maxElectionId: null,
servers: Map(1) {
'localhost:27017' => ServerDescription {
address: 'localhost:27017',
error: Error: connect ECONNREFUSED 127.0.0.1:27017
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1132:16) {
name: 'MongoNetworkError'
},
roundTripTime: -1,
lastUpdateTime: 58154302,
lastWriteDate: null,
opTime: null,
type: 'Unknown',
topologyVersion: undefined,
minWireVersion: 0,
maxWireVersion: 0,
hosts: [],
passives: [],
arbiters: [],
tags: []
}
},
stale: false,
compatible: true,
compatibilityError: null,
logicalSessionTimeoutMinutes: null,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
commonWireVersion: null
}
and my mongodb compass is giving me: connect ECONNREFUSED 127.0.0.1:27017
. My operating system is macOS Big Sur.
In another post someone suggested restarting the mongod
process and connecting again. I tried following those instructions mac-mongodb, but when I go to 'From a new terminal, issue the following: mongosh
' my terminal gave me command not found: mongosh
. I also tried testing it with PATH="/usr/local/opt/[email protected]/bin" mongo MongoDB shell version v4.4.13
and I still got Error: couldn't connect to server 127.0.0.1:27017,
with connection refused.
Does anyone know how to fix this? I would really appreciate any help or advice. Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
删除插座文件
重新启动mongoDB服务
Delete socket file
Restart mongodb service
重新启动MongoDB帮助了我:
Restarting mongodb helped me:
由于MongoDB服务器停止,可能会发生这种情况。要解决此问题,请转到任务管理器。在顶部栏中,单击服务。在设置文件中搜索mongoDB。如果状态被“停止”。给右键单击并开始运行服务器。它将再次起作用。要确认此操作,请打开CMD并键入
Mongosh
,您将获得连接结果。It may be happened due to the mongoDB server stopped. To resolve this, go to task manager. In the top bar, click Services. Search mongoDB in the set up files. If the status is "Stopped". Give a right click and start running the server. It will work again. For confirming this action, open the cmd and type
mongosh
and youll be getting the connection result.