1

I recently installed mongodb on a Centos Dedicated Server. When i try to start mongodb as a service it is give me the following error.

Starting mongod: [FAILED]

When i just execute mongod this is what i receive.

2014-10-27T03:54:46.184+0100 [initandlisten] MongoDB starting : pid=2566 port=27017 dbpath=/data/db 64-bit host=sv.redswitches.com
2014-10-27T03:54:46.184+0100 [initandlisten] db version v2.6.5
2014-10-27T03:54:46.184+0100 [initandlisten] git version: e99d4fcb4279c0279796f237aa92fe3b64560bf6
2014-10-27T03:54:46.184+0100 [initandlisten] build info: Linux build8.nj1.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2014-10-27T03:54:46.184+0100 [initandlisten] allocator: tcmalloc
2014-10-27T03:54:46.184+0100 [initandlisten] options: {}
2014-10-27T03:54:46.195+0100 [initandlisten] journal dir=/data/db/journal
2014-10-27T03:54:46.196+0100 [initandlisten] recover : no journal files present, no recovery needed
2014-10-27T03:54:46.233+0100 [initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
2014-10-27T03:54:46.233+0100 [initandlisten] ERROR:   addr already in use
2014-10-27T03:54:46.234+0100 [initandlisten] now exiting
2014-10-27T03:54:46.234+0100 [initandlisten] dbexit: 
2014-10-27T03:54:46.234+0100 [initandlisten] shutdown: going to close listening sockets...
2014-10-27T03:54:46.234+0100 [initandlisten] shutdown: going to flush diaglog...
2014-10-27T03:54:46.234+0100 [initandlisten] shutdown: going to close sockets...
2014-10-27T03:54:46.234+0100 [initandlisten] shutdown: waiting for fs preallocator...
2014-10-27T03:54:46.234+0100 [initandlisten] shutdown: lock for final commit...
2014-10-27T03:54:46.234+0100 [initandlisten] shutdown: final commit...
2014-10-27T03:54:46.244+0100 [initandlisten] shutdown: closing all files...
2014-10-27T03:54:46.244+0100 [initandlisten] closeAllFiles() finished
2014-10-27T03:54:46.244+0100 [initandlisten] journalCleanup...
2014-10-27T03:54:46.244+0100 [initandlisten] removeJournalFiles
2014-10-27T03:54:46.254+0100 [initandlisten] shutdown: removing fs lock...
2014-10-27T03:54:46.254+0100 [initandlisten] dbexit: really exiting now

I have already tried to re-install it twice still nothing. I also have cPanel installed on this server.

Gaurav Jagtap
  • 151
  • 1
  • 1
  • 12
  • Removing and installing the latest build solved the problem. Remove the current installation and use yum install -y mongodb-org to install the latest build. – Gaurav Jagtap Oct 27 '14 at 03:27

1 Answers1

1

Appears it is already running:

ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017 2014-10-27T03:54:46.233+0100 [initandlisten] ERROR: addr already in use

Another process is already using that port which is most likely another Mongo instance. Try running

mongo

from your command line prompt to see if you can connect using the MongoDB shell utility. Alternatively try

sudo netstat -tlnp | grep 27017

and see which process is using port 27017. On my system it's mongo:

tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN      25480/mongod    
Martin Konecny
  • 57,827
  • 19
  • 139
  • 159
  • Actually i just re-installed it again and installed the latest build yum install -y mongodb-org . Seems to have solved the problem. – Gaurav Jagtap Oct 27 '14 at 03:25