我已经制作了一个 React 和 NextJS 应用程序一个月了,我使用 MongoDB 作为数据库。我通过 MongoDB Atlas 使用它。它也只是免费版本。
我使用 NextJS 的 api 文件夹作为后端。
我完全没有遇到任何问题,一切正常。突然间我开始出现这些错误:
error - MongoNetworkError: connect ETIMEDOUT 18.166.253.100:27017
at connectionFailureError (C:\Users\asus\Desktop\mymart-seller\node_modules\mongodb\lib\cmap\connect.js:383:20)
at TLSSocket.<anonymous> (C:\Users\asus\Desktop\mymart-seller\node_modules\mongodb\lib\cmap\connect.js:307:22)
at Object.onceWrapper (node:events:628:26)
at TLSSocket.emit (node:events:513:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
cause: Error: connect ETIMEDOUT 18.166.253.100:27017
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16) {
errno: -4039,
code: 'ETIMEDOUT',
syscall: 'connect',
address: '18.166.253.100',
port: 27017
},
connectionGeneration: 0,
page: '/64374cbc7f69b08c1cd4e68c/categories/Category/product%201',
[Symbol(errorLabels)]: Set(1) { 'ResetPool' }
还有这个:
error - MongoServerSelectionError: connect ETIMEDOUT 18.166.253.100:27017
at Timeout._onTimeout (C:\Users\asus\Desktop\mymart-seller\node_modules\mongodb\lib\sdam\topology.js:277:38)
at listOnTimeout (node:internal/timers:569:17)
at process.processTimers (node:internal/timers:512:7) {
reason: TopologyDescription {
type: 'ReplicaSetNoPrimary',
servers: Map(3) {
'ac-rtwqyt0-shard-00-01.cln6x4h.mongodb.net:27017' => [ServerDescription],
'ac-rtwqyt0-shard-00-02.cln6x4h.mongodb.net:27017' => [ServerDescription],
'ac-rtwqyt0-shard-00-00.cln6x4h.mongodb.net:27017' => [ServerDescription]
},
stale: false,
compatible: true,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
setName: 'atlas-hup2a6-shard-0',
maxElectionId: null,
maxSetVersion: null,
commonWireVersion: 0,
logicalSessionTimeoutMinutes: 30
},
code: undefined,
page: '/api/new-variation',
[Symbol(errorLabels)]: Set(0) {}
}
我不认为问题出在我的代码以及它如何接收数据,因为即使是来自 React 和 NextJs 课程的旧项目也开始遇到这个问题。
我也没有使用 vpn 或其他东西来更改我的 IP 地址。
有人知道这是什么原因吗?是否有我需要修复的可能已更改的设置或选项?
MongoDB目前是在维护还是满了? 任何帮助将不胜感激。随时提出任何问题。
谢谢!
我找到了解决问题的方法。 我的 MongoDB 正在运行,但速度非常慢。
这是免费套餐。 事实证明,许多人共享免费套餐。这意味着如果您碰巧所在的集群中的其他人疯狂地过度使用它,它也会影响您。 我在不同的地区创建了一个新帐户和新数据库,这对我帮助很大。