Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replicaSet集群配置一直不通 #41

Closed
airclear opened this issue Jun 10, 2020 · 5 comments
Closed

replicaSet集群配置一直不通 #41

airclear opened this issue Jun 10, 2020 · 5 comments
Labels
bug Something isn't working

Comments

@airclear
Copy link

我们mongodb集群使用的是replicaSet的方式,使用镜像1.9.2运行,一直卡在“等待mongodb可用“步骤

容器打印日志如下:

启动引导服务...
写入配置...
{
  "plugins": [
    {
      "name": "add-user",
      "options": {}
    }
  ],
  "adminAccount": "**",
  "adminPassword": "**",
  "closeRegister": false,
  "port": 3000,
  "db": {
    "DATABASE": "yapi",
    "user": "**",
    "pass": "**",
    "connectString": "mongodb://**:**@mongo-cluster1-rs0.psmdb.svc.cluster.local:27017/yapi?replicaSet=rs0&ssl=false",
    "options": {
      "replset": {
        "rs_name": "rs0"
      }
    }
  },
  "mail": {
    "enable": false,
    "auth": {}
  },
  "ldapLogin": {
    "enable": false
  }
}
等待 MongoDB 服务可用...
@fjc0k
Copy link
Owner

fjc0k commented Jun 10, 2020

明了,在提供了 connectString 时应跳过 MongoDB 检测。

@fjc0k fjc0k added the bug Something isn't working label Jun 10, 2020
@fjc0k fjc0k closed this as completed in 201fc28 Jun 10, 2020
@fjc0k
Copy link
Owner

fjc0k commented Jun 10, 2020

等待 ci 构建镜像。

@fjc0k
Copy link
Owner

fjc0k commented Jun 10, 2020

好了,重新拉取镜像再试。

@airclear
Copy link
Author

新问题。。 @fjc0k

启动引导服务...
写入配置...
{
  "plugins": [
    {
      "name": "add-user",
      "options": {}
    }
  ],
  "adminAccount": "**",
  "adminPassword": "**",
  "closeRegister": false,
  "port": 3000,
  "db": {
    "DATABASE": "yapi",
    "user": "**",
    "pass": "**",
    "connectString": "mongodb+srv://**:**@mongo-cluster1-rs0.psmdb.svc.cluster.local/yapi?replicaSet=rs0&ssl=false&slaveOk=true"
  },
  "mail": {
    "enable": false,
    "auth": {}
  },
  "ldapLogin": {
    "enable": false
  }
}
等待 MongoDB 服务可用...
安装 YApi 插件...
尝试安装 YApi...
+ node '--unhandled-rejections=strict' /yapi/vendors/server/install.js


/yapi/vendors/node_modules/mongoose/lib/error/validation.js:31
    Error.captureStackTrace(this);
          ^

Error [ValidationError]: user validation failed: username: Path `username` is required.
    at ValidationError.inspect (/yapi/vendors/node_modules/mongoose/lib/error/validation.js:61:24)
    at formatValue (internal/util/inspect.js:703:31)
    at inspect (internal/util/inspect.js:272:10)
    at afterInspector (internal/errors.js:681:14)
    at processPromiseRejections (internal/process/promises.js:194:9)
    at processTicksAndRejections (internal/process/task_queues.js:98:32) {
  errors: {
    username: MongooseError [ValidatorError]: Path `username` is required.
        at new ValidatorError (/yapi/vendors/node_modules/mongoose/lib/error/validator.js:29:11)
        at validate (/yapi/vendors/node_modules/mongoose/lib/schematype.js:1055:13)
        at /yapi/vendors/node_modules/mongoose/lib/schematype.js:1109:11
        at Array.forEach (<anonymous>)
        at SchemaString.SchemaType.doValidate (/yapi/vendors/node_modules/mongoose/lib/schematype.js:1064:14)
        at /yapi/vendors/node_modules/mongoose/lib/document.js:2190:9
        at processTicksAndRejections (internal/process/task_queues.js:79:11) {
      properties: [Object],
      kind: 'required',
      path: 'username',
      value: '',
      reason: undefined,
      [Symbol(mongoose:validatorError)]: true
    }
  },
  _message: 'user validation failed'
}

关闭引导服务...
尝试启动 YApi...
log: -------------------------------------swaggerSyncUtils constructor-----------------------------------------------
log: 服务已启动,请打开下面链接访问: 
http://127.0.0.1:3000/
log: mongodb load success...

@abeelan
Copy link

abeelan commented Aug 26, 2021

登入账号设置为邮箱格式,就可以通过 db 的校验了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants