There's more...

Barman does not have a mode to initialize the newly-restored server as a streaming replica of the original. To do this, create a file named recovery.conf in the /db/pgdata directory with the following contents before starting PostgreSQL:

standby_mode = 'on' 
primary_conninfo = 'host=pg-primary user=postgres' 

If you've followed the recipes in the previous chapters, you may also consider using the rep_user user instead, as we created it specifically for replication purposes.

Get PostgreSQL High Availability Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.