Errr 'mongo.js:L112 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:L112'

If you are running Ubuntu, then there is an issue with folder ownership. 

Run these commands:
  1. Stop the MongoDB service
    -------------------------------------------------------------------------------------------------------------------------------
    sudo service mongodb stop
    -------------------------------------------------------------------------------------------
  2. Remove the MongoDB lock file
    ------------------------------------------------------------------------------------------------------------------------------- 
    sudo rm /var/lib/mongodb/mongod.lock
    --------------------------------------------------------------------------------------------
  3. Change ownership from root to the MongoDB path
    ------------------------------------------------------------------------------------------------------------------------------- 
    sudo chown -R mongodb:mongodb /var/lib/mongodb/
    ---------------------------------------------------------------------------------------------
  4. Start the MongoDB service
    ------------------------------------------------------------------------------------------------------------------------------- 
    sudo service mongodb start
    ----------------------------------------------------------------------------------------------
  5. Test the mongo application
    ------------------------------------------------------------------------------------------------------------------------------- 
    mongo 
    ---------------------------------------------------------------------------------------------

No comments:

Post a Comment

Start and Stop ssh-agent

Below is the bash script used to start and stop ss-agent #!/bin/bash ## in .bash_profile SSHAGENT=`which ssh-agent` SSHAGENTARGS="...