In Katello installer, we start mongodb and then execute pulp-migrate. On some machines, maybe thanks to systemd, mongodb starts very fast, but TCP socket is not ready. So our Puppet fails with pymongo.errors.AutoReconnect: could not connect to localhost:27017: [Errno 111] Connection refused We would like to have a new option that would force pulp-migrate to wait until connection is estabilished. Something like (pseudo code): # the db connection and auditing need to be initialied before any further # imports since the imports execute initialization code relying on the # db/auditing to be setup retry = 10 while retry > 0: try: connection.initialize() except pymongo.errors.AutoReconnect: if retry == 1: raise print "Waiting for connection..." time.sleep(2) retry = retry - 1 But nicer ;-) Thanks!
Oh I just noticed when mongo starts for the first time, it is preallocating some big data file. That is the reason why it takes so long. Maybe we wont need the patch in pulp, I just need to find a way to let mongo allocate it using a manual command or something. Will ask on the list.
This is just a me-too entry to say that I've seen this after installing pulp (today) and trying to set it up: # service pulp-server init Starting mongod: [ OK ] Traceback (most recent call last): File "/usr/bin/pulp-migrate", line 19, in <module> from pulp.server.db.migrate import script File "/usr/lib/python2.6/site-packages/pulp/server/db/migrate/script.py", line 26, in <module> connection.initialize() File "/usr/lib/python2.6/site-packages/pulp/server/db/connection.py", line 47, in initialize _connection = pymongo.Connection(seeds) File "/usr/lib64/python2.6/site-packages/pymongo/connection.py", line 381, in __init__ self.__find_node() File "/usr/lib64/python2.6/site-packages/pymongo/connection.py", line 659, in __find_node raise AutoReconnect(', '.join(errors)) pymongo.errors.AutoReconnect: could not connect to localhost:27017: [Errno 111] Connection refused Run it again after checking that something was now listening on port 27017 using netstat -an and it works: # service pulp-server init removing persisted tasks database migration to version 41 complete
@Shane - I have found MongoDB 1.8+ can preallocate journals (3 gigs) during the first startup. You can do this manually using dd command, search mongo wiki.
In 2.x, pulp-server has been removed entirely. The replacement for pulp-migrate, now called pulp-manage-db, no longer attempts to start mongo. Starting the necessary servers is a prerequisite of running that script, thereby removing this issue. Closing this as "WONTFIX" as it was aligned to 1.2 and will not be changed there.