For all servers that need to connect to this MongoDB cluster, it should go via this mongos
router! First start it up with the configuration server details:
$ sudo mongos --configdb localhost:27200 --chunkSize 1
Now, this service will listen on the default 27017 port.
After you start mongos
, you should see something like this on the console:
mongos db version v2.0.2, pdfile version 4.5 starting (--help for usage) ... [Balancer] about to contact config servers and shards [mongosMain] waiting for connections on port 27017 [Balancer] updated set (sodibee) to: sodibee/localhost:27018,localhost:27020 [Balancer] updated set (sodibee) to: sodibee/localhost:27018,localhost:27020,localhost:27019 [ReplicaSetMonitorWatcher] starting [Balancer] config servers and shards contacted successfully ...
Notice that mongos
now waits for client connections and has contacted the config servers and shards. It now knows where to send the incoming requests...