E
E
EvnMiller2021-10-28 16:05:30
PostgreSQL
EvnMiller, 2021-10-28 16:05:30

How to check last used postgresql 14 replication slot?

I write a crutch - manual failover. The output of the last used postgtresql 14 streaming replication slot is needed for the command:

pg_basebackup -h $MIP -D /home/$USER/compose/postgres-data/  -U replica -P -v  -R -X stream -C -S standby1

To replace standby1 with a variable and specify the value +1 when starting the script. I would be very grateful for any answer.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Melkij, 2021-10-28
@EvnMiller

Think about the question "why". Choose something more predictable for the slot name, it will be easier to script and easier to maintain. For example, the hostname of this replica.
Well, if you want to do it inconveniently - take the slot_name from pg_replication_slots, cut off the unnecessary, bring it to the number

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question