When you’re upgrading from previous versions before 3.6 you might notice this warning showing up in the shell when you start the server for the first time. This warning is telling you that you don’t have an IP bound to your instance, preventing any connections to the instance.

BindIP

There are two ways to apply bindIP to your system in order to resolve this warning. You can assign the parameter in the command line as your launch your instance or in the configuration file.

The IP you use will determine who will be able to connect your instance. It’s advised that you know which network adapter is responsible for which traffic before applying the bindIP. You don’t want to apply the bindIP responsible for internet traffic if your server is not secured.

To find your IP in Ubuntu you can use ifconfig:

MongoDB WARNING This Server is bound to localhost - screenshot 1

Your IP will be under “inet addr” and will be listed for every adapter on your server. Your local adapter is “lo” and will be 127.0.0.1 .

If you always receive “connection refused” when trying to connect to your instance or if you see it in the ReplicaSet status, then you can try setting your bindIP to 0.0.0.0 to see if the issue is actually IP related. The IP of 0.0.0.0 will allow all connections from any interface. The bindIp specifically assigns a single IP address that relates to an interface to allow connections from.

You can assign multiple IP addresses by separating each IP with a comma, no spaces.

Command Line

If you use command line to launch your instance instead of a service, you’ll need to add a parameter for your bindIP. The parameter you’re going to use is –bind_ip and if you want the same functionality as 0.0.0.0 then you would use –bind_ip_all.

MongoDB WARNING This Server is bound to localhost - screenshot 2
MongoDB WARNING This Server is bound to localhost - screenshot 3

Configuration File

For your configuration file, you just need to add a line in your mongo.conf using yaml syntax.

MongoDB WARNING This Server is bound to localhost - screenshot 4
MongoDB WARNING This Server is bound to localhost - screenshot 5
Share This