Initializing the Database¶
Hint - secondary members of a replica set
Secondary members of a replica set do not need to be initialized.
Single System¶
sudo mongosh --tls --tlsAllowInvalidCertificates --tlsAllowInvalidHostnames --eval "rs.initiate()"
The output has to contain the following line:
"ok" : 1
Proceed with Securing MongoDB: TLS encryption or user authentication.
Replica Set Primary¶
Caution - replica set primary only
Perform the following configuration steps only on the replica set primary:Initialize the cluster on <server_1>
:
sudo mongosh --tls --tlsAllowInvalidCertificates --eval "rs.initiate({ _id : '<YourReplicaSetName>', members: [{ _id : 0, host : '<server_1>' }]})"
The output has to contain the following line:
"ok" : 1
Proceed with connecting the database servers to the cluster.