Deploying a replica set
Having completed the initialization steps, we can now start to define our first replica set. First of all, you need to run the mongod
process on all machines through the following steps:
Make sure that you have the configuration file in your machine, and then run the following command:
mongod --config /etc/mongodb.conf
Note
In Unix operating systems, if you don't have sufficient permissions to run the command, you can use the
sudo
prefix. So the complete command will besudo mongod --config /etc/mongodb.conf
.After issuing the command, you should see the result depicted in the following screenshot:
Because we set the fork property to true,
mongod
will run as a daemon in the background. So, in order to see the logs and outputs ofmongod
, you should use the definedlogpath
file. You can see the logfile content as shown in the following screenshot:For the next steps, you should use
mongo
interactive shell to run and configure the replica set.Run the
mongo
command from your...