Prior to a poc, will the below work ? is it a good practice or not?
I want to have DC1 (Active) and DC2 (hot standby) - same infrastructure
One HAProxy, Cluster o f 3 ETCD as the DCS, 2 VM's, each includes PG (12v/11.6v) &Patroni
(Since ETCD needs odd num' of nodes, what is the best for me to pick in this scenario below?)
latency between DC's < 5ms.
I don't want lose data, therefore i want that DC2 will be sync.
Can i set on DC1 that its two PG&Patroni to work in sync and on DC2, one PG&Patroni as sync
and the other as Async.
3 etcd nodes must be geographically distributed across 3 DC.
Since you have only 2 DC, your setup will not work.
That's quite a lot of questions.
If you have only two DC there is no way to distinguish between DC is being down or network between them is down. So yes, if one DC can't see another one you will get read-only in both of them in order to avoid split-brain.
5ms latency is quite a lot for sync replication, it will be added to every transaction. Think about it. Do you really want your app to become so slow?
Why vacuum should interrupt Patroni? Just be careful, give Patroni enough resources and don't share the same storage between etcd and postgres.
The third location is only necessary for Etcd, you don't have to run Patroni/Postgres there.
From my experience, 5ms latency isn't a problem for etcd with the default settings, but I would still recommend you to read about etcd tuning.
I would personally consider doing a sync replication only when RTT between DC is around 1ms or less.
Your concern about autovacuum I don't really understand, it is a part of normal postgres activity.
Regard vacuum - if it happens during replication to the other DC, assuming the other DC is working in async. Won't i lose some of my data, as the Vacuum is cleaning / compressing and on the other hand i am sending the replication stream ?
Regard the same DC, 2 PG&Patroni controlled by one etcd will work or should i have
at least 3 PG&Patroni + x etcd?
Won't i lose some of my data, as the Vacuum is cleaning / compressing and on the other hand i am sending the replication stream ?
Patroni is niether implementing or triggering the autovacuum, so I really don't understand why you are asking a general postgres question here.
or should i have at least 3 PG&Patroni + x etcd?
It is up to you. Having only two postgres/patroni is enough for HA. Etcd is a different story, you must have at least 3 of them.
Most helpful comment
Patroni is niether implementing or triggering the autovacuum, so I really don't understand why you are asking a general postgres question here.
It is up to you. Having only two postgres/patroni is enough for HA. Etcd is a different story, you must have at least 3 of them.