Percona Backup for MongoDB config in a Cluster (or Non-sharded Replicaset)

The config information is stored in a single document of the admin.pbmConfig collection. That single copy is shared by all the pbm-agent processes in a cluster (or non-sharded replicaset), and can be read or updated using the pbm tool.

In short: you can see the whole config by running db.getSiblingDB(“admin”).pbmConfig.findOne(). But you don’t have to use the mongo shell; the pbm CLI has a “config” subcommand to read and update it.

As of v1.0 or v1.1 the config only contains the remote storage information.

Insert the whole Percona Backup for MongoDB Config from a YAML file

If you are initializing a cluster or non-sharded replicaset for the first time it is simplest to write the whole config as YAML file and use the pbm config --file method to upload all the values in one command.

$ pbm config --file pbm_config.yaml --mongodb-uri="mongodb://pbmuser:secretpwd@mongocsvr1:27018,mongocsvr2:27018,mongocsvr3:27018/?replicaSet=configrs"

Execute whilst connecting to config server replicaset if it is cluster. Otherwise just connect to the non-sharded replica set as normal. (See MongoDB connection strings - A Reminder (or Primer) if you are not familiar with MongoDB connection strings yet.)

Run pbm config --list to see the whole config. (Sensitive fields such as keys will be redacted.)

Example config files

S3-compatible remote storage

Amazon Simple Storage Service

  type: s3
    region: us-west-2
    bucket: pbm-test-bucket
      access-key-id: <your-access-key-id-here>
      secret-access-key: <your-secret-key-here>


  type: s3
    endpointUrl: "http://localhost:9000"
    region: my-region
    bucket: pbm-example
      access-key-id: <your-access-key-id-here>
      secret-access-key: <your-secret-key-here>

Remote Filesystem Server Storage

This storage must be a remote fileserver mounted to a local directory. It is the responsibility of the server administrators to guarantee that the same remote directory is mounted at exactly the same local path on all servers in the MongoDB cluster or non-sharded replicaset.


PBM uses the directory as if it was any normal directory, and does not attempt to confirm it is mounted from a remote server. If the path is accidentally a normal, local directory errors will eventually occur, most likely during a restore attempt. This will happen because pbm-agent processes of other nodes in the same replicaset can’t access backup archive files in a normal local directory on another server.

  type: filesystem
    path: /data/local_backups

Local Filesystem Storage

This cannot be used except if you have a single-node replicaset. (See warning note above as to why). We recommend using any object store you might be already familiar with for testing. If you don’t have an object store yet we recommend using Minio for testing as it has simple setup. If you plan to use a remote filesytem-type backup server please see “Remote Filesystem Server Storage” above.

Accessing or updating single config values

You can set a single value at time. For nested values use dot-concatenated key names as shown in the following example:

$ pbm config --set storage.s3.bucket="operator-testing"

To list a single value you can specify just the key name by itself and the value will be returned (if set)

$ pbm config storage.s3.bucket
$ pbm config storage.s3.INVALID-KEY
Error: unable to get config key: invalid config key