Chapter 1 : Lab - Configuration File : Cannot assign requested address

Hey, I have created a mongodb config file named as my_mongo.conf and here are the contents :

dbPath: “/data/db”

bindIp : “,”
port : “27000”

authorization: “enabled”

However, I am trying to execute the mongod command with the config file : mongod -f my_monog.conf

I am getting the following error :

vagrant@m103:~$ mongod -f “my_mongo.conf”
2019-08-25T10:49:01.806+0000 I CONTROL [initandlisten] MongoDB starting : pid=3125 port=27001 dbpath=/data/db 64-bit host=m103
2019-08-25T10:49:01.807+0000 I CONTROL [initandlisten] db version v3.6.14
2019-08-25T10:49:01.807+0000 I CONTROL [initandlisten] git version: cbef87692475857c7ee6e764c8f5104b39c342a1
2019-08-25T10:49:01.808+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2019-08-25T10:49:01.808+0000 I CONTROL [initandlisten] allocator: tcmalloc
2019-08-25T10:49:01.810+0000 I CONTROL [initandlisten] modules: enterprise
2019-08-25T10:49:01.810+0000 I CONTROL [initandlisten] build environment:
2019-08-25T10:49:01.812+0000 I CONTROL [initandlisten] distmod: ubuntu1404
2019-08-25T10:49:01.813+0000 I CONTROL [initandlisten] distarch: x86_64
2019-08-25T10:49:01.813+0000 I CONTROL [initandlisten] target_arch: x86_64
2019-08-25T10:49:01.814+0000 I CONTROL [initandlisten] options: { config: “my_mongo.conf”, net: { bindIp: “”, port: 27001 }, security: { authorization: “enabled” }, storage: { dbPath: “/data/db” } }
2019-08-25T10:49:01.814+0000 E STORAGE [initandlisten] Failed to set up listener: SocketException: Cannot assign requested address
2019-08-25T10:49:01.815+0000 I CONTROL [initandlisten] now exiting
2019-08-25T10:49:01.815+0000 I CONTROL [initandlisten] shutting down with code:48

I tried to change the port and ip addresses but no help.

Any suggestions?


Hey @nihal9ns

This maybe stupid question but have you tried with localhost instead of

Tried now, doesn’t help!

OK what do you get from

ps -ef | grep monogd

Im wondering if you already have a mongod process running on that port, However I do remember you saying that you tried different ports.

Maybe try without the quotes around the numbers

Fixed, was a problem with the port that I had entered, instead of it should be