gpt4 book ai didi

mongodb - 带有 spring 引导的 AWS DocumentDB 失败错误 : No server chosen by com. mongodb.client.internal.MongoClientDelegate

转载 作者:行者123 更新时间:2023-12-05 06:59:35 25 4
gpt4 key购买 nike

我的应用程序是用 spring boot 编写的,可以在 self 管理的 MongoDB 服务器上正常工作。现在,我正在尝试将同一个 spring boot 应用程序与 AWS DocumentDB 连接起来。我启动了一个 documentDB 集群并使用以下配置与 spring-boot 连接。

spring.data.mongodb.uri=mongodb://<user>:<password>@<my-cluster-endpoint>:27017/?replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false
spring.data.mongodb.database=mydb

我已禁用 TLS,它在集群详细信息中显示 TLS Enabled: No。我正在 EC2 实例中部署我的 spring boot 应用程序,该实例与 documentdb 在同一 vpc 中运行,我已经对其进行了交叉检查。运行我的应用程序时出现以下错误。

No server chosen by com.mongodb.client.internal.MongoClientDelegate$1@51a81d99 from cluster description ClusterDescription{type=REPLICA_SET, connectionMode=MULTIPLE, serverDescriptions=[ServerDescription{address=:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadTimeoutException: Timeout while receiving message}, caused by {java.net.SocketTimeoutException: Read timed out}}]}. Waiting for 30000 ms before timing out

我没有找到在 spring-boot 中使用 documentdb 的好资源。知道如何找到确切原因吗?

最佳答案

您可以尝试重新启用 tls,但在命令行中使用 -Djdk.tls.client.protocols=TLSv1.2 来降级 tls 版本。

或者尝试升级Java版本。

关于mongodb - 带有 spring 引导的 AWS DocumentDB 失败错误 : No server chosen by com. mongodb.client.internal.MongoClientDelegate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64373280/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com