4

I am start working with mongoDB recent and get this issue again and again. I think i miss something but not get exactly where is the issue.I am working on a latest mongo db version 4.0.1.

iron@iron-System-Product-Name:/media/iron/1d6c195f-2350-423c-a3f0-0500c92e580a/codesnippets$ sudo mongod --dbpath db
2018-08-24T09:30:26.351+0530 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2018-08-24T09:30:26.354+0530 I CONTROL  [initandlisten] MongoDB starting : pid=5994 port=27017 dbpath=db 64-bit host=iron-System-Product-Name
2018-08-24T09:30:26.354+0530 I CONTROL  [initandlisten] db version v4.0.1
2018-08-24T09:30:26.354+0530 I CONTROL  [initandlisten] git version: 54f1582fc6eb01de4d4c42f26fc133e623f065fb
2018-08-24T09:30:26.354+0530 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2018-08-24T09:30:26.354+0530 I CONTROL  [initandlisten] allocator: tcmalloc
2018-08-24T09:30:26.354+0530 I CONTROL  [initandlisten] modules: none
2018-08-24T09:30:26.354+0530 I CONTROL  [initandlisten] build environment:
2018-08-24T09:30:26.354+0530 I CONTROL  [initandlisten]     distmod: ubuntu1604
2018-08-24T09:30:26.354+0530 I CONTROL  [initandlisten]     distarch: x86_64
2018-08-24T09:30:26.354+0530 I CONTROL  [initandlisten]     target_arch: x86_64
2018-08-24T09:30:26.354+0530 I CONTROL  [initandlisten] options: { storage: { dbPath: "db" } }
2018-08-24T09:30:26.354+0530 E STORAGE  [initandlisten] Failed to set up listener: SocketException: Address already in use
2018-08-24T09:30:26.354+0530 I CONTROL  [initandlisten] now exiting
2018-08-24T09:30:26.354+0530 I CONTROL  [initandlisten] shutting down with code:48
Dharman
  • 30,962
  • 25
  • 85
  • 135
Varinder Sohal
  • 1,142
  • 5
  • 24
  • 44
  • 2
    Possible duplicate of [SocketException: Address already in use MONGODB](https://stackoverflow.com/questions/47975929/socketexception-address-already-in-use-mongodb) – rene Nov 05 '19 at 19:04

1 Answers1

8
  • sudo lsof -iTCP -sTCP:LISTEN -n -P
  • sudo kill <mongo_command_pid>
  • mongod

Try these three commands and you will surely get out of it.

double-beep
  • 5,031
  • 17
  • 33
  • 41
Harsh Dhiman
  • 81
  • 1
  • 5