在Micronaut中连接到AWS documentDB

问题描述

我正在尝试将Micronaut应用程序连接到AWS DocumentDB上的MongoDB实例,这需要在连接字符串上设置某些参数(mongodb:// user:pass @ host:port /?ssl = true&ssl_ca_certs = rds-组合ca.bundle.pem&replicaSet = rs0&readPreference = secondaryPreferred&retryWrites = false)。

我查看了此文档https://micronaut-projects.github.io/micronaut-mongodb/1.0.4/guide/configurationreference.html,并决定尝试使用当前配置:

mongodb:
  uri: "mongodb://${DB_USER:user}:${DB_PASS:pass}@${DB_HOST:host}:${DB_PORT:port}"
  options:
    ssl-enabled: true
    read-preference: "secondaryPreferred"
    required-replica-set-name: "rs0"
    retry-writes: false

当我尝试从应该连接到该Mongo实例的服务中调用端点时,这会导致以下错误消息:

{
    "message": "Internal Server Error: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN,servers=[{address=host:port,type=UNKNOWN,state=CONNECTING,exception={com.mongodb.MongoSocketReadTimeoutException: Timeout while receiving message},caused by {java.nio.channels.InterruptedByTimeoutException}}]"
}

这使我相信该配置未正确应用。另外,我应该在配置中添加SSL证书“ rds-combined-ca-bundle.pem”,但是没有找到与此相关的任何内容。

如何修复连接以使其正常工作?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...