HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Multiple IPs are not getting bind in mongodb conf file

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
conffileipsaremongodbgettingmultiplebindnot

Problem

I am trying to bind multiple IP to mongodb config file, one is 0.0.0.0 and other is 127.0.0.1. I did the following change in configuration file


/etc/mongod.conf

# network interfaces
net:
  port: 27017
  bindIp: "0.0.0.0,127.0.0.1"


Than I reloaded the configuration by the following command

sudo mongod --config /etc/mongod.conf


Than checked if the server is listening on localhost as well or not by the following command.

netstat -tlpn


It shows the output only for 0.0.0.0

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:27017           0.0.0.0:*               LISTEN      -


Why is it not listening to localhost as well?

Solution

had the same issue and the thing is everywhere it's written that you have to bind them like this

bindIp : 127.0.0.1,192.168.0.50

but that doesn't work.

The MongoDB version 3.2.x have the following configuration and its working for me.

bindIp : [127.0.0.1,192.168.0.50]

    example :

# network interfaces
net:
      port: 27017
      bindIp : [127.0.0.1,10.12.2.1,10.12.65.1]

Code Snippets

bindIp : [127.0.0.1,192.168.0.50]

    example :

# network interfaces
net:
      port: 27017
      bindIp : [127.0.0.1,10.12.2.1,10.12.65.1]

Context

StackExchange Database Administrators Q#122330, answer score: 2

Revisions (0)

No revisions yet.