Integration with other tools

Integrating Patroni with external backup and orchestration tools.

Source: https://patroni.readthedocs.io/en/latest/tools_integration.html

Patroni is able to integrate with other tools in your stack. In this section you will find a list of examples, which although not an exhaustive list, might provide you with ideas on how Patroni can integrate with other tools.


Barman

Patroni delivers an application named patroni_barman which has logic to communicate with pg-backup-api, so you are able to perform Barman operations remotely.

This application currently has a couple of sub-commands: recover and config-switch.

patroni_barman recover

The recover sub-command can be used as a custom bootstrap or custom replica creation method. You can find more information about that in replica_imaging_and_bootstrap.

patroni_barman config-switch

The config-switch sub-command is designed to be used as an on_role_change callback in Patroni. As an example, assume you are streaming WALs from your current primary to your Barman host. In the event of a failover in the cluster you might want to start streaming WALs from the new primary. You can accomplish this by using patroni_barman config-switch as the on_role_change callback.

This is an example of how you can configure Patroni to apply a configuration model in case this Patroni node is promoted to primary:

postgresql:
    callbacks:
        on_role_change: >
            patroni_barman
                --api-url YOUR_API_URL
                config-switch
                --barman-server YOUR_BARMAN_SERVER_NAME
                --barman-model YOUR_BARMAN_MODEL_NAME
                --switch-when promoted

Last Modified 2026-03-02: adjust patroni docs link (9b5097c)