Reputation: 1
I am trying to start working with MongoDB but when I write the mongod command I get this error
2019-10-20T23:26:41.054-0500 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-10-20T23:26:41.062-0500 I CONTROL [initandlisten] MongoDB starting : pid=4724 port=27017 dbpath=/data/db 64-bit host=MacBook-Pro-de-Andres.local
2019-10-20T23:26:41.062-0500 I CONTROL [initandlisten] db version v4.2.0
2019-10-20T23:26:41.062-0500 I CONTROL [initandlisten] git version: a4b751dcf51dd249c5865812b390cfd1c0129c30
2019-10-20T23:26:41.062-0500 I CONTROL [initandlisten] allocator: system
2019-10-20T23:26:41.062-0500 I CONTROL [initandlisten] modules: enterprise
2019-10-20T23:26:41.062-0500 I CONTROL [initandlisten] build environment:
2019-10-20T23:26:41.062-0500 I CONTROL [initandlisten] distarch: x86_64
2019-10-20T23:26:41.062-0500 I CONTROL [initandlisten] target_arch: x86_64
2019-10-20T23:26:41.062-0500 I CONTROL [initandlisten] options: {}
2019-10-20T23:26:41.064-0500 E STORAGE [initandlisten] Failed to set up listener: SocketException: Address already in use
2019-10-20T23:26:41.064-0500 I CONTROL [initandlisten] now exiting
2019-10-20T23:26:41.064-0500 I CONTROL [initandlisten] shutting down with code:48
Upvotes: 0
Views: 426
Reputation: 328
It is a problem with your port number. Since your default port number 27017 is already allocated to mongodb, this error occurs.
In this case, You can do two things.
mongod in a different port.
mongod --port PORT_NUMBER
port number can be 27018 or any number you wish.
Hope you can fix your issue
Upvotes: 1