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

**URL:** <https://forums.percona.com/t/pbm-backup-in-mongodb-replica-set-do-all-pbm-agents-need-to-be-on-the-same-host-when-using-file-storage/32223>\
**Category:** Percona Backup for MongoDB\
**Created:** [August 12, 2024, 10:00am UTC](https://forums.percona.com/t/pbm-backup-in-mongodb-replica-set-do-all-pbm-agents-need-to-be-on-the-same-host-when-using-file-storage/32223 "2024-08-12T10:00:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![337828064](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/337828064/32/17635_2.png) [@337828064](https://forums.percona.com/u/337828064)\
**Post date:** [August 12, 2024, 10:00am UTC](https://forums.percona.com/t/pbm-backup-in-mongodb-replica-set-do-all-pbm-agents-need-to-be-on-the-same-host-when-using-file-storage/32223/1 "2024-08-12T10:00:52Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Dmytro\_Zghoba](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/dmytro_zghoba/32/4721_2.png) [@Dmytro\_Zghoba](https://forums.percona.com/u/Dmytro_Zghoba)\
**Post date:** [August 12, 2024, 10:27am UTC](https://forums.percona.com/t/pbm-backup-in-mongodb-replica-set-do-all-pbm-agents-need-to-be-on-the-same-host-when-using-file-storage/32223/2 "2024-08-12T10:27:32Z")

</div>

Hi,

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

---

<div class="post-metadata">

**Author:** ![Dmytro\_Zghoba](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/dmytro_zghoba/32/4721_2.png) [@Dmytro\_Zghoba](https://forums.percona.com/u/Dmytro_Zghoba)\
**Post date:** [August 12, 2024, 10:43am UTC](https://forums.percona.com/t/pbm-backup-in-mongodb-replica-set-do-all-pbm-agents-need-to-be-on-the-same-host-when-using-file-storage/32223/3 "2024-08-12T10:43:32Z")

</div>

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](https://docs.percona.com/percona-backup-mongodb/reference/backup-options.html#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).
