How to add External network Node(Seconadry Replica set) in my Replication?

32 views
Skip to first unread message

Ketul

unread,
Apr 7, 2015, 1:12:15 AM4/7/15
to mongod...@googlegroups.com
Hie to All,

I want to create replication on different network for fault torlerance. Here below i have mention the  scenario.


I have  two system both are in LAN,  my system contains two node one primary replica and another secondary and another pc has ip 192.168.0.58. I have to make this has secondary replica.

This is my secondary Replica config file contents:

dbpath=d:\Data\db\
logpath=d:\Data\log\mongo.log
logappend=true
port = 27017
replSet = replicaset
 
bind_ip = 127.0.0.1



When i add to add this replica in my system using this below command on mongo shell  then its give me following error.

replicaset:PRIMARY> rs.add("192.168.0.58:27017")
{
        "errmsg" : "exception: can't use localhost in repl set member names exce
pt when using it for all members",
        "code" : 13393,
        "ok" : 0
}

Any one has solution about this.



Thanks in Advance

Stephen Steneker

unread,
Apr 7, 2015, 5:40:39 AM4/7/15
to mongod...@googlegroups.com
Hi Ketul,

The error message indicates that you already have one or members in your replica set added as "localhost":

        "errmsg" : "exception: can't use localhost in repl set member names except when using it for all members",

Since localhost is a special loopback address referring to the local network interface, you cannot use this for members of a replica set on different server -- each server's "localhost" would be referring to a different server.

If you provide the output of your `rs.conf()` someone can suggest how to reconfigure .. but it might be easier to follow the tutorial:

You will also need to remove the bind_ip restriction from your config file:
 bind_ip = 127.0.0.1

All members of the replica set need to talk to each other over a network interface, so you need to bind to something other than 127.0.0.1 and allow appropriate connections via your firewall.

For more information on security & firewall configuration in Windows see:

Regards,
Stephen
Reply all
Reply to author
Forward
0 new messages