Replication with Patroni not working after killing secondary and starting again - Mailing list pgsql-general

From Zb B
Subject Replication with Patroni not working after killing secondary and starting again
Date
Msg-id CAKwARkZwQmB01nfUT3AyrbbCoMcAY3HB=nEAiy_EzPPf=nKaDg@mail.gmail.com
Whole thread Raw
Responses Re: Replication with Patroni not working after killing secondary and starting again  ("Peter J. Holzer" <hjp-pgsql@hjp.at>)
List 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

pgsql-general by date:

Previous
From: Rob Sargent
Date:
Subject: Re: Fresh eyeballs needed: input into error
Next
From: Rich Shepard
Date:
Subject: Re: Fresh eyeballs needed: input into error