Thread: Version upgrades and replication

Version upgrades and replication

From
Gianni Ceccarelli
Date:
Hello all!

I have a primary+replica PostgreSQL that I think work fine.

I created the replica's data directory using::

    pg_basebackup -D $datadir -h $primary_host -U $replicauser \
                  --write-recovery-conf \
                  --create-slot --slot=$slotname

after creating the user on the primary (``CREATE ROLE replicauser WITH
REPLICATION PASSWORD 'password' LOGIN``) and allowing connections in
``pg_hba.conf``

Everything looks fine, changes on the primary can be seen on the
replica.

First question: what's the name of this replication mode? Every time I
try to read the documentation I get confused about which is which…

I initially created the replica on PostgreSQL 16. Yesterday I upgraded
to 17: stop the 16 primary, stop the 16 replica, ``pg_upgrade17`` on
the primary, start the 17 primary, re-do the whole base backup with
``pg_basebackup17`` on the replica, start the 17 replica, everything
works like before.

Second question: is there a better way to do that? Without having to
copy the whole cluster data again from scratch?

Thanks in advance!

--
    Dakkar - <Mobilis in mobile>
    GPG public key fingerprint = A071 E618 DD2C 5901 9574
                                 6FE2 40EA 9883 7519 3F88
                        key id = 0x75193F88