Pymongo Keeps Refusing the Connection at 27017

Pymongo keeps refusing the connection at 27017

Removing mongod.lock inside /var/lib/mongodb

sudo rm /var/lib/mongodb/mongod.lock

And then restarting the service should do it. For example, in my Ubuntu installation, restarting the server is something like this:

sudo service mongodb start

mongo - couldn't connect to server 127.0.0.1:27017

This error is what you would see if the mongo shell was not able to talk to the mongod server.

This could be because the address was wrong (host or IP) or that it was not running. One thing to note is the log trace provided does not cover the "Fri Nov 9 16:44:06" of your mongo timestamp.

Can you:

  1. Provide the command line arguments (if any) used to start your
    mongod process
  2. Provide the log file activity from the mongod startup as well as
    logs during the mongo shell startup attempt?
  3. Confirm that your mongod process is being started on the same
    machine as the mongo shell?

Django - MongoDB: (could not connect to localhost:27017) Connection refused

Did you setup MongoDB separately? The howto you link doesn't seem to go over the MongoDB configuration. It assumes the database is already running. In any case MongoDB seems down, or is at least listening somewhere else.

The last error ("...instance of int") is just because you specified '27017' (a string) instead of 27017 in the configuration dictionary. But even then it should be equivalent to the first, simpler configuration.

Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused

thank you everyone I tried running mongo it was not running finally I found there was no space in my hard disc I emptied some of the space and finally re installed it the same installation procedure as followed to install as given in mongodb docs finally restarted the server and it is running.

https://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu



Related Topics



Leave a reply



Submit