python连接mongodb报错

发布于 2022-09-01 23:54:47 字数 338 浏览 11 评论 0

File "/home/test/publish/virtualenvs/pyv_honey_manage/lib/python2.7/site-packages/pymongo/mongo_client.py", line 1138, in _send_message
    raise AutoReconnect(str(e))
AutoReconnect: [Errno 104] Connection reset by peer

---

centos:6.5
python:2.7.8
pymongo:2.8

服务端监控看mongo客户端连接数才300左右.不知道大家遇到过类似问题吗?真的谢谢啦

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

装迷糊 2022-09-08 23:54:47

exception pymongo.errors.AutoReconnect(message='', errors=None)¶
Raised when a connection to the database is lost and an attempt to auto-reconnect will be made.

In order to auto-reconnect you must handle this exception, recognizing that the operation which caused it has not necessarily succeeded. Future operations will attempt to open a new connection to the database (and will continue to raise this exception until the first successful connection is made).

连接丢失需要重连时将抛出这个错误,文档中说明了,必须要手动处理这个错误.比较好的处理

处理方式

https://gist.github.com/anthonywu/1696591

森林迷了鹿 2022-09-08 23:54:47

更新下 pymongo 到最新,试试

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文