When you start MONGOs, config server configuration information must not use localhost, 127.0.0.1, or add other machine shard when the error message appears:
"Can ' t use localhost as a shard since all shards need to communicate. Either use all shards and configdbs on localhost or all in actual IPs host:xxxxx Islocalhost "
Start MONGOs with the new config server, and you will also need to restart Config server, otherwise there may be an error message:
"Could not verify config servers were active and reachable before write"
If the "MONGOs specified a different config database string" error occurs after the change, the Mongod also needs to be restarted,
Config server modified almost all instances to restart. Also, you must not use localhost, 127.0.0.1 when configuring replica set.
Reference: http://stackoverflow.com/questions/21226255/where-is-the-mongos-config-database-string-being-stored