Deploy Three Config Servers for Production Deployments (page 698) Convert a test deployment with one config server to a production deployment with three config servers. 

Convert a Replica Set to a Replicated Sharded Cluster (page 699) Convert a replica set to a sharded cluster in which each shard is its own replica set. 

Convert Sharded Cluster to Replica Set (page 704) Replace your sharded cluster with a single replica set. 

## See also: 

Enable Authentication in a Sharded Cluster (page 358) 

## Deploy a Sharded Cluster 

Use the following sequence of tasks to deploy a sharded cluster: 

Warning: Sharding and “localhost” Addresses 

If you use either “localhost” or 127.0.0.1 as the hostname portion of any host identifier, for example as the host argument to addShard or the value to the --configdb run time option, then you must use “localhost” or 127.0.0.1 for all host settings for any MongoDB instances in the cluster. If you mix localhost addresses and remote host address, MongoDB will error. 

## Start the Config Server Database Instances 

The config server processes are mongod instances that store the cluster’s metadata. You designate a mongod as a config server using the --configsvr option. Each config server stores a complete copy of the cluster’s metadata. 

In production deployments, you must deploy exactly three config server instances, each running on different servers to assure good uptime and data safety. In test environments, you can run all three instances on a single server. 

Important: All members of a sharded cluster must be able to connect to all other members of a sharded cluster, including all shards and all config servers. Ensure that the network and security systems including all interfaces and firewalls, allow these connections. 

1. Create data directories for each of the three config server instances. By default, a config server stores its data files in the /data/configdb directory. You can choose a different location. To create a data directory, issue a command similar to the following: 

mkdir /data/configdb 

2. Start the three config server instances. Start each by issuing a command using the following syntax: 

mongod --configsvr --dbpath <path> --port <port> 

The default port for config servers is 27019 . You can specify a different port. The following example starts a config server using the default port and default data directory: 

mongod --configsvr --dbpath /data/configdb --port 27019 

For additional command options, see http://docs.mongodb.org/manual/reference/program/mongod or http://docs.mongodb.org/manual/reference/configuration-options . 

Note: All config servers must be running and available when you first initiate a sharded cluster . 

