简体   繁体   English

通过对等方重置MongoDB连接

[英]MongoDB connection reset by peer

I've looked at other solutions to this, such as: 我已经看过其他解决方案,例如:

But still have this error. 但是仍然有这个错误。 I'm trying to load a large GeoJSON file into MongoDB. 我正在尝试将较大的GeoJSON文件加载到MongoDB中。

Here's my code: https://gist.github.com/mittenchops/6499844 这是我的代码: https : //gist.github.com/mittenchops/6499844

using the iterative json parser here: https://github.com/isagalaev/ijson 在此处使用迭代json解析器: https//github.com/isagalaev/ijson

Here is my error: 这是我的错误:

Traceback (most recent call last):
  File "upload2mongo.py", line 57, in <module>
    main(sys.argv)
  File "upload2mongo.py", line 52, in main
    loader(renamesh2json(argv[1]), argv[2])
  File "upload2mongo.py", line 22, in loader
    db[collection].insert(d)
  File "/usr/local/lib/python2.7/dist-packages/pymongo/collection.py", line 359, in insert
    continue_on_error, self.__uuid_subtype), safe)
  File "/usr/local/lib/python2.7/dist-packages/pymongo/mongo_client.py", line 853, in _send_message
    raise AutoReconnect(str(e))
pymongo.errors.AutoReconnect: [Errno 104] Connection reset by peer

Why am I receiving this strange error about my connection shutting down? 为什么我收到有关连接关闭的奇怪错误?

Not sure if this is an answer or even makes sense, but I added one more loop in my insert sequence, and that corrected the problem. 不知道这是否是一个答案甚至是没有道理的,但是我在插入序列中又添加了一个循环,从而解决了该问题。 It seems that the original object I thought I was inserting was actually a list of documents instead of document-level, and this was implicitly batch-inserted---when I thought I was actually inserting one document at a time, I thought I was already looping at the document level. 似乎我以为我要插入的原始对象实际上是文档列表,而不是文档级别的文档,并且这是隐式批量插入的-当我以为我实际上一次插入一个文档时,我以为是已经在文档级别循环。

It appears that over the course of the batch insert, the connection closed. 似乎在批处理插入过程中,连接已关闭。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM