Of course, this process does not lend itself well to extremely large database installations. Beyond a few hundred gigabytes, erasing all of the data and resynchronizing is extremely time, network, and IO intensive. For these scenarios, we recommend a different technique. Before starting Patroni, we can manually synchronize the data files with rsync.
These are the commands we might use when rebuilding pg2 from the contents of pg1 if we have SSH keys in place:
psql -U rep_user -h pg1 \ -c "SELECT pg_start_backup('resync', TRUE);" postgres rsync -av --delete-after postgres@pg1:/db/pgdata /db psql -U rep_user -h pg1 postgres\ -c "SELECT pg_stop_backup();" rm /db/pgdata/postmaster*
Some more experienced DBAs might recognize ...