Error: When use rs.Add():
{
“errmsg” : “exception: can’t use localhost in repl set member names except when using it for all members”,
“code” : 13393,
“ok” : 0
}
Cause:
1. Your replica set is using localhost for it members and you are adding a new member with IP/hostname other than localhost
2. Your replica set is using IP/hostname for it members and you are adding a new member with localhost as hostname
Solution: Only use localhost for replica set members if you are sure that all mongod/mongos instance are on the same local machine. Otherwise, use hostname or IP.