【问题标题】:Motor/PyMongo connection timeout with AWS DocumentDBMotor/PyMongo 与 AWS DocumentDB 的连接超时
【发布时间】:2022-12-14 00:26:09
【问题描述】:

我使用 Python 的 Motor 库连接到 AWS DocumentDB (MongoDB) 实例。 Motor 在幕后使用 PyMongo。

这一切工作正常,但突然间,每当我尝试做任何需要数据库操作的事情时,我都会遇到连接超时:

pymongo.errors.ServerSelectionTimeoutError: aws-documentdb-endpoint:27017: timed out, Timeout: 30s, Topology Description: <TopologyDescription id: 628376f4a53a913de7752368, topology_type: Single, servers: [<ServerDescription ('aws-documentdb-endpoint', 27017) server_type: Unknown, rtt: None, error=NetworkTimeout('aws-documentdb-endpoint:27017: timed out')>]>

这就是我创建连接的方式,它已经运行了数周,但现在每次都会出现此超时错误:

from motor.motor_asyncio import AsyncIOMotorClient

client = AsyncIOMotorClient(
    host=os.environ["MONGO_URI"], 
    ssl=True, 
    ssl_cert_reqs=ssl.CERT_NONE, 
    ssl_ca_certs=os.path.join(os.environ["ROOT_DIR"], "cert", "aws", "rds-combined-ca-bundle.pem")
)

我不知道出了什么问题,因为这已经运行了很长时间,但突然间我什至没有想到我认为我没有对这部分代码进行任何更改。

【问题讨论】:

  • 这是网络问题,检查基础设施,而不是代码。有些东西已经改变/过期了。

标签: mongodb amazon-web-services pymongo aws-documentdb tornado-motor


【解决方案1】:

你有解决办法吗? 亲切的问候。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-05-01
    • 2021-02-21
    • 2022-06-27
    • 2022-01-10
    • 2021-02-14
    • 2020-11-14
    • 2017-05-23
    相关资源
    最近更新 更多