Upgrade to PyMongo 3.0 Resulting in ServerSelectionTimeoutError

别来无恙 提交于 2019-12-04 03:06:54
Josh

The fix for me was surprising; I entered this at the Bash prompt:

sudo /usr/sbin/setsebool -P httpd_can_network_connect 1
sudo service httpd restart

Credit to this answer. It turned out to be an Apache permissions issue.


Note: I'm running PyMongo 3.0, Python 2.6, and Mongo 2.4 on CentOS 6.6. I got a marginally different error, but it was in the same line of PyMongo. This was the end of my stack trace:

File "/usr/lib64/python2.6/site-packages/pymongo/topology.py", line 93, in select_servers
    self._error_message(selector))
ServerSelectionTimeoutError: localhost:27017: [Errno 13] Permission denied
tdc

It seems to be the same issue as in this question, and this bug. However I tried setting connect=False in the MongoClient() creation as suggested there to no avail. Currently the only solution that seems to work across the board is to downgrade to 2.8 (pip install pymongo==2.8)

Florian

I think this is a duplicate of this question.

The workaround to avoid triggering the bug works well (pass connect=False when creating instances of MongoClient). There will be a clearer warning in pymongo version 3.0.4. and hopefully a fix in the next versions.

Could this be related to this critical PyMomongo 3.0 bug when using mongos? If so, they pushed a fix on master branch (see this commit.)

wirerest8

EDITED:

Did you check your mongodb log file? I think that I had the same problem than you.

I found the following problem in /var/log/mongodb:

[initandlisten] exception in initAndListen: 15926 Insufficient free space for journals, terminating
It seems I have no enough free disk in my VM so my mongodb it wasn't running on my machine.

In the following post is the solution for this error: Why getting error mongod dead but subsys locked and Insufficient free space for journal files on Linux?

Now it seems that my problem was solved. Maybe you have the same error and you need to use smallfiles in order to work.

Best regards.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!