Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (47.6k points)

I found this error when trying to run mongodb. I install it via homebrew. Please assist

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$

2 Answers

0 votes
by (106k points)

To solve this exception you already have a process running in the port 27017 which is used by mongodb. So either you need to stop the process in that port or try with a different port number.

You should try:  mongod --port 27018

You can change the port number of your choice.

by (100 points)
Tried this but didn't work for me, what other option do I have?
0 votes
by (108k points)

The first thing that you have to do is destroy the previous mongod instance and start the new one. To remove the previous mongod instance, first search for a file of tasks running on your machine by typing:

sudo lsof -iTCP -sTCP:LISTEN -n -P

Search for mongod COMMAND and its PID and type the following command:

sudo kill <mongo_command_pid>

Now just start your mongod instance by typing the following:

mongod

by (100 points)
Also tried this, didn't work on my side. What other options do I have?
by (100 points)
Finally!! I'm searching it for a long time. Thanks

Related questions

0 votes
1 answer
0 votes
2 answers
asked Oct 16, 2019 in Web Technology by Sammy (47.6k points)
0 votes
2 answers
0 votes
1 answer
0 votes
1 answer
asked Oct 18, 2019 in Web Technology by Sammy (47.6k points)

Browse Categories

...