Skip to content

Configuring SEAL MongoDB


Hint - necessary configuration steps

Different database clients may require different configuration steps, see overview.

Hint - replica set required

MongoDB requires a replica set for both, single server and server cluster.


Configuring a Shared Replica Set

Caution - cluster

In a cluster, all servers must use the same database. Therefore you have to perform the following configuration steps on every member of the replica set separately.

  1. In an editor, open the MongoDB configuration file:

    C:\ProgramData\SEAL Systems\config\mongod.conf
    
  2. Change the following line:

    bindIp: 127.0.0.1
    

    to:

    bindIp: 0.0.0.0
    
  3. Add the following lines:

    replication:
      oplogSizeMB: 2048
      replSetName: <YourReplicaSetName>
    

    Hint - oplogSizeMB

    We recommend setting oplogSizeMB to 5 % of the disk space available for MongoDB.

  4. Restart MongoDB:

    Restart-service seal-mongodb
    

Initializing the Database

Caution - replica set primary only

Perform the following configuration step only on the replica set primary.

  1. Open a PowerShell (Administrator).

  2. Initialize the cluster on <server_1>:

    & "C:\Program Files\mongosh\mongosh.exe" --tls --tlsAllowInvalidCertificates --eval "rs.initiate({ _id : '<YourReplicaSetName>', members: [{ _id : 0, host : '<Server1>' }]})"
    

    The output has to contain the following line:

    "ok" : 1


Connecting the Database Servers to the Cluster

After initializing the database cluster on the replica set primary, add the other members of the replica set.

Caution - replica set primary only

Perform the following configuration step on the replica set primary only.

  1. Open a PowerShell (Administrator).

  2. Add <server_2> to the cluster:

    & "C:\Program Files\mongosh\mongosh.exe" --tls --tlsAllowInvalidCertificates --eval "rs.add('<server_2>')"
    

    The output has to contain the following line::

    "ok" : 1

  3. Add <server_3> to the cluster:

    & "C:\Program Files\mongosh\mongosh.exe" --tls --tlsAllowInvalidCertificates --eval "rs.add('<server_3>')"
    

    The output has to contain the following line::

    "ok" : 1

  4. Proceed until all servers are added.


Proceed with Securing MongoDB: TLS encryption or user authentication.


Back to top