. Advertisement .
..3..
. Advertisement .
..4..
How to solve the problem – failed to set up listener: SocketException: address already in use? I have the sample detail:
Agungs-MacBook-Pro:~ agungmahaputra$ mongod
2017-12-26T15:31:15.911+0700 I CONTROL [initandlisten] MongoDB starting : pid=5189 port=27017 dbpath=/data/db 64-bit host=Agungs-MacBook-Pro.local
2017-12-26T15:31:15.911+0700 I CONTROL [initandlisten] db version v3.6.0
2017-12-26T15:31:15.911+0700 I CONTROL [initandlisten] git version: a57d8e71e6998a2d0afde7edc11bd23e5661c915
2017-12-26T15:31:15.911+0700 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2n 7 Dec 2017
2017-12-26T15:31:15.911+0700 I CONTROL [initandlisten] allocator: system
2017-12-26T15:31:15.911+0700 I CONTROL [initandlisten] modules: none
2017-12-26T15:31:15.911+0700 I CONTROL [initandlisten] build environment:
2017-12-26T15:31:15.911+0700 I CONTROL [initandlisten] distarch: x86_64
2017-12-26T15:31:15.911+0700 I CONTROL [initandlisten] target_arch: x86_64
2017-12-26T15:31:15.911+0700 I CONTROL [initandlisten] options: {}
2017-12-26T15:31:15.911+0700 E STORAGE [initandlisten] Failed to set up listener: SocketException: Address already in use
2017-12-26T15:31:15.911+0700 I CONTROL [initandlisten] now exiting
2017-12-26T15:31:15.911+0700 I CONTROL [initandlisten] shutting down with code:48
Agungs-MacBook-Pro:~ agungmahaputra$
While I was running it, I found the warning message:
SocketException: Address already in use MONGODB
That is my question in my midterm exam, and it is urgent. I searched the solutions for some websites, but I didn’t get it. I may miss any line or other changes. I appreciate your assistance!
The cause:
The error
Failed to set up listener: SocketException: Address already in use
may be for the reasons:27017
Solution:
It already has a process running on port 27017, which
mongodb
uses. So you’ll have to either terminate the process in that port or attempt another port number.Use
mongod —port 27018
to test it out.You have the option of changing the port number.
You can delete the mongod inactive instance and create a new one.
First, type in the following to find a list all tasks currently running on your computer.
Search for mongod COMAND, its ID and type.
Start your mongod instance now by typing.
MongoDB is running smoothly.