2
votes

i have following step.

              sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
              sudo gedit /etc/apt/sources.list
              deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
              sudo apt-get install mongodb-10gen

when i run command mongo --version result was MongoDB shell version: 2.4.9 then at command

            sudo start mongodb

result mongodb start/running, process 5808 at command
sudo stop mongodb

result was stop: Unknown instance: at command

           mongo

result was .MongoDB shell version: 2.4.9 connecting to: test Sun Mar 2 18:57:50.050 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145 exception: connect failed again on command

           sudo service mongodb restart

stop: Unknown instance: mongodb start/running, process 5873

           mongo 

MongoDB shell version: 2.4.9 connecting to: test Sun Mar 2 18:57:50.050 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145 exception: connect failed

1

1 Answers

1
votes

Did you try to remove .lock file from /var/lib/mongodb/ ? sudo rm /var/lib/mongodb/mongod.lock sudo service mongodb restart

Also you can try: sudo -u mongodb mongod --repair --dbpath /var/lib/mongodb/ and then start mongo again.

Hope this helps