unable to start mongodb local server

Solution 1:

Try:

sudo service mongod stop
sudo mongod

To stop current active mongodb service, allowing you to then start a new one

Solution 2:

Don't kill the process using the -9 signal as it would cause damage: http://www.mongodb.org/display/DOCS/Starting+and+Stopping+Mongo#StartingandStoppingMongo-SendingaUnixINTorTERMsignal

Use sudo killall -15 mongod instead

Solution 3:

Andreas Jung:

"Sat Jun 25 09:38:51 [initandlisten] listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017

is self-speaking.

Another instance of mongod is already running and allocating the MongoDB default port which is 27017.

Either kill the other process or use a different port."

In this case, type the following command

ps wuax | grep mongo

You should see something that looks like this

User           31936   0.5 0.4 2719784 35624   ?? S     7:34pm   0:09.98 mongod
User           31945   0.0 0.0 2423368   184 s000 R+   8:24pm   0:00.00 grep mongo

Now enter the kill command for the mongod instance (31936 in this case):

kill 31936

Solution 4:

Sat Jun 25 09:38:51 [initandlisten] listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017

is self-speaking.

Another instance of mongod is already running and allocating the MongoDB default port which is 27017.

Either kill the other process or use a different port.

Solution 5:

Find out from netstat which process is running mongodb port (27017)

command:

sudo netstat -tulpn | grep :27017

Output will be:

tcp        0      0 0.0.0.0:27017           0.0.0.0:* 
LISTEN      6432/mongod

In my case "6432" is the pid, it may be different in your case. Then kill that process using following command:

sudo kill <pid>

Thats it!