Pymongo keeps refusing the connection at 27017

前端 未结 9 716
灰色年华
灰色年华 2020-11-29 04:23

I am trying to run a simple connection to pymongo but it keeps returning that the connection was refused

Here is what I tried:

>>>from pymon         


        
相关标签:
9条回答
  • 2020-11-29 05:01

    Rather than deleting mongod.lock, I'd recommend running 'mongod --repair'. (I figure it's better to go in through the front door whenever possible. And there may be other things that this catches as well, AFAIK.)

    0 讨论(0)
  • 2020-11-29 05:02

    Just try following commands in given order :

    sudo rm /var/lib/mongodb/mongod.lock
    
    sudo mongod --repair
    
    sudo service mongodb start
    
    sudo service mongodb status
    

    That's it now you could see following as output of last command:

    mongodb start/running, process 2796

    0 讨论(0)
  • 2020-11-29 05:13

    It looks like you might not be running the MongoDB server. One thing that frequently trips me up is that if the server was shut down uncleanly, it will refuse to start up again until you remove the mongod.lock file from the data directory.

    0 讨论(0)
提交回复
热议问题