Wednesday 18 June 2014

MongoDB- Address already in use for socket

Open Terminal and run the following command:
sudo mongod


The following error in the port being used is thrown
[websvr] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:28017
[initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
[websvr] ERROR:   addr already in use
[initandlisten] ERROR:   addr already in use
[initandlisten] now exiting
dbexit:
[initandlisten] shutdown: going to close listening sockets...
[initandlisten] shutdown: going to flush diaglog...
[initandlisten] shutdown: going to close sockets...
[initandlisten] shutdown: waiting for fs preallocator...
[initandlisten] shutdown: closing all files...
[initandlisten] closeAllFiles() finished
[initandlisten] shutdown: removing fs lock...
dbexit: really exiting now
Run the following command to check the mongo processes/
ps -eF | grep 'mongo\|PID'

UID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD
mongodb    1024     1  0 24077 13052   1 19:09 ?        00:00:05 /usr/bin/mongod --config /etc/mongodb.conf
 
1000      2814  2752  0   832   884   0 19:33 pts/1    00:00:00 grep --color=auto mongo\|PID
 
 
the problem is with the process with id 1024 , use the following command
___________________________________________________
sudo kill 1024
 ___________________________________________________
Try running mongodb again with the following commabd.

sudo mongod
[initandlisten] MongoDB starting...
[websvr] admin web console waiting for connections on port 28017
[initandlisten] waiting for connections on port 27017

2 comments: