Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mongodb shell mongo: Only one usage of each socket address (protocol/network address/port) is normally permitted. for socket: 0.0.0.0:27017

It was fine 2 days ago, Now mongod does not work. Even echo ps -A | grep mongo printed nothing, yet it warns about error: "Only one usage of each socket address". How to kill that? I have also tried with different random port. How can they fail as well?

D:\mongodb-win32-x86_64-2.2.3\bin>mongod
mongod --help for help and startup options
Sun Mar 03 18:10:03 [initandlisten] MongoDB starting : pid=6292 port=27017 dbpat
h=\data\db\ 64-bit host=Sadaf
Sun Mar 03 18:10:03 [initandlisten] db version v2.2.3, pdfile version 4.5
Sun Mar 03 18:10:03 [initandlisten] git version: f570771a5d8a3846eb7586eaffcf4c2
f4a96bf08
Sun Mar 03 18:10:03 [initandlisten] build info: windows sys.getwindowsversion(ma
jor=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB
_VERSION=1_49
Sun Mar 03 18:10:03 [initandlisten] options: {}
Sun Mar 03 18:10:03 [initandlisten] journal dir=/data/db/journal
Sun Mar 03 18:10:03 [initandlisten] recover : no journal files present, no recov
ery needed
Sun Mar 03 18:10:04 [initandlisten] ERROR: listen(): bind() failed errno:10048 O
nly one usage of each socket address (protocol/network address/port) is normally
 permitted. for socket: 0.0.0.0:27017
Sun Mar 03 18:10:04 [websvr] ERROR: listen(): bind() failed errno:10048 Only one
 usage of each socket address (protocol/network address/port) is normally permit
ted. for socket: 0.0.0.0:28017
Sun Mar 03 18:10:04 [initandlisten] now exiting
Sun Mar 03 18:10:04 dbexit:
Sun Mar 03 18:10:04 [initandlisten] shutdown: going to close listening sockets..
.
Sun Mar 03 18:10:04 [initandlisten] shutdown: going to flush diaglog...
Sun Mar 03 18:10:04 [initandlisten] shutdown: going to close sockets...
Sun Mar 03 18:10:04 [initandlisten] shutdown: waiting for fs preallocator...
Sun Mar 03 18:10:04 [initandlisten] shutdown: lock for final commit...
Sun Mar 03 18:10:04 [initandlisten] shutdown: final commit...
Sun Mar 03 18:10:04 [initandlisten] shutdown: closing all files...
Sun Mar 03 18:10:04 [initandlisten] closeAllFiles() finished
Sun Mar 03 18:10:04 [initandlisten] journalCleanup...
Sun Mar 03 18:10:04 [initandlisten] removeJournalFiles
Sun Mar 03 18:10:04 [initandlisten] shutdown: removing fs lock...
Sun Mar 03 18:10:04 dbexit: really exiting now

D:\mongodb-win32-x86_64-2.2.3\bin>echo ps -A | grep mongo

D:\mongodb-win32-x86_64-2.2.3\bin>
like image 570
sadaf2605 Avatar asked Mar 03 '13 12:03

sadaf2605


1 Answers

In the command prompt type the following command

netstat -a -n -o | find "27017"

This will list all processes which are using port "27017" along with the PID.

Locate the PID using "27017". For example if the PID is 10580, to kill it

taskkill /f /pid 10580

Now start mongo. Hope this helps.

like image 124
Ram Pratap Avatar answered Oct 02 '22 14:10

Ram Pratap