eggjs / egg

🥚 Born to build better enterprise frameworks and apps with Node.js & Koa

Home Page:https://eggjs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

我使用的egg-mongoose出现了disconnect情况

johnsmithsren opened this issue · comments

commented

不是bug!只是对此有点疑惑,希望有人能够帮助一下,不清楚是哪里配置有问题。

  1. 一开始链接 egg-mongoose 是正常的,但是经过了一两天之后,就会偶尔出现 disconnect 报错

[egg-mongoose] mongodb://xxxxxx disconnected
53863 has failed with connection to xxxxx timed out

config.mongoose = {
client: {

  url: 'mongodb://xxxxxxxx?authSource=admin&compressors=zlib',
  options: {
    useUnifiedTopology: true,
    useNewUrlParser: true,
  },
},

};

我的配置大概是这样,除了disconnect报错,也没有其他信息了,我不清楚是配置方面出了什么问题导致的,之前的版本一直没什么异常

Reproduction Repo

null

Node Version

16.19.1

Eggjs Version

3.12.0

Plugin Name and its version

"egg-mongoose": "^3.3.1"

Platform and its version

ubuntu

应该是当时MongoDB驱动库跟MongoDB数据库节点的心跳检测不通,MongoDB驱动库触发了disconnected,建议检查下当时是否网络有问题。useUnifiedTopology参数为true,所以mongoose会开启心跳检测