Initializing the Database¶
Hint - secondary memmbers of a replica set
Secondary members of a replica set do not have to be initialized.
Single System¶
-
Open a PowerShell (Administrator).
-
Initialize the database:
& "C:\Program Files\MongoDB\Server\4.4\bin\mongo.exe" --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:-
Open a PowerShell (Administrator).
-
Initialize the cluster on
<server_1>
:& "C:\Program Files\MongoDB\Server\4.4\bin\mongo.exe" --tls --tlsAllowInvalidCertificates --eval "rs.initiate({ _id : '<YourReplicaSetName>', members: [{ _id : 0, host : '<Server1>' }]})"
The output has to contain the following line:
"ok" : 1
Proceed with connecting the database servers to the cluster.