You're reading the open-source Community docs. Plakar also offers Control Plane, the enterprise version. It's a virtual appliance with a web-based interface for centralized backup management across your infrastructure. View Control Plane docs →

MongoDB

The MongoDB integration exports the contents of a MongoDB server into a Kloset store with encryption and deduplication, and restores them back to a server. It drives the MongoDB command line utilities rather than reading the data files directly, so a backup is a logical dump of a running server.

The MongoDB integration provides two connectors:

Connector type Description
Source connector Back up a MongoDB server into a Kloset store.
Destination connector Restore data from a Kloset store back to MongoDB.

Requirements

  • mongosh, mongodump, and mongorestore available in $PATH.

Installation

The MongoDB package can be installed using pre-built binaries or compiled from source.

Pre-compiled packages are available for common platforms and provide the simplest installation method.

Logging In

Pre-built packages require Plakar authentication. See Logging in to Plakar for details.

Install the MongoDB package:

$ plakar pkg add mongodb

Verify installation:

$ plakar pkg show

Source builds are useful when pre-built packages are unavailable or when customization is required.

Prerequisites:

  • Go toolchain compatible with your Plakar version

Build the package:

$ plakar pkg build mongodb

A package archive will be created in the current directory (e.g., mongodb_v1.0.0_darwin_arm64.ptar).

Install the package:

$ plakar pkg add -allow-unsigned ./mongodb_v1.0.0_darwin_arm64.ptar

Verify installation:

$ plakar pkg show

To list, upgrade, or remove the package, see managing packages guide.

Configuration

These options apply to both connectors.

Option Required Description
location Yes URL of the MongoDB server. Must begin with mongodb://.
port No The MongoDB server port. Defaults to 27017.
username No Username for authentication to MongoDB.
password No Password for authentication to MongoDB.
use_tls No Use an encrypted TLS/SSL connection. Defaults to true.

Source connector

The source connector dumps the contents of the MongoDB server with mongodump and stores the result in a Kloset store with encryption and deduplication.

flowchart LR

subgraph Source["MongoDB Server"]
  FS["Databases"]
end

subgraph Plakar["Plakar"]
  Connector["Export via
mongodump"] Transform["Encrypt & deduplicate"] Connector --> Transform end Source --> Connector Store["Kloset Store"] Transform --> Store

Register the source and run a backup:

$ plakar source add my-mongodb \
  location=mongodb://<MONGODB_HOST> \
  username=<YOUR_USERNAME> \
  password=<YOUR_PASSWORD>

$ plakar at /var/backups backup "@my-mongodb"

Destination connector

Restores data from a Kloset store back to a MongoDB server with mongorestore.

flowchart LR

Store["Kloset Store"]

subgraph Plakar["Plakar"]
  Transform["Decrypt & reconstruct"]
  Connector["Import via
mongorestore"] Transform --> Connector end Store --> Transform subgraph Destination["MongoDB Server"] FS["Databases"] end Connector --> Destination

Register the destination and restore a snapshot:

$ plakar destination add my-mongodb-restore \
  location=mongodb://<MONGODB_HOST> \
  username=<YOUR_USERNAME> \
  password=<YOUR_PASSWORD>

$ plakar at /var/backups restore -to "@my-mongodb-restore" <snapshot_id>