0

I have debian os installed on my computer.

Distributor ID: Debian
Description:    Debian GNU/Linux 8.1 (jessie)
Release:    8.1
Codename:   jessie

I have followed this toturial to Install MongoDB on Debian install mongo db on my computer.

Mongodb version:

mongo --version
MongoDB shell version: 2.6.9

Now when I run mongo command to terminal, It says

mongo
MongoDB shell version: 2.6.9
connecting to: test
2015-08-08T06:29:50.480-0500 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2015-08-08T06:29:50.481-0500 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed

And running this command show below error

sudo service mongodb restart
Failed to restart mongodb.service: Unit mongodb.service failed to load: No such file or directory.

Any ideas on why this is happening and how to fix it?

Gagan
  • 573
  • 8
  • 25
  • 1
    The `mongod` daemon is clearly not running. Check your service configuration. It is either called `mongodb` (which it seems not to be) or `mongod`. Then check the configuration files as referenced in the service script for locations of data and logs to see any errors presented. – Blakes Seven Aug 08 '15 at 11:54

1 Answers1

3

Just met a similar problem on a Debian Jessie.

For me, the following error on startup

Failed to restart mongodb.service: Unit mongodb.service

was due to an previous mongodb installation that replaced /lib/systemd/system/mongodb.service with a symlink to /dev/null. Check it with ls -l.

Otherwise, your problem can be due to limited space storage, bad permissions folders or bad journal configuration file size. Try running the server process manually with

/usr/bin/mongod start

and have a look on standard output. Usually explicit errors appear this way.

bench
  • 194
  • 2
  • 8