How to Install and Configure PgBouncer for Veeam Backup for Microsoft 365
| KB ID: | 4728 |
| Product: | Veeam Backup for Microsoft 365 | 8.1 | 8.2 | 8.3 | 8.4 | 8.5 |
| Published: | 2025-07-18 |
| Last Modified: | 2026-07-16 |
This article is intended only for deployments where the PostgreSQL Instance used by Veeam Backup for Microsoft 365 is hosted on its own dedicated server.
For deployments of Veeam Backup for Microsoft 365 where the PostgreSQL instance is installed on the same machine as Veeam Backup for Microsoft 365, PgBouncer must not be deployed.
Review KB4758: PostgreSQL and PgBouncer Sizing and Configuration Guide for advice on whether the PostgreSQL instance should be deployed on its own dedicated server based on the Veeam Backup for Microsoft 365 deployment size. If the guidance in that article indicates that PostgreSQL should be hosted on a dedicated server, consider migration (review: KB4676: How to Migrate the Configuration and Repository Cache Databases).
Purpose
Cause
Why should you deploy PgBouncer?
Each proxy and repository must connect to the PostgreSQL database when using Veeam Backup for Microsoft 365. This can quickly create thousands of separate database connections in larger environments, overloading the PostgreSQL server’s resources and network, causing performance issues.
PgBouncer helps by pooling those connections. Instead of every proxy making its own connection, PgBouncer groups them and reuses connections efficiently. This dramatically reduces the total number of database connections and lowers the strain on the PostgreSQL server, making the system more stable and reliable.
Solution
Depending on the number of proxies or repositories, you may require more precise configuration tunings for PostgreSQL and PgBouncer parameters.
KB4758: PostgreSQL and PgBouncer Sizing and Configuration Guide
Part 1: Prepare PostgreSQL Configuration
-
Using pgAdmin, or the PostgreSQL DB management tool of your choosing, create a dedicated user within the PostgreSQL instance for PgBouncer to use.
- Using the Query Tool, and making sure the 'postgres' db is targeted, create a user lookup function to allow PgBouncer to authenticate users via PostgreSQL:
- Open the
pg_hba.confFound in: C:\Program Files\PostgreSQL\16\data\file and verify that it contains rules to accept local connections.
# TYPE DATABASE USER ADDRESS METHOD local all all scram-sha-256 host all all 127.0.0.1/32 scram-sha-256 host all all ::1/128 scram-sha-256
- If any changes were made to the
pg_hba.conffile, then restart the PostgreSQL service.
Part 2: Install and Configure PgBouncer
Since PgBouncer must be installed on the same machine as the existing PostgreSQL instance, the instructions depend on the OS of the machine where PostgreSQL is installed.
Expand the appropriate section.
Part 3: Configure Veeam Backup for Microsoft 365
In the Veeam Backup for Microsoft 365 settings, change the port used to connect to PostgreSQL to the one used by PgBouncer.
- Perform the following steps on the VB365 server machine:
- Ensure no backup or restore tasks are running.
- Stop the Veeam.Archiver.Service and the Veeam.Archiver.Proxy services.
- Navigate to:
C:\ProgramData\Veeam\Backup365\
- Make a copy of
Config.xmlandProxy.xmlin case changes need to be reverted or a misconfiguration occurs. - Open the
Config.xmlfile, and within the<Archiver>section, change theport=value to 6432 for the following sections:-
<ControllerPostgres ControllerConnectionString="host=VB365;port=5432
-
<RemoteProxyDeploymentSettings ControllerConnectionStringForProxy="host=VB365;port=5432
-
PersistentCacheConnectionStringTemplate="host=VB365;port=5432
This entry is on the same line as "<RemoteProxyDeploymentSettings"
-
- Open the
Proxy.xmlfile, and within the<Archiver>section, change theport=value to 6432 for the following sections:-
<ProxyPostgres ControllerConnectionString="host=testvm;port=5432
-
<PersistentCachePostgres PersistentCacheConnectionString="host=testvm;port=5432
-
- Save the updated
Config.xmlandProxy.xmlfiles. - Start the Veeam.Archiver.Service and the Veeam.Archiver.Proxy services.
- Reopen the
Config.xmlandProxy.xmlfiles and confirm that all port values you set to 6432 are still set that way.
The Veeam.Archiver.Service will attempt to repair the xml files if it detects a misconfiguration, so the recheck is to make sure the changes were accepted and implemented.
- Update the configuration of all remote backup proxies:
- Open the Veeam Backup for Microsoft 365 console.
- Switch to the Backup Infrastructure node.
- Select all proxies and click the Upgrade button.
If this KB article did not resolve your issue or you need further assistance with Veeam software, please create a Veeam Support Case.
To submit feedback regarding this article, please click this link: Send Article Feedback
To report a typo on this page, highlight the typo with your mouse and press CTRL + Enter.