Mongodb 5.0 is is getting started with sudo systemctl start mongod.service on Debian 10 .
Issue
Below error is being raised while starting the mongodb instance 5.0 on Linux/Debian –
:{"error":{"code":9001,"codeName":"SocketException","errmsg":"Cannot assign requested address"}}}
Root Cause
This error is being raised when server is not able to identify the hostname and port i.e. address. This needs to investigated further from /etc/mongod.conf content point of view as this has enteries for Net :port and bindIP, below is commonly used content of mongod.conf
net: port: 27081 bindIp: 127.0.0.1, host_name systemLog: destination: file logAppend: true path: /mongodb/log/mongod.log
The the most common root cause of the issue is bindIP may not be correct.
Fix /Resolution
To Fix this you can always check the hostname or ip address of host and put it correctly. For our internal issue what we have done is – remove the hostname from bindIP and just put the local ip :127.0.0.1 and it worked fine.
Reference Links
Tags: mongodb not starting, mongodb issue, mongodb not able to start,”errmsg”:”Cannot assign requested address”}, mongodb common issues.