连接Econnrefuse 127.0.0.1:27017在MongoDB指南针中

发布于 2025-02-03 04:12:01 字数 1793 浏览 1 评论 0原文

我重新启动了计算机以尝试更新它,在重新启动之前,我还在研究另一个项目。现在,我带有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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

冰火雁神 2025-02-10 04:12:01

删除插座文件

sudo rm -rf /tmp/mongodb-27017.sock

重新启动mongoDB服务

sudo service mongod restart
mongosh

Delete socket file

sudo rm -rf /tmp/mongodb-27017.sock

Restart mongodb service

sudo service mongod restart
mongosh
2025-02-10 04:12:01

重新启动MongoDB帮助了我:

brew services stop [email protected]
brew services start [email protected]

Restarting mongodb helped me:

brew services stop [email protected]
brew services start [email protected]
空袭的梦i 2025-02-10 04:12:01

由于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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文