开发者社区> 问答> 正文

python连接mongodb报错

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左右.不知道大家遇到过类似问题吗?

展开
收起
蛮大人123 2016-06-14 18:25:05 4640 0
1 条回答
写回答
取消 提交回答
  • 我说我不帅他们就打我,还说我虚伪

    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).

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

    2019-07-17 19:38:30
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
MongoDB多数据中心的方案选型之路 立即下载
阿里云MongoDB云服务构建 立即下载
饿了么高级架构师陈东明:MongoDB是如何逐步提高可靠性的 立即下载