Having difficulty bringing up mongod process with bindIp 198.168.103.100

2019-09-29T17:09:31.615+0000 I CONTROL [initandlisten] options: { config: “/etc/mongod.conf”, net: { bindIp: “127.0.0.1, 198.168.103.100”, port: 27000 }, security: { authorization: “enabled” }, storage: { dbPath: “/data/db” }, systemLog: { destination: “file”, logAppend: true, path: “/data/log/mongod.log” } }
2019-09-29T17:09:31.616+0000 E STORAGE [initandlisten] Failed to set up listener: SocketException: Cannot assign requested address
2019-09-29T17:09:31.616+0000 I CONTROL [initandlisten] now exiting
2019-09-29T17:09:31.616+0000 I CONTROL [initandlisten] shutting down with code:48

mongod process coming up when 198.168.103.100 is removed from bindIp param, appreciate your time and suggestions

Hi @lakshma try removing the quotes in your config file like this:
bindIp: 127.0.0.1, 198.168.103.100

Or this:

bindIp: localhost, 198.168.103.100

Can you also show how you’re calling mongod?

thank you 007_jb, for quick response
from mongod.conf
net:
port: 27000
bindIp: 198.168.103.100, 127.0.0.1

am calling as
mongod -f /etc/mongod.conf (location of conf file)

FYI, i tried all possible 4 combinations
net:
port: 27000

bindIp: 198.168.103.100, 127.0.0.1

bindIp: 127.0.0.1, 198.168.103.100

bindIp: 198.168.103.100, localhost

bindIp: localhost, 198.168.103.100

noticed similar error

noticed another difficulty while bring up with options on shell instead of conf file
mongod --auth --port 27000 --bind_ip “192.168.103.100, 127.0.0.1” --dbpath ./data/db/ ogpath ./data/log/mongod.log

process came up as expected
vagrant@m103:~/data/log$ ps -ef | grep -i mongod
vagrant 2916 2317 0 17:39 pts/0 00:00:01 mongod --auth --port 27000 --bind_ip 192.168.103.100, 127.0.0.1 --dbpath ./data/db/ --logpath ./data/log/ mongod .log

am able to create user as well and also able to see the user after connecting
MongoDB Enterprise > db.system.users.find().pretty()
{
“_id” : “admin.m103-admin”,
“userId” : UUID(“8c16ad19-a801-415b-a405-2d28491a2b99”),
“user” : “m103-admin”,
“db” : “admin”,
“credentials” : {
“SCRAM-SHA-1” : {
“iterationCount” : 10000,
“salt” : “e79HiyNRrfgjgOw3HIt0TA==”,
“storedKey” : “CLPH16gQVtFWCTwiNqlqbenznmI=”,
“serverKey” : “SaLewa7qWD0Ec5LZZ+WO4XDOXGs=”
}
},
“roles” : [
{
“role” : “root”,
“db” : “admin”
}
]
}

but when trying to validate am getting the following
[vagrant@m103:~/data/log$ validate_lab_launch_mongod

You need to specify db path /data/db.

when I try to bring up as
mongod --auth --port 27000 --bind_ip “192.168.103.100, 127.0.0.1” --dbpath /data/db/ --logpath /data/log/mongod.log

Am able to create user, as shown above and tried to validate, am getting following message
vagrant@m103:~/data/log$ validate_lab_launch_mongod
You need to bind the IP address to 127.0.0.1 or localhost.

Am not sure where is the issue and why it is not successful. Thank you for taking your time to look

Sounds like the IP problem is resolved?

Are you talking about the first lab? Launching Mongod?

Yes, am behind a bit, am not trying for any certificate just trying to learn and understand as much as possible.

I know it doesn’t make any value, but trying to see why am getting those issues when everything seems good

Don’t worry, I’m a student like yourself. We’re here to help each other out :slight_smile:

Why don’t you use a config file instead? And after you lunch the mongod process, try and login with that user before running the validation script.

Also run this to see which mongod instances are running:
ps -ef | grep mongod

Thank you for trying to help me.
I tried with conf file as well, as you can see in my post, mongod service dies with following message.

2019-09-29T17:09:31.616+0000 E STORAGE [initandlisten] Failed to set up listener: SocketException: Cannot assign requested address

And what do you get here?

Hi lakshma

In all your examples there is an extra space between the IPs at bindIP parameter
Please try to remove that and launch mongod again
It should work

1 Like