Configuring MongoDB in a PLOSSYS 5 Cluster¶
Caution - the same database
All servers in a cluster must use the same database.
Configuring a Shared Replica Set¶
For the communication within the cluster configure the database servers with a shared replica set.
Perform the following configuration steps on <server_1>
, <server_2>
and <server_3>
:
-
Edit the MongoDB configuration file:
C:\ProgramData\SEAL Systems\config\mongod.conf
-
Change the following line:
bindIp: 127.0.0.1
to:
bindIp: 0.0.0.0
-
Add the following lines:
replication: oplogSizeMB: 2048 replSetName: <YourReplicaSetName>
Hint -
oplogSizeMB
We recommend setting
oplogSizeMB
to 5 % of the disk space available for MongoDB. -
Restart MongoDB:
Restart-service seal-mongodb
Initializing the Database Cluster¶
Perform the following configuration steps on <server_1>
:
-
Open a PowerShell (Administrator).
-
Initialize the cluster on
<server_1>
:& "C:\Program Files\MongoDB\Server\3.6\bin\mongo.exe" --ssl --sslAllowInvalidCertificates --eval "rs.initiate({ _id : '<YourReplicaSetName>', members: [{ _id : 0, host : '<Server1>' }]})"
The output has to contain the following line:
"ok" : 1
Connecting the Database Server to the Cluster¶
After initializing the database cluster on <server_1>
add the other servers.
Perform the following configuration steps on <server_1>
:
-
Open a PowerShell (Administrator).
-
Add
<server_2>
to the cluster:& "C:\Program Files\MongoDB\Server\3.6\bin\mongo.exe" --ssl --sslAllowInvalidCertificates --eval "rs.add('<server_2>')"
The output has to contain the following line::
"ok" : 1
-
Add
<server_3>
to the cluster:& "C:\Program Files\MongoDB\Server\3.6\bin\mongo.exe" --ssl --sslAllowInvalidCertificates --eval "rs.add('<server_3>')"
The output has to contain the following line::
"ok" : 1
-
Proceed until all servers are added.
Checking the Status of the Database Cluster¶
-
Open a PowerShell (Administrator).
-
Execute the following command:
& "C:\Program Files\MongoDB\Server\3.6\bin\mongo.exe" --ssl --sslAllowInvalidCertificates --eval 'rs.status()'
The output has to contain the following line:
"ok" : 1
Showing the Configuration of the Database Cluster¶
-
Open a PowerShell (Administrator).
-
Execute the following command:
& "C:\Program Files\MongoDB\Server\3.6\bin\mongo.exe" --ssl --sslAllowInvalidCertificates --eval 'rs.conf()'