I need to set up a mongodb cluster with redundant private networks connecting all the nodes. Mongo's documentation states:
... you should place each mongod instance on a separate host server serviced by redundant power circuits and redundant network paths.
https://docs.mongodb.com/manual/tutorial/deploy-replica-set/
I am able to make mongod listen on multiple nics using the --bind_ip parameter, which I set to:
--bind_ip localhost,10.1.1.101,10.1.2.101
But then when doing rs.initiate()/rs.reconfig()/rs.add() I see no way to specify multiple IP addresses for the members[n].host fields. I tried multiple values separated with a comma:
> rs.initiate({ _id : 'rs', version : 1, members : [{ _id : 0, host : '10.1.1.101:27107,10.1.2.101:27017' } ] })
{
"ok" : 0,
"errmsg" : "FailedToParse: More than one ':' detected. If this is an ipv6 address, it needs to be surrounded by '[' and ']'; 10.1.1.101:27107,10.1.2.101:27017 for member:{ _id: 0.0, host: \"10.1.1.101:27107,10.1.2.101:27017\" }",
"code" : 93,
"codeName" : "InvalidReplicaSetConfig"
}
I tried making host an array:
> rs.initiate({ _id : 'rs', version : 1, members : [{ _id : 0, host : [ '10.1.1.101:27107', '10.1.2.101:27017'] } ] })
{
"ok" : 0,
"errmsg" : "TypeMismatch: \"host\" had the wrong type. Expected string, found array for member:{ _id: 0.0, host: [ \"10.1.1.101:27107\", \"10.1.2.101:27017\" ] }",
"code" : 93,
"codeName" : "InvalidReplicaSetConfig"
}
I tried specifying host multiple times, which mongo accepted, but it only used the last host specified.
> rs.initiate({ _id : 'rs0', version : 1, members : [{ _id : 0, host : '10.1.1.101:27107', host: '10.1.2.101:27017' } ] })
{ "ok" : 1 }
All this is just getting the first node set up. I had similar issues when adding nodes 2 and 3 with rs.add() and rs.reconfig().
Any help would be much appreciated.