0
votes

I installed mongodb in my MacBook but I didn't have XCode and while installing through homebrew, it was asking for gcc which inturn was asking for XCode, I opted for installing the other way. The following errors are coming when I am typing mongod in terminal. Please help in this regard. Thanks in advance.

`2020-06-30T03:25:58.555+0530 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'

2020-06-30T03:25:58.559+0530 W ASIO [main] No TransportLayer configured during NetworkInterface startup 2020-06-30T03:25:58.561+0530 I CONTROL [initandlisten] MongoDB starting : pid=30070 port=27017 dbpath=/data/db 64-bit host=megatron-2.local

2020-06-30T03:25:58.561+0530 I CONTROL [initandlisten] db version v4.2.8

2020-06-30T03:25:58.561+0530 I CONTROL [initandlisten] git version: 43d25964249164d76d5e04dd6cf38f6111e21f5f

2020-06-30T03:25:58.561+0530 I CONTROL [initandlisten] allocator: system

2020-06-30T03:25:58.561+0530 I CONTROL [initandlisten] modules: none

2020-06-30T03:25:58.561+0530 I CONTROL [initandlisten] build environment:

2020-06-30T03:25:58.561+0530 I CONTROL [initandlisten] distarch: x86_64

2020-06-30T03:25:58.561+0530 I CONTROL [initandlisten] target_arch: x86_64

2020-06-30T03:25:58.561+0530 I CONTROL [initandlisten] options: {}

2020-06-30T03:25:58.562+0530 E STORAGE [initandlisten] Failed to set up listener: SocketException: Address already in use

2020-06-30T03:25:58.563+0530 I CONTROL [initandlisten] now exiting

2020-06-30T03:25:58.563+0530 I CONTROL [initandlisten] shutting down with code:48`

1

1 Answers

0
votes

From the error Failed to set up listener: SocketException: Address already in use, it's most likely another process is already running on the port mongod is trying to use(27017).

You probably started mongod itself as a background service. Try running lsof -i :27017 to see which process is listening on that port, if it's mongod, then you don't have any problem, you can connect to your DB and do whatever you want to, however, if its some other process, you would either have to quit the process or start mongod on another port using the --port command-line option.