The next step is to deploy the config server. As mentioned earlier in this chapter, the config server stores sharding metadata and must be deployed as a replica set.
Accordingly, the mongod.conf file appears as follows:
systemLog:
destination: file
path: "/var/log/mongodb/mongodb.log"
logAppend: true
storage:
dbPath: "/data/db"
journal:
enabled: true
net:
bindIp: 0.0.0.0
port: 27019
replication:
replSetName: repl_config
sharding:
clusterRole: configsvr
To initialize the replica set, we use the rs.initiate() shell method. The following syntax is sufficient for the purposes of this illustration:
doc = {
_id : "repl_config",
members: [
{ _id: 1, host: "config1.biglittle.local:27019" }
]
}
rs.initiate(doc);
We open a mongo shell on the config server and issue the command shown in the preceding code block. As discussed earlier in this section, we initiate a single-node replica set...