Unit 5.4: NoSQL Databases (Managed MongoDB)
Introduction
Not every FinCorp dataset is a table. Customer onboarding produces case files whose shape changes with each product and each regulator's checklist. Forcing them into a relational schema means a migration for every new field. A document store holds each case as one document and lets the shape evolve.
The managed MongoDB service makes two decisions at creation that are hard to change later: the edition, which sets the topology, the recovery options and the hardware class, and the private network placement. This unit makes both decisions and ends by building FinCorp's case-file cluster in the DCD.
1. Document or Relational, and Which Edition
1.1 When the Document Model Fits
Choose documents when records are read and written as a whole, when their structure varies or grows, and when cross-record transactions are rare. Keep data relational when integrity spans many entities, such as accounts, postings and balances, and when you need the zero-loss failover of Strictly Synchronous replication (Unit 5.3). FinCorp's split follows that line: payments in PostgreSQL, onboarding case files in MongoDB, linked by a customer ID.
The read model also differs. A PostgreSQL standby does not serve reads, while MongoDB Enterprise lets a replica set grow to seven members, one primary and up to six secondaries. If a workload's reads must scale out with copies of the data, that is a point for MongoDB.
1.2 The Three Editions
IONOS CLOUD offers Playground, Business and Enterprise editions. Playground is a temporary sandbox with one free instance of 2 GB RAM, 1 vCPU and 50 GB storage; it is deleted automatically and is not for production. The two production editions differ as follows:
| Decision point | MongoDB Business | MongoDB Enterprise |
|---|---|---|
| Hardware | Cubes; predefined templates | Dedicated Core Servers; 1 to 31 cores and up to 230 GB RAM per instance |
| Topology | Single replica set of 1 or 3 instances | Replica set of 1, 3, 5 or 7 instances, or a sharded cluster |
| Storage | Template size | Up to 4 TB per instance |
| Point-in-time recovery | Not available | Available |
| BI Connector | Not available | Available |
The service-level agreement depends on the topology: 99.95% for clusters of three or more members and 99.9% for smaller ones, with Playground excluded. A single-instance cluster is therefore a lower commitment as well as a single point of failure.
1.3 Sharding and the Write Ceiling
A replica set has one primary, so writes scale only vertically. An Enterprise replica set reaches its write limit at 30,000 write IOPS, at a volume size of 600 GB or more. A sharded cluster distributes writes across one primary per shard, so the limit becomes 30,000 multiplied by the number of shards. The DCD creates 2 to 32 shards, and the API allows more. A sharded cluster adds three config server instances with 2 cores, 4 GB RAM and 40 GB storage each, which are not billed. Move to sharding when the working set no longer fits in RAM per node, when hot collections saturate a node's IOPS, or when write throughput must scale horizontally with a good shard key.
1.4 Connections Follow RAM
The selected RAM sets a hard limit on concurrent connections, and the server rejects new connections above it. On Enterprise, 2 GB allows 500 connections, 8 GB allows 3,000, 16 GB allows 7,000 and 64 GB allows 31,000. There is no managed connection pooler, so size RAM for the peak connection count of the whole compute tier, including scale-out replicas (Unit 4.3).
2. Continuity: Snapshots, PITR and Dump
2.1 What the Service Keeps
A cluster's backups are snapshots: one at creation, one after a restore, a base snapshot every 24 hours and a full snapshot every Sunday. Snapshots are retained for seven days, so recovery reaches back one week. On Enterprise, point-in-time recovery restores to a chosen oplog timestamp, between 1 and 24 hours in the past. You can restore from any snapshot created with the same or an older MongoDB patch version.
One rule changes the deletion runbook: if you destroy a MongoDB cluster, all of its snapshots are also deleted. A cluster that might be needed again must be dumped before it is deleted.
2.2 Moving Data: Dump and Restore
Data moves between clusters, and into the service, with mongodump and mongorestore. The migration plan is a write freeze: stop writes to the old cluster, which starts the downtime; dump; optionally copy the dump; restore into the new cluster; switch the application, which ends the downtime. The same tools produce copies that outlive the seven-day window: a scheduled mongodump into a locked Object Storage bucket (Unit 5.2) gives FinCorp the retention its regulator asks for.
2.3 Private Access and Users
The cluster connects to a private LAN of a VDC, with one private IP address per instance, and clients connect through a mongodb+srv connection string from a VM on that network. Users are managed through the DCD or the API, not from within MongoDB; all users are created in the admin database, and a cluster holds up to 100 users.
DCD Implementation Walkthrough
You will create FinCorp's case-file cluster fc-mongo-cases: a three-member Enterprise replica set on the private fc-data LAN, with off-site backups, and one application user. This realises the edition decision of Section 1.2 and the recovery design of Section 2.
Prerequisites: the VDC fc-prod-fra-core with the fc-data LAN and at least one VM on it; an account with the Access and manage DBaaS privilege; three addresses from the managed-service range of fc-data reserved for the cluster (FinCorp uses .4 to .6; Unit 3.1).
Build goal: Provision a cluster and connect.
Steps (in the Data Center Designer):
- Go to Menu > Databases > MongoDB and select Create cluster.
- In Properties, enter the Cluster Name
fc-mongo-cases, choose the Frankfurt Location, and select the MongoDB Version. - Choose the Enterprise edition.
- In Cluster configuration, set Database type to Replica Set and Instances to 3. Select a Backup Location outside Frankfurt. Leave BI Connector enabled off unless analysts need SQL access.
- In Resources, set the Number of CPUs and RAM Size per instance for the peak connection count from Section 1.4. Select SSD Premium as the Storage Type and a Storage Size of at least 100 GB.
- In Network configuration, select
fc-prod-fra-coreas the Datacenter andfc-dataas the Datacenter LAN, and enter one IP/Subnet for each of the three instances. - In Maintenance period, set a Day and a Start Time (UTC). Maintenance runs in a 4-hour window.
- Select Save. Wait until the cluster is available.
- Open the cluster, go to the User management tab and select Add user. Enter the User name, Password, a built-in Role such as
readWrite, and the Database name, then select Add. - From a VM on
fc-data, connect withmongoshand the cluster'smongodb+srvconnection string, and authenticate as the new user.
Common mistakes:
- Running production on Business with one instance. It has no redundancy and the lower SLA tier.
- Deleting a cluster to "start clean". Its snapshots go with it; dump first.
- Relying on seven days of snapshots for regulatory retention. Add scheduled dumps to Object Storage.
- Sizing RAM for the data alone. The connection limit follows RAM, and there is no managed pooler.
- Expecting to create users with MongoDB commands. Users are managed through the DCD or the API.
Summary
MongoDB fits FinCorp's case files because each case is read and written as one evolving document. The edition is the main decision: Enterprise gives dedicated cores, up to seven replica set members, sharding and point-in-time recovery; Business gives templated Cubes and one replica set. Continuity rests on seven days of snapshots, PITR on Enterprise, and dumps for anything longer, remembering that deleting a cluster deletes its snapshots.
Key Points:
- Business runs one replica set of 1 or 3 instances on Cubes; Enterprise runs on Dedicated Core Servers with up to seven members or a sharded cluster.
- Sharding multiplies the write ceiling of 30,000 IOPS by the shard count.
- Connections are capped by RAM, with no managed pooler.
- Snapshots last seven days; PITR covers up to 24 hours on Enterprise; destroying a cluster deletes its snapshots.
- Migration and long-term copies use
mongodumpandmongorestore.
Important Terminology:
- Replica set: a primary and its secondary members holding copies of the same data.
- Shard: one replica set in a sharded cluster, holding part of the data and taking part of the writes.
- Oplog: MongoDB's operation log, which point-in-time recovery replays to a chosen timestamp.