andrade
andrade

Reputation: 143

Mongodb wont start: addr already in use

when I try to start my database, mongodb is logging the following messages:

2014-08-12T08:42:17.522-0300 [initandlisten] journal dir=/www/mongodb/data/journal
2014-08-12T08:42:17.523-0300 [initandlisten] recover : no journal files present, no    recovery needed
2014-08-12T08:42:17.564-0300 [initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
2014-08-12T08:42:17.564-0300 [initandlisten] ERROR:   addr already in use
2014-08-12T08:42:17.567-0300 [initandlisten] now exiting
2014-08-12T08:42:17.567-0300 [initandlisten] dbexit:
2014-08-12T08:42:17.567-0300 [initandlisten] shutdown: going to close listening sockets...

And it wont start. But then I run the next command nothing is returned:

sudo netstat -ltnp | grep 27017

The server was manually shutdown (db.shutdownServer()) and it is a part of a replica set.
I noticed that the mongod.lock is created in the process, but removing it doesnt solve the problem.

So i guess the error message isnt quite right.
I'm using MongoDB shell version: 2.6.1

Anyone knows what could be the problem?

Upvotes: 1

Views: 917

Answers (1)

Vika Baheryan
Vika Baheryan

Reputation: 21

I had same issue. In my config file in bindIp I had 2 ports specified, and for some reason mongo tried to run both of them simultaneously. Leave only one and make sure it is in etc/hosts.

Upvotes: 2

Related Questions