PBM Backup in MongoDB Replica Set: Do All pbm-agents Need to Be on the Same Host When Using File Storage?

In a MongoDB replica set with 1 primary and 2 secondary nodes, when performing a backup using Percona Backup for MongoDB (PBM), I understand that I need to start 3 pbm-agents, each connecting to one of the nodes. If I’m using file storage for the backup, do all 3 pbm-agents need to be on the same host?

Hi,

Yes, all agents should have read and write access to the same storage.

If you want to run all PBM Agents on a single host but the MongoDB nodes are on different ones, you can set backup.priority to try to do backup from the host. For example, the agent for the host’s node will perform a backup if suitable, but in case of a failure, pick a lower priority agent.

Keep in mind, that this setup is not recommended and could decrease agent backup/restore performance due to non-localhost network and shared CPU/mem usage. Better deploy each agent on the direct’s node host and share volume between them (like AWS S3 or Minio).