Before you go through the process of creating a replica and deploying a replica set, you will need to reconfigure mongod to run on an IP address other than localhost (127.x.x.x). This can be accomplished by using the --bind_ip flag when starting mongod (where a.b.c.d is the target IP address):
mongod --bind_ip a.b.c.d
To bind to all IP addresses on this server, you can use this option:
mongod --bind_ip_all
The recommended approach is to modify the mongod configuration file on the impacted servers. Here are three possibilities:
If you want to have MongoDB listen with ... | Then enter this into the MongoDB config file |
...a specific IP address, a.b.c.d |
net: bindIp: a.b.c.d |
...only specific network interfaces, ... |