0

The Problem

I am trying but failing, in MongoDB 7.0, on Ubuntu, to bind multiple IP addresses to net.bindIp in mongod.conf

What I have tried

I have tried 127.0.0.1,x.x.x.x, 127.0.0.1;x.x.x.x, [127.0.0.1,x.x.x.x], [127.0.0.1;x.x.x.x] and mongod fails to start on each and everyone.

when the syntax is

[127.0.0.1,x.x.x.x] I get this error

Aug 22 11:52:36 ip-172-26-1-93 mongod[41708]: Scalar option 'net.bindIp' must be a single value

and when I use any other syntax, I get this error

Aug 22 11:54:38 ip-172-26-1-93 mongod[41723]: {"t":{"$date":"2023-08-22T11:54:38.935Z"},"s":"I",  "c":"CONTROL",  "id":7484500, "ctx":"main","msg":"Environment variable MONGODB_CONFIG_OVERRIDE_NOFORK == 1, overriding \"processManagement.fork\" to false"}

Where I have looked

After searching this extensively, I found this answer here and the answers to this question here and after tryin their solutions I still get the same errors.

I have looked at the documentation for the latest version and I can't see where I am going wrong.

Additional

I can successfully bind 0.0.0.0, however this then defeats the object of using net.bindIp

Edit

  1. I have tried reinstalling MongoDB 3 times now, and still the same issue
10
  • Have you seen this?
    – mustaccio
    Aug 22 at 14:44
  • @mustaccio yes I have. I have tried every possible variation of the [] / [x,x] / [x;x] and x,x / x;x / x, x syntax and I either get 'scalar option 'net.bindIp must be a single value' or it fails to start the daemon. I have edited the question to say I have also tried reinstalling the MongoDB instance.
    – Yenmangu
    Aug 22 at 15:10
  • I haven't test with latest versions, but earlier versions there was "feature" that if there was even one space character in that bindIp, it failed. 192.168.2.29,127.0.0.1
    – JJussi
    Aug 22 at 16:57
  • yes, I have tried all possible variations of the syntax with spaces and without spaces
    – Yenmangu
    Aug 22 at 17:06
  • What is the output of ifconfig? Aug 23 at 5:27

1 Answer 1

-1

Actually there is no reason to assign multiple IP-Addresses. This makes only sense on a computer with multiple network interfaces. However, since MongoDB does not support multiple network interfaces, it would be pointless anyway.

Either use net.bindIpAll: true if you like to permit connections from remote machines or use net.bindIp: localhost if you need to permit connections only from the local machine.

Anything else does not make much sense.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.