Motor/pymongo连接超时与AWS DocumentDB
我使用Python的电机库连接到AWS DocumentDB(MongoDB)实例。电动机在幕后使用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")
)
我不知道这是怎么回事,因为这已经运行了这么长时间,但是突然之间,我甚至都不认为我不认为我对代码的这一部分进行了任何更改。
I have used Python's Motor library to connect to an AWS DocumentDB (MongoDB) instance. Motor uses PyMongo behind the scenes.
This was all working fine, but suddenly I have been getting a connection timeout anytime I attempt to do anything that requires a database operation:
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')>]>
This is how I am creating the connection, which has worked fine for weeks, but now gives this timeout error every time:
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")
)
I have no idea what is going wrong since this has been working fine for so long, but suddenly is not even thought I don't think I've made any changes to this part of the code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论