Replication with Patroni not working after killing secondary and starting again

From: Zb B <zbig(dot)poland(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Replication with Patroni not working after killing secondary and starting again
Date: 2022-04-27 13:27:34
Message-ID: CAKwARkZwQmB01nfUT3AyrbbCoMcAY3HB=nEAiy_EzPPf=nKaDg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I am new to Patroni and PostgreSQL.We have set up a cluster with etcd (3
nodes), Patroni (2 nodes) and PostgreSQL (2 nodes) with replication from
primary to secondary. Seemed to be working fine and we started some tests.
One of the tests gave us unsatisfactory results. Specifically when we start
a long transaction with multiple inserts (we use remote Java app for that)
and during execution of this transaction we kill the secondary database by
using the following:
first list the processes:
ps aux | egrep '(patroni|postgresql)'
and
uses the kill -9 command for the two processes that have postgres in the
name then the following happens:

1) Java app continues with the long transaction which is OK
2) Patroni is not restarting automatically again on the secondary, which I
assume is as expected (?)
3) When the transaction finishes and we start the patroni on secondary by
using the commands:
systemctl enable patroni
systemctl start patroni

the database starts on secondary after a while but the replication from
the primary is not working anymore. Trying new transactions does not
replicate the data either. The same set up worked before in other scenarios
- replicated data (e.g. when using short transactions, killing the
secondary, restarting secondary).

Thus my questions:
1) Is it normal that replication stops working if we kill secondary
postgres and start it again using patroni? Do we need to do any additional
steps except the commands above that start patroni?
2) Is it normal that patroni is not started again automatically after we
kill it and postgres on secondary?
3) Or there is something wrong with our setup and the replication should be
recovered automatically after we kill the secondary and start the patroni
again on secondary?

Thanks,

Zbigniew

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2022-04-27 13:36:24 Re: Fresh eyeballs needed: input into error
Previous Message Rob Sargent 2022-04-27 13:20:35 Re: Fresh eyeballs needed: input into error