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 an editor, open the MongoDB configuration file:
/opt/seal/etc/mongod.conf -
Change the following line:
bindIp: 127.0.0.1to:
bindIp: 0.0.0.0 -
Add the following lines:
replication: oplogSizeMB: 2048 replSetName: <YourReplicaSetName>Hint -
oplogSizeMBWe recommend setting
oplogSizeMBto 5 % of the disk space available for MongoDB. -
Restart MongoDB:
sudo systemctl restart mongod
Initializing the Database¶
Caution - replica set primary only
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
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
-
Add
<server_2>to the cluster:sudo mongosh --tls --tlsAllowInvalidCertificates --eval "rs.add('<server_2>')"The output has to contain the following line::
"ok" : 1 -
Add
<server_3>to the cluster:sudo mongosh --tls --tlsAllowInvalidCertificates --eval "rs.add('<server_3>')"The output has to contain the following line::
"ok" : 1 -
Proceed until all servers are added.
Proceed with Securing MongoDB: TLS encryption or user authentication.