Skip to main content
Altcraft Docs LogoAltcraft Docs Logo
User guide iconUser guide
Developer guide iconDeveloper guide
Admin guide iconAdmin guide
English
  • Русский
  • English
Login
    Getting StartedAdministrator documentationFunctional characteristics
      Technology descriptionarrow
    • Architecture OverviewComponent Description
        Deployment schemesarrow
      • Basic schemeFail-safe schemeTypical Placement in Infrastructure
    System requirements
      Admin Panelarrow
      • Account areaarrow
        • Accountsarrow
        • Account UsersAccount Virtual SendersAccount Database Indexes
        TariffsExternal data configurationLDAPTasksSchedule JobsGlobal Stop ListsWebversion Store Policies
        Settingsarrow
      • Databases
          Accessarrow
        • AdminsAPI tokens
        Notifiers
          MTAarrow
        • Default rulesRetry rulesLock rulesBounce patternsStrategiesKeysISPsPools
      Nodes
        Sendersarrow
      • EmailSMSEvent generatorIntegration with Altcraft Cloud SMTPIntegration with Sendsay
        Reportsarrow
      • Audit JournalData Usage
        Toolsarrow
      • ARF decoderURL decoderSMID decoderLicense
      Platform installationarrow
    • Automatic installationManual installationRunning the platform in a Docker container
      Platform configurationarrow
    • Configuration fileDomain settingsLDAP access configurationSending Email via SMTP relayPixel and push domain configurationCluster and Replication SetupSystem notifications configurationProcesses UNIX sockets configurationHTTPS ConfigurationMigrating from MongoDB Community to Percona ServerAdding sender IP addressesData Encryption in Percona Server for MongoDBDeduplication request settingsBackup with Percona Backup for MongoDBPostgreSQL database for Market dataProxy server settingsKeycloak Integration with AltcraftGetting HTTP service statusesConfiguring MongoDB log rotation
        Configuration of system constants and directoriesarrow
      • Filtering bot actionsDirectory of gender markers
      Custom Channelsarrow
    • Creating a Channel
        Pipelinesarrow
      • MessageScheduleListenerModerateStop
          Pipesarrow
        • HTTP RequestPackUnpackEventerSchedulerSelectorSQLStore SetStore GetLogResultErrorRMQ Publisher
      External Objects (Entities)Templating LanguageSending FilesPresets (Field Sets)DebuggingTechnical Limitations
      Platform maintenancearrow
    • Personnel requirementsPlatform maintenance processesPlatform updatingBackup and recoveryTransferring the platform to a new serverCreating, deleting, and populating tables for statistics in ClickHouseUsing the aktool utilityUsers and directories engaged by the platformPlatform service monitoringProcess and mailing monitoring via Prometheus
      Extraarrow
    • System page customizationSend Message IDClickHouse History Migration GuideInstructions for migrating history to ClickHouseUtility for importing push subscriptions to Firebase projectUtility for importing push subscriptions to Firebase projectENS: настройка интеграции
    Processing HTTP/HTTPS traffic
      Administrator APIarrow
      • Accounts admin apiarrow
        • Restricted accessarrow
        • Account Activation and DeactivationAccount Freeze and Unfreeze
        Get accounts listAdd a new accountDelete the account
        Account usersarrow
      • Update an Existing AccountAdd a new userDelete a userGet a list of usersSending a Welcome Email
        Nodesarrow
      • Synchronize node MTA configurationGet nodes listGet node MTA statusActivate node MTADeactivate node MTA
        Senders admin apiarrow
      • Create or update AKMTA senderGet AKMTA sender informationAssign account to senderGet senders listDelete senderRestore sender
          Sender queuearrow
        • Get sender queue informationHold sender queueRelease sender queueClear sender queue
        Virtual sendersarrow
      • Get virtual senders listGet virtual sender informationCreate virtual senderUpdate virtual senderClone virtual senderDelete virtual sender
    Documentation Archive
  • Platform configuration
  • Backup with Percona Backup for MongoDB

Backup with Percona Backup for MongoDB

Percona Backup for MongoDB (PBM) is an open-source distributed solution for consistent backup and restore of MongoDB clusters and replica sets. PBM supports physical, logical, incremental, and selective backups, as well as point-in-time recovery.

info

PBM is compatible with Percona Server for MongoDB and MongoDB Community/Enterprise Edition. Current version — 2.15.0 (June 2026).

Installation​

  • Ubuntu / Debian
  • RHEL / CentOS / RED OS
# Install percona-release
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb

# Enable PBM repository
sudo percona-release enable -y pbm

# Install PBM
sudo apt update
sudo apt install -y percona-backup-mongodb
# Install percona-release
sudo yum install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm

# Enable PBM repository
sudo percona-release enable -y pbm

# Install PBM
sudo yum install -y percona-backup-mongodb

After installation, the following tools are available:

ToolPurpose
pbmCLI for managing backups
pbm-agentAgent that runs backup/restore on the MongoDB server
pbm-speed-testTest compression and backup upload speed
info

Install pbm-agent on every server running mongod (except arbiters). pbm CLI can be installed on any computer with access to MongoDB.

Initial Setup​

Step 1: Create PBM Role and User in MongoDB​

Connect to the primary node of the replica set via mongosh and run:

// Connect to admin database: mongosh admin
// Create a role that allows any action on any resource
db.createRole({
role: "pbmAnyAction",
privileges: [{
resource: { anyResource: true },
actions: ["anyAction"]
}],
roles: []
})

// Create the PBM user
db.createUser({
user: "pbmUser",
pwd: "pbmPassword",
roles: [
{ role: "readWrite", db: "admin" },
{ role: "backup", db: "admin" },
{ role: "clusterMonitor", db: "admin" },
{ role: "restore", db: "admin" },
{ role: "pbmAnyAction", db: "admin" }
]
})

Step 2: Start pbm-agent​

Start pbm-agent on each replica set member:

systemctl enable pbm-agent
systemctl start pbm-agent
systemctl status pbm-agent

Step 3: Upload Storage Configuration​

Create a YAML file with storage parameters and upload it via pbm config:

cat > /tmp/pbm_config.yaml << 'EOF'
storage:
type: filesystem
filesystem:
path: /var/backups/pbm
EOF

pbm config --file /tmp/pbm_config.yaml
  • Local Filesystem
  • AWS S3 / S3-compatible
  • MinIO
storage:
type: filesystem
filesystem:
path: /var/backups/pbm
storage:
type: s3
s3:
region: us-east-1
bucket: my-pbm-backups
credentials:
access-key-id: AKIAIOSFODNN7EXAMPLE
secret-access-key: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
storage:
type: s3
s3:
region: us-east-1
bucket: my-pbm-backups
endpointUrl: https://minio.example.com
credentials:
access-key-id: minioadmin
secret-access-key: minioadmin

Step 4: Verify Status​

pbm status

Expected output:

Cluster:
========
rs0:
- mongo-node:27017 [P]: pbm-agent [v2.15.0] OK

PITR incremental backup:
========================
Status [OFF]

Currently running:
==================
(none)

Backups:
========
Main storage:
Type: FS
Path: /var/backups/pbm
(no snapshots or PITR chunks)

Backup Types​

PBM supports several backup types:

TypeDescriptionWhen to use
PhysicalCopies data files at the filesystem levelFull backup, fast restore
LogicalExports data via MongoDB APICross-version migration
IncrementalCopies only data changed since the previous backup in the chainSave space, frequent backups
SelectiveBackup specific databases or collectionsBackup individual components

Physical Backup​

A physical backup copies data files at the filesystem level. It is faster than logical but requires direct access to data files:

pbm backup --type physical
caution

Physical backup does not work in Docker containers (no access to WiredTiger journal files). Use logical backup for Docker deployments.

Logical Backup​

Logical backup is the default type. It exports data via MongoDB API and works in any environment:

pbm backup

Incremental Backup​

An incremental backup copies only data changed since the previous backup in the chain. The first incremental backup is created with the --base flag — it becomes the base for subsequent ones:

# First incremental backup (base for the chain)
pbm backup --type incremental --base

# Subsequent incremental backups
pbm backup --type incremental
caution

Incremental backup works at the WiredTiger file level and is not supported in Docker containers. Use logical backups for Docker deployments.

tip

Incremental backups significantly save space and time. Recommended schedule: full backup weekly + incremental daily.

Selective Backup​

Backup a specific database:

pbm backup --ns "mydb.*"

Backup a specific collection:

pbm backup --ns "mydb.mycollection"

Point-in-Time Recovery​

PBM supports restoring to a specific point in time using oplog chunks.

Enable PITR​

pbm config --set 'pitr.enabled=true'

The pitr.oplogSpanMin parameter sets the interval for saving oplog chunks (in minutes, default 1):

pbm config --set 'pitr.oplogSpanMin=5'
caution

After a restore, PITR stops. To resume PITR, you need to create a new backup:

pbm backup --wait

Restore to a Specific Point in Time​

pbm restore --time 2026-08-07T14:30:00 -y

Time format: YYYY-MM-DDTHH:MM:SS (no timezone suffix).

Backup Management​

List Backups​

pbm list

Backup Details​

pbm describe-backup backup-2026-08-07

Delete Backup​

pbm delete-backup backup-2026-08-07 -y

Cancel Backup​

pbm cancel-backup

Restore​

Restore from Backup​

pbm restore backup-2026-08-07 -y --wait
info

Logical restore runs on a running cluster. Physical restore requires mongod to be stopped.

Selective Restore​

Restore a specific database:

pbm restore backup-2026-08-07 --ns "mydb.*" -y

Restore a specific collection:

pbm restore backup-2026-08-07 --ns "mydb.mycollection" -y

Collection Cloning during Restore​

Create a copy of a collection with a different name:

pbm restore backup-2026-08-07 --ns-from "mydb.source" --ns-to "mydb.clone" -y

Backup Compression​

Enable compression to save space:

pbm config --set 'backup.compression=gzip'

Available algorithms: gzip, snappy, lz4, s2, pgzip, zstd.

info

Backups of encrypted data are stored in encrypted form. The encryption key must be available on the server during restore. For details on encryption, see Data Encryption in Percona Server for MongoDB.

Last updated on Aug 10, 2026
Previous
Deduplication request settings
Next
PostgreSQL database for Market data
  • Installation
  • Initial Setup
    • Step 1: Create PBM Role and User in MongoDB
    • Step 2: Start pbm-agent
    • Step 3: Upload Storage Configuration
    • Step 4: Verify Status
  • Backup Types
    • Physical Backup
    • Logical Backup
    • Incremental Backup
    • Selective Backup
  • Point-in-Time Recovery
    • Enable PITR
    • Restore to a Specific Point in Time
  • Backup Management
    • List Backups
    • Backup Details
    • Delete Backup
    • Cancel Backup
  • Restore
    • Restore from Backup
    • Selective Restore
    • Collection Cloning during Restore
  • Backup Compression
© 2015 - 2026 Altcraft, LLC. All rights reserved.