0

While starting the Mongodb I got this error is socket connection:

7 12:03:31.230 [initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 127.0.0.1:27017
Tue Apr  7 12:03:31.230 [initandlisten] ERROR:   addr already in use
Tue Apr  7 12:03:31.252 [websvr] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 127.0.0.1:28017
Tue Apr  7 12:03:31.253 [websvr] ERROR:   addr already in use
0

I met the same problem today, sudo service mongod restart or sudo service mongod stop does not really stop mongod process. I follow below steps solved the problem:

  1. Find mongod process id (414)

    $ sudo netstat -tlnp | grep 27017
    tcp        0      0 127.0.0.1:27017             0.0.0.0:*                   LISTEN      414/mongod
    
  2. Kill mongod

    sudo kill -9 414
    
  3. Start mongod

    sudo service mongod start
    
0

This likely means that another instance of mongodb is already running. You can use the following command to restart it:

sudo service mongod restart

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.