---
title: "MongoDB hosting on Edge | Self-hosted replica sets"
description: "Run MongoDB on Edge: a three-node replica set on dedicated NVMe, joined by a free private network, with mongodump archives in S3-compatible storage."
url: https://edge.network/solutions/mongodb
---

For MongoDB

# A MongoDB replica set, priced like three VMs

MongoDB Community on dedicated vCPUs and local NVMe: a three-node replica set on a free private network, with compressed archives in S3-compatible storage. Your drivers and connection strings stay as they are.

[Deploy a VM](/console/access/new?product=compute)[Have our engineers run MongoDB](/solutions/expert-services)

The setup on this page costs $118.56 a month, with no egress line.

Why MongoDB on Edge

## Replica-set members on local NVMe

WiredTiger gets fast local disk. Members talk over a free private network, and backups are priced as storage.

-   ### NVMe for hot working sets
    
    WiredTiger thrives on fast disk. Local NVMe on every member keeps the working set hot and p99 latency sane.
    
-   ### Replica sets across VMs
    
    Three members on separate VMs, joined by a private network. Automatic elections and failover, with no premium for them.
    
-   ### mongodump to S3
    
    Stream compressed archives to Edge Storage from a secondary, restore with mongorestore. No per-snapshot fees.
    
-   ### Search your way
    
    Text indexes for simple cases, or Meilisearch or OpenSearch on another VM when you need real full-text search.
    
-   ### Community or Enterprise
    
    MongoDB Community Server runs cleanly. If you hold an Enterprise licence, the same install pattern applies.
    
-   ### Official drivers, unchanged
    
    Same wire protocol and connection strings. Point your driver at the replica set and carry on.
    

Reference architecture

## rs0: three members on one private network

A three-node replica set with NVMe on every member, apps connecting over the private network and archives in a bucket.

-   [Compute](/compute)
    
    Three VMs forming the replica set, each with its data directory on local NVMe.
    
-   [Compute](/compute)
    
    Optional Meilisearch or OpenSearch VM when you need full-text search.
    
-   [Storage](/storage)
    
    Holds mongodump archives, or Percona Backup for MongoDB snapshots and oplog chunks.
    
-   [DNS](/dns)
    
    Records for each member's private address, used in the replica-set connection string.
    

Deploy

## Initiate rs0 from one bootstrap script

Save one bootstrap, create three members from it, and initiate the set from the first.

1.  01
    
    ### Save a MongoDB bootstrap
    
    Installs MongoDB 8.0 from MongoDB's own apt repository for Ubuntu 24.04.
    
    mongodb.sh
    
    ```
    #!/bin/bash
    set -e
    export DEBIAN_FRONTEND=noninteractive
    curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
      gpg --dearmor -o /usr/share/keyrings/mongodb-8.0.gpg
    echo "deb [signed-by=/usr/share/keyrings/mongodb-8.0.gpg] \
    https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" \
      > /etc/apt/sources.list.d/mongodb-org-8.0.list
    apt-get update && apt-get install -y mongodb-org
    systemctl enable --now mongod
    ```
    
2.  02
    
    ### Create three members
    
    Attach all three to one private network, allow 27017 from that range only, and add each member's private IP to /etc/hosts.
    
    shell
    
    ```
    $ edge compute scripts create --name mongodb-8 --file mongodb.sh
    
    $ for n in 1 2 3; do
        edge compute create --name mongo-$n --size s-4vcpu-8gb \
          --image ubuntu-24 --region london --script mongodb-8
      done
    ```
    
3.  03
    
    ### Configure the replica set
    
    Same file on every member, each with its own private IP and a shared keyfile. The keyfile also switches on authentication.
    
    /etc/mongod.conf
    
    ```
    net:
      port: 27017
      bindIp: 127.0.0.1,10.185.0.5
    replication:
      replSetName: rs0
    security:
      keyFile: /etc/mongo-keyfile
    ```
    
4.  04
    
    ### Initiate the set and schedule backups
    
    Run rs.initiate on mongo-1 itself, then create your admin user. Dump nightly from a secondary so the primary keeps its cache.
    
    shell
    
    ```
    # on mongo-1
    $ mongosh --eval 'rs.initiate({ _id: "rs0", members: [
        { _id: 0, host: "mongo-1:27017" },
        { _id: 1, host: "mongo-2:27017" },
        { _id: 2, host: "mongo-3:27017" } ] })'
    
    $ mongodump --uri "$MONGO_URI" --readPreference=secondary \
        --oplog --archive --gzip | \
      aws s3 cp - s3://mongo-backups/$(date +%F).gz \
        --endpoint-url https://storage.edge.network
    ```
    

Prefer to hand it off? [Give the job to your AI agent](/solutions/agentic-development) or [have our engineers do it](/solutions/expert-services).

What it costs

## What rs0 costs each month

Three VMs and a bucket. No per-IOPS provisioning, no per-snapshot fees and no charge for traffic between members.

-   No per-IOPS or per-snapshot lines
-   Traffic between members on the private network is free
-   Community Server carries no licence fee

[See compute pricing](/compute/pricing)

Estimated monthly bill on Edge

3-node replica set, ~100 GB of data, nightly dumps kept 14 days

USD

-   Compute$115.413 × Performance VM (4 vCPU, 8 GiB, 160 GB NVMe) at $38.47 each
-   Storage$3.15215 GB of compressed archives: first 5 GB free, then 210 GB × $0.015
-   DNS$0.00Private records for each member
-   Egress$0.00

Total$118.56

FAQ

## Leaving Atlas, keeping your drivers

Something else? [Ask an engineer](/contact).

How does this compare to Atlas?

Cheaper, with no IOPS provisioning, snapshot fees or inter-zone transfer charges, and you keep root. The trade-off: you own backups, upgrades and member provisioning, or our Expert Services team does.

Can I use the official drivers unchanged?

Yes. Point the driver at the member hostnames with replicaSet=rs0 in the connection string. Same wire protocol, same client libraries.

What about point-in-time recovery?

mongodump with --oplog gives consistent nightly archives. For true point-in-time recovery, Percona Backup for MongoDB writes snapshots and continuous oplog chunks to an S3-compatible bucket such as Edge Storage.

Can members live in different regions?

Private networks are per region, so keep the voting members together in one region. A member elsewhere has to connect over public IPs, with TLS and a security group limiting 27017 to the other members.

Can I shard?

Yes. Config servers, mongos routers and shards are all just more VMs, each running the same bootstrap with a different role.

Related stacks

## Other databases, plus Payload on MongoDB

[All 38 stacks](/solutions/stacks)

-   [PostgreSQLSelf-hosted Postgres on dedicated NVMe](/solutions/postgresql)
-   [RedisIn-memory cache and queue, your way](/solutions/redis)
-   [MySQLMySQL or MariaDB on real VMs](/solutions/mysql)
-   [PayloadTypeScript-first headless CMS, Next.js-ready](/solutions/payload)

## Move your replica set off Atlas

Start free. Migrate from Atlas or stand up a fresh replica set; Expert Services can plan the cutover.

[Deploy a VM](/console/access/new?product=compute)[Plan an Atlas migration with us](/solutions/expert-services)

Billed hourly from a prepaid balance. Egress is free on every product.
