mongo db-Either all host names in a replica set configuration must be localhost references, or none must be; found 1 out of 2
You can have all replica set nodes in the same physical computer (localhost), but in different ports! (node1:27017, node2:27027, ...)
You CANNNOT have different RS nodes:

at one machine at same port (f.ex. 27017)
different machine and bind to localhost address

So, you need to build your replica set using IP-addresses.