No matter how I try to initialize my primary node, it always gets the name "name" : "127.0.0.1:27017", therefore any remote node additions in the replica set, fail with this message:
"errmsg" : "Either all host names in a replica set configuration must be localhost references, or none must be; found 1 out of 2"
Here is my .conf
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# network interfaces
net:
port: 27017
bindIp: mongodb.primary, 127.0.0.1
# how the process runs
processManagement:
timeZoneInfo: /usr/share/zoneinfo
How should I properly initialize my primary so that it does not bind to 127.0.0.1 only?
The mongodb.primary above is resolvable among all machines;
Here is the full error:
rs0:PRIMARY> rs.add('mongodb.secondary1:27017')
{
"operationTime" : Timestamp(1552552019, 1),
"ok" : 0,
"errmsg" : "Either all host names in a replica set configuration must be localhost references, or none must be; found 1 out of 2",
"code" : 103,
"codeName" : "NewReplicaSetConfigurationIncompatible",
"$clusterTime" : {
"clusterTime" : Timestamp(1552552019, 1),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
}
}