I am a newbie for setting up the server environment and mongoDB. This may sounds something really simple, however, I really need your help on it.
I am trying to conn
Ubuntu 16.04 -> MongoDB shell version: 2.6.10
For me the following works:
Notice I have a ;
not ,
Wrap the comma-separated-Ips with brackets works in mongo 3.2.7 for me:
bindIp = [127.0.0.1, 192.168.184.155, 96.88.169.145]
I successfully added a second ip on my version 3.2 service using a comma, no spaces and an FQDN
net:
port: 27017
bindIp: localhost,dev-2.office.sampleorg.com
For those who still wondering - problem is not in the syntax, but the addresses you put in.
Read this answer
With the following version of MongoDB: MongoDB shell version v3.6.10
Reproducing Problem: When [127.0.0.1,xxx.xxx.xxx.xxx] is used we get the following error. Scalar option 'net.bindIp' must be a single value try 'mongod --help' for more information
Analysis
This is because, according to MongoDB Documentation: https://docs.mongodb.com/manual/reference/configuration-options/#net.bindIP
net.bindIP is of type "string".
Solution for binding multiple IP Addresses
bindIp: "127.0.0.1,xxx.xxx.xxx.xxx"
Note: No spaces after commas
In my case the solution was to put the comma separated IP and without any spaces.
bind_ip=192.168.2.29,127.0.0.1
#port = 27017
That way worked:
2018-10-02T07:49:27.952+0000 I CONTROL [initandlisten] options: { config: "/etc/mongodb.conf", net: { bindIp: "192.168.2.29,127.0.0.1", unixDomainSocket: { pathPrefix: "/run/mongodb" } }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongodb.log" } } 2018-10-02T07:49:27.954+0000 I - [initandlisten] Detected data files in /var/lib/mongodb created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
Mongo 3.6.3 here.
mongod --version db version v3.6.3 git version: 9586e557d54ef70f9ca4b43c26892cd55257e1a5 OpenSSL version: OpenSSL 1.1.0g 2 Nov 2017 allocator: tcmalloc modules: none build environment: distarch: x86_64 target_arch: x86_64