At this point, you can start the mongod instance on each server according to the recommended procedure for the host OS. Thus, on a Windows server, for example, the mongod instance would be started as a service using the Windows Task Manager or an equivalent GUI option. In a Linux environment, you could simply type the following:
mongod -f /etc/mongod.conf
As mentioned earlier, when starting the mongod instance manually (or using a shell script), you can specify replication options as command-line switches. The preferred approach, however, is to place replication settings into the mongod.conf (or equivalent) file on each member of the replica set.
For the purposes of this chapter, as mentioned previously, we will start the three Docker containers using the following command:
docker-compose up
The result is shown here:
We are now ready to initiate the replica set.