Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.(5)

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

ITtutoria

ITtutoria Logo ITtutoria Logo

ITtutoria Navigation

  • Python
  • Java
  • Reactjs
  • JavaScript
  • R
  • PySpark
  • MYSQL
  • Pandas
  • QA
  • C++
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Python
  • Science
  • Java
  • JavaScript
  • Reactjs
  • Nodejs
  • Tools
  • QA
Home/ Questions/How can I handle - failed to set up listener: SocketException: address already in use?
Next
Answered
Chloë Gallet
  • 5
Chloë Gallet
Asked: May 17, 20222022-05-17T12:53:28+00:00 2022-05-17T12:53:28+00:00In: Programs

How can I handle – failed to set up listener: SocketException: address already in use?

  • 5

. 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!

socketexception
  • 2 2 Answers
  • 48 Views
  • 0 Followers
  • 0
Answer
Share
  • Facebook
  • Report

2 Answers

  • Voted
  • Oldest
  • Recent
  • Random
  1. Best Answer
    dttutoria Expert
    2022-06-04T10:59:07+00:00Added an answer on June 4, 2022 at 10:59 am

    The cause:

    The error Failed to set up listener: SocketException: Address already in use may be for the reasons:

    • You have run mongodb
    • You use default port 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.

    • 5
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  2. Zoé Laporte
    2022-05-25T19:57:40+00:00Added an answer on May 25, 2022 at 7:57 pm

    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.

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

    Search for mongod COMAND, its ID and type.

    sudo kill <mongo_command_pid>

    Start your mongod instance now by typing.

    mongod

    MongoDB is running smoothly.

    • 5
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question
  • How to Split String by space in C++
  • How To Convert A Pandas DataFrame Column To A List
  • How to Replace Multiple Characters in A String in Python?
  • How To Remove Special Characters From String Python

Explore

  • Home
  • Tutorial

Footer

ITtutoria

ITtutoria

This website is user friendly and will facilitate transferring knowledge. It would be useful for a self-initiated learning process.

@ ITTutoria Co Ltd.

Tutorial

  • Home
  • Python
  • Science
  • Java
  • JavaScript
  • Reactjs
  • Nodejs
  • Tools
  • QA

Legal Stuff

  • About Us
  • Terms of Use
  • Privacy Policy
  • Contact Us

DMCA.com Protection Status

Help

  • Knowledge Base
  • Support

Follow

© 2022 Ittutoria. All Rights Reserved.

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.