Skip to content

Initializing the Database


Hint - secondary memmbers of a replica set

Secondary members of a replica set do not have to be initialized.


Single System

sudo mongo --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 mongo --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.


Back to top