bind multiple IP in mongoDb 4.x.x bind multiple IP in mongoDb 4.x.x mongodb mongodb

bind multiple IP in mongoDb 4.x.x


The documentation you linked actually does have the answer to this. If you go here, you will see that the indicate:

To bind to multiple addresses, enter a list of comma-separated values.

EXAMPLE

localhost,/tmp/mongod.sock

I applied this in my environment and can see that mongod is listening on local and the designated IP.

root@aqi-backup:~# netstat -pano | grep 27017tcp        0      0 10.0.1.149:27017        0.0.0.0:*               LISTEN      12541/mongod         off (0.00/0/0)tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN      12541/mongod         off (0.00/0/0)

Here is my mongod.conf file (relevant section).

# network interfacesnet:  port: 27017  bindIp: 127.0.0.1,10.0.1.149


Use ; I used in Mongo 4.2.2 version

 net:   port: 27017   bindIp: 127.0.0.1;10.0.1.149


The only way that I found was open for all on MongoDB and control IPs t by firewall to specifics ips.net:port:27017bindIp:0.0.0.0