The remaining part of the chapter about physical replication consisted mainly of a walk-through the replication setup steps. It is recommended to replicate clusters on machines with the same hardware parameters – this way replicas can reuse configuration from primary node without risk of running out of resources.
Having multiple replicas can put too much strain on the primary node, therefore a cascading system is recommended. It means that only one replica sources from primary node while other replicas source from each other.
In case the primary node goes down, we need to promote one of the replicas. This can not be automated with native Postgres tools – a human intervention is required. Use pg_ctl promote -D /path/to/PostgreSQL/<viersion>/main command to promote a replica to a primary node. Keep in mind that after the promotion old primary node becomes unrecoverable and you will likely suffer data loss.