[DOCS-11187] Misleading instructions on binding to multiple IPs. Created: 11/Jan/18  Updated: 30/Oct/23  Resolved: 27/Jul/18

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Bug Priority: Major - P3
Reporter: Scott Lowe Assignee: Kay Kim (Inactive)
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by DOCS-10931 Fix bindIp multiple address notation ... Closed
Participants:
Days since reply: 5 years, 21 weeks, 1 day ago

 Description   

https://docs.mongodb.com/manual/reference/configuration-options/

Under net.bindIp, it says:

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

So, e.g. :

bindIp : 127.0.0.1,192.168.0.1

However, this doens't work. An array of values is required. E.g.:

bindIp : [127.0.0.1,192.168.0.1]



 Comments   
Comment by Kay Kim (Inactive) [ 18/Sep/18 ]

Additional info: (fyi – was run on macOS to test – for quick testing purposes, using 0.0.0.0 – but of course, really shouldn't but since this was more to show errors in parsing, it doesn't actually bind to 0.0.0.0 – since doesn't parse [blah, 0.0.0.0]

v4.0


Yaml

   net:
      port: 27018
      bindIp: [127.0.0.1,0.0.0.0]

Errors with

 
   Scalar option 'net.bindIp' must be a single value

old ini file

bind_ip= [127.0.0.1,0.0.0.0]

Starts even though errors:

  2018-09-18T17:23:03.102-0400 I CONTROL  [initandlisten]     target_arch: x86_64
   2018-09-18T17:23:03.102-0400 I CONTROL  [initandlisten] options: { config: "mongod.conf.old", net: { bindIp: "[127.0.0.1,0.0.0.0]", port: 27018 }, processManagement: { fork: true }, storage: { dbPath: "/tmp/shardA/rs1/db" }, systemLog: { destination: "file", logAppend: true, path: "/tmp/shardA/rs1/mongod.log" } }
   2018-09-18T17:23:03.123-0400 W NETWORK  [initandlisten] Found no addresses for HostNotFound: Could not find address for [127.0.0.1:27018: SocketException: Host not found (authoritative)
   2018-09-18T17:23:03.141-0400 W NETWORK  [initandlisten] Found no addresses for HostNotFound: Could not find address for 0.0.0.0]:27018: SocketException: Host not found (authoritative)
   2018-09-18T17:23:03.143-0400 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=7680M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
   2018-09-18T17:23:03.778-0400 I STORAGE  [initandlisten] WiredTiger message [1537305783:778580][3492:0x7fffb83b2380], txn-recover: Set global recovery timestamp: 0
   2018-09-18T17:23:03.845-0400 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
   2018-09-18T17:23:03.935-0400 I CONTROL  [initandlisten] 
   2018-09-18T17:23:03.936-0400 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
   2018-09-18T17:23:03.937-0400 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
   2018-09-18T17:23:03.938-0400 I CONTROL  [initandlisten] 
   2018-09-18T17:23:03.939-0400 I CONTROL  [initandlisten] 
   2018-09-18T17:23:03.940-0400 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
   2018-09-18T17:23:03.947-0400 I STORAGE  [initandlisten] createCollection: admin.system.version with provided UUID: 4eeb936e-60a2-40ea-9fd6-d86370c9f56d
    ...

v3.6.4
------

Yaml:

 
   net:
      port: 27018
      bindIp: [127.0.0.1,0.0.0.0]

Errors with:

   Scalar option 'net.bindIp' must be a single value

ini file

Starts even though errors:

 
   2018-09-18T17:29:48.062-0400 I CONTROL  [initandlisten] MongoDB starting : pid=45528 port=27018 dbpath=/tmp/shardA/rs1/db 64-bit host=kays-mac-mini.local
   2018-09-18T17:29:48.063-0400 I CONTROL  [initandlisten] db version v3.6.4
   2018-09-18T17:29:48.063-0400 I CONTROL  [initandlisten] git version: d0181a711f7e7f39e60b5aeb1dc7097bf6ae5856
   2018-09-18T17:29:48.064-0400 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 0.9.8zh 14 Jan 2016
   2018-09-18T17:29:48.065-0400 I CONTROL  [initandlisten] allocator: system
   2018-09-18T17:29:48.065-0400 I CONTROL  [initandlisten] modules: none
   2018-09-18T17:29:48.066-0400 I CONTROL  [initandlisten] build environment:
   2018-09-18T17:29:48.067-0400 I CONTROL  [initandlisten]     distarch: x86_64
   2018-09-18T17:29:48.067-0400 I CONTROL  [initandlisten]     target_arch: x86_64
   2018-09-18T17:29:48.068-0400 I CONTROL  [initandlisten] options: { config: "mongod.conf.old", net: { bindIp: "[127.0.0.1,0.0.0.0]", port: 27018 }, processManagement: { fork: true }, storage: { dbPath: "/tmp/shardA/rs1/db" }, systemLog: { destination: "file", logAppend: true, path: "/tmp/shardA/rs1/mongod.log" } }
   2018-09-18T17:29:48.071-0400 I NETWORK  [initandlisten] getaddrinfo("[127.0.0.1") failed: nodename nor servname provided, or not known
   2018-09-18T17:29:48.072-0400 W NETWORK  [initandlisten] Found no addresses for [127.0.0.1
   2018-09-18T17:29:48.074-0400 I NETWORK  [initandlisten] getaddrinfo("0.0.0.0]") failed: nodename nor servname provided, or not known

v3.4.10
-------

Yaml

 
   net:
      port: 27018
      bindIp: [127.0.0.1,0.0.0.0]

Errors with

 
 
   Scalar option 'net.bindIp' must be a single value

ini file

 
``bind_ip= [127.0.0.1,0.0.0.0]``

Errors

 
      2018-09-18T17:36:31.527-0400 I CONTROL  [initandlisten] db version v3.4.10
   2018-09-18T17:36:31.528-0400 I CONTROL  [initandlisten] git version: 078f28920cb24de0dd479b5ea6c66c644f6326e9
   2018-09-18T17:36:31.529-0400 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 0.9.8zh 14 Jan 2016
   2018-09-18T17:36:31.529-0400 I CONTROL  [initandlisten] allocator: system
   2018-09-18T17:36:31.530-0400 I CONTROL  [initandlisten] modules: none
   2018-09-18T17:36:31.531-0400 I CONTROL  [initandlisten] build environment:
   2018-09-18T17:36:31.531-0400 I CONTROL  [initandlisten]     distarch: x86_64
   2018-09-18T17:36:31.532-0400 I CONTROL  [initandlisten]     target_arch: x86_64
   2018-09-18T17:36:31.533-0400 I CONTROL  [initandlisten] options: { config: "mongod.conf.old", net: { bindIp: "[127.0.0.1,0.0.0.0]", port: 27018 }, processManagement: { fork: true }, storage: { dbPath: "/tmp/shardA/rs1/db" }, systemLog: { destination: "file", logAppend: true, path: "/tmp/shardA/rs1/mongod.log" } }
   2018-09-18T17:36:31.534-0400 I NETWORK  [initandlisten] getaddrinfo("[127.0.0.1") failed: nodename nor servname provided, or not known
   2018-09-18T17:36:31.535-0400 I NETWORK  [initandlisten] getaddrinfo("0.0.0.0]") failed: nodename nor servname provided, or not known

but works with just comma-delimited (no spaces)

v3.2.15
-------

Yaml

 
   net:
      port: 27018
      bindIp: [127.0.0.1,0.0.0.0]

Works but views bindIp as a "true"

 
   2018-09-18T17:37:56.783-0400 I CONTROL  [initandlisten] options: { config: "mongod.conf", net: { bindIp: true, port: 27018 }, processManagement: { fork: true }, storage: { dbPath: "/tmp/shardA/rs1/db" }, systemLog: { destination: "file", logAppend: true, path: "/tmp/shardA/rs1/mongod.log" } }
   2018-09-18T17:37:56.785-0400 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=9G,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
   2018-09-18T17:37:56.987-0400 I CONTROL  [initandlisten] 

But also works with comma separated list:

 
      bindIp: 127.0.0.1,0.0.0.0

But this time bindip is a comma delimited string and not a true

 
   2018-09-18T17:40:23.249-0400 I CONTROL  [initandlisten] options: { config: "mongod.conf", net: { bindIp: "127.0.0.1,0.0.0.0", port: 27018 }, processManagement: { fork: true }, storage: { dbPath: "/tmp/shardA/rs1/db" }, systemLog: { destination: "file", logAppend: true, path: "/tmp/shardA/rs1/mongod.log" } }
   2018-09-18T17:40:23.251-0400 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=9G,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),

ini file

 
bind_ip= [127.0.0.1,0.0.0.0]

Errors

 
 
 
   2018-09-18T17:42:45.856-0400 I CONTROL  [initandlisten] options: { config: "mongod.conf.old", net: { bindIp: "[127.0.0.1,0.0.0.0]", port: 27018 }, processManagement: { fork: true }, storage: { dbPath: "/tmp/shardA/rs1/db" }, systemLog: { destination: "file", logAppend: true, path: "/tmp/shardA/rs1/mongod.log" } }
   2018-09-18T17:42:45.858-0400 I NETWORK  [initandlisten] getaddrinfo("[127.0.0.1") failed: nodename nor servname provided, or not known
   2018-09-18T17:42:45.859-0400 I NETWORK  [initandlisten] getaddrinfo("0.0.0.0]") failed: nodename nor servname provided, or not known
   2018-09-18T17:42:45.860-0400 E NETWORK  [initandlisten] listen(): socket is invalid.

But with comma-delimited

 
bind_ip= 127.0.0.1,0.0.0.0

Works:

 
   2018-09-18T17:44:08.590-0400 I CONTROL  [initandlisten] options: { config: "mongod.conf.old", net: { bindIp: "127.0.0.1,0.0.0.0", port: 27018 }, processManagement: { fork: true }, storage: { dbPath: "/tmp/shardA/rs1/db" }, systemLog: { destination: "file", logAppend: true, path: "/tmp/shardA/rs1/mongod.log" } }
   2018-09-18T17:44:08.591-0400 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=9G,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),

So, would actually need to know 2 things for people on ubuntu
1) What version are people using?

2) Are people using the official mongodb package or ubuntu's mongodb package (which are a bit older version – 2.4.9 for 14.04 – which wouldn't be using the yaml format – nonetheless, commadelimited works for old format, but lot bracketed list)

Comment by Kay Kim (Inactive) [ 27/Jul/18 ]

Tried on Ubuntu 16.04 (virtual box) and Windows 7. Comma delimited ip addresses were accepted in both cases.

Comment by Kay Kim (Inactive) [ 25/Jul/18 ]

will test out on various ubuntu and windows to figure out if this is a platform specific thing.

Generated at Thu Feb 08 08:02:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.