How it works...
In step 1, we begin by starting the mongod process with the two parameters. First, we provide the database path with --dbpath, which is quite standard with all mongod processes. Next, we provide the --replSet parameter with the value MyReplicaSet. This parameter starts the mongod process with the explicit instruction that it will be running a replica set node and the unique name for this replica set is MyReplicaSet. MongoDB uses naming constructs to identify a replica set cluster. This can be changed in the future but would require you to shut down all the nodes within the cluster.
In step 2, we open a different Terminal window and start the mongo shell that is connected to our aforementioned node. We check the replica set's ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access