MongoDB Auto-Clustering
MongoDB Auto-Clustering
MongoDB Auto-Clustering automatically creates a reliable replica set and provides redundancy, data high availability, automatic node discovery during scaling, and automated failover.
MongoDB Auto-Clustering Benefits

MongoDB Auto-Clustering Specifics
A replica set contains at least three MongoDB instances that maintain the same data. One node is the Primary and handles all writes. Changes are recorded in the oplog and replicated to the Secondary members. If the Primary becomes unavailable, another active member is elected automatically.
These values can be reconfigured after installation with rs.reconfig().
Authentication and Storage
The platform automatically configures replica-set authentication in /etc/mongod.conf and creates the authentication key at /home/jelastic/mongodb.key. The key is added to redeploy.conf so it survives container lifecycle operations.
MongoDB uses WiredTiger by default. The documented internal-cache size is 50% of total RAM minus 1 GB, with a minimum of 256 MB. New nodes are added automatically during scale-out and removed automatically during scale-in.
Create a MongoDB Cluster
- Open New Environment, choose MongoDB, and enable Auto-Clustering.
- Configure resources, public IPs, region, and other required parameters.
- Click Create and wait while the platform configures the replica set.
- After installation, check the email containing replica-set credentials.




Application Connection Strings
Because a Secondary can become Primary after failover or restart, an application should not depend on one fixed Primary hostname. The source recommends including all member hostnames, the replica-set name, and a suitable read preference.
client = new MongoClient(
"mongodb://admin:cbfef7418d@node540102-mongo-cluster.madrid.jele.io:27017,node540096-mongo-cluster.madrid.jele.io:27017,node540099-mongo-cluster.madrid.jele.io:27017/admin",
{
useUnifiedTopology: true,
readPreference: 'primaryPreferred',
replicaSet: 'rs0'
}
);
External Connection through Endpoint
For an external application connection through the Shared Load Balancer, maintain a connection to the Primary through an endpoint. For this case, the source removes the replicaSet parameter.

client = new MongoClient(
"mongodb://admin:bfef7418d@node540102-mongo-cluster.madrid.jele.io:11013/admin",
{ useUnifiedTopology: true }
);
Administration and SSH Access
The auto-cluster uses Mongo Express as the administration panel, which supports MongoDB replica sets.

You can also connect through Web SSH:
mongosh -u {user} -p {password} {DB_name}
mongo for MongoDB 3.x/4.x and mongosh for MongoDB 6.x/7.x, with the same parameters.
Check Replica Set Status
Run the following command:
rs.status()

Use rs.conf() if you need to inspect the replica-set configuration.
Expected Result
A MongoDB replica set with at least three members is created automatically, with Primary election, Secondary replication, automatic scaling integration, internal authentication, and failover handling configured by the platform.
Important Notes
- The minimum MongoDB auto-cluster size is 3 nodes.
- The source recommends 4 GiB RAM (32 cloudlets) per replica-set node.
- The default replica-set name is
rs0. - The internal authentication key is stored at
/home/jelastic/mongodb.key. - Horizontal scaling automatically adds or removes replica-set members.
- Applications within one hosting platform should include all members and the replica-set name in their connection string.
- Use
rs.status()to check cluster state andrs.conf()to inspect configuration.
