简体   繁体   中英

mongo is not connecting but installed and show version

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM