Closed vishrantgupta closed 2 years ago
Congrats, you killed your cluster.
Patroni relies not only on PGDATA, but also keeps externally (K8s Endpoints or ConfigMaps) the cluster state. Hence it knows that the cluster with such SCOPE already existed and refuses to initialize the new one despite PGDATA being empty.
You can verify it by running patronictl list
.
Please learn more about Patroni by going though the tutorial: https://github.com/patroni-training/2019
This was a completely new insallation using HELM chart https://github.com/helm/charts/tree/master/incubator/patroni and the spilio image, why PGDATA
should be empty? Where does it get initialized?
patronictl list
output
root@patroni-postgres-2:/home/postgres# patronictl list
+ Cluster: patroni-postgres (7053102555993124938) --------+----+-----------+
| Member | Host | Role | State | TL | Lag in MB |
+--------------------+----------------+---------+---------+----+-----------+
| patroni-postgres-0 | 10.233.90.15 | Replica | stopped | | unknown |
| patroni-postgres-1 | 10.233.96.211 | Replica | stopped | | unknown |
| patroni-postgres-2 | 10.233.105.110 | Replica | stopped | | unknown |
+--------------------+----------------+---------+---------+----+-----------+
This was a completely new insallation using HELM char
Sorry, but I trust patronictl list
output, which clearly tells that cluster with the name patroni-postgres
already existed, and I even can tell when it was created: Fri Jan 14 17:40:07 2022
I did create the cluster with the name patroni-postgres
on Fri Jan 14 17:40:07 2022 but I deleted the helm deployment using helm uninstall patroni-postgres
followed by deleting the PVC and PV (LocalVolume), I thought the Postgres has been completely removed but looks like that is not true.
Then I was deploying the helm chart with the same name patroni-postgres
, however deploying the chart with a different name fixes the issue.
I also tried patronictl remove patroni-postgres
but the outcome is same:
root@patroni-postgres-2:/home/postgres# patronictl remove patroni-postgres
+ Cluster: patroni-postgres (7053102555993124938) --------+----+-----------+
| Member | Host | Role | State | TL | Lag in MB |
+--------------------+----------------+---------+---------+----+-----------+
| patroni-postgres-0 | 10.233.90.15 | Replica | stopped | | unknown |
| patroni-postgres-1 | 10.233.96.211 | Replica | stopped | | unknown |
| patroni-postgres-2 | 10.233.105.110 | Replica | stopped | | unknown |
+--------------------+----------------+---------+---------+----+-----------+
Please confirm the cluster name to remove: patroni-postgres
You are about to remove all information in DCS for patroni-postgres, please type: "Yes I am aware": Yes I am aware
root@patroni-postgres-2:/home/postgres# patronictl list
+ Cluster: patroni-postgres (uninitialized) ----+---------+----+-----------+
| Member | Host | Role | State | TL | Lag in MB |
+--------------------+----------------+---------+---------+----+-----------+
| patroni-postgres-0 | 10.233.90.15 | Replica | stopped | | unknown |
| patroni-postgres-1 | 10.233.96.211 | Replica | stopped | | unknown |
| patroni-postgres-2 | 10.233.105.110 | Replica | stopped | | unknown |
+--------------------+----------------+---------+---------+----+-----------+
Patroni relies not only on PGDATA, but also keeps externally (K8s Endpoints or ConfigMaps) the cluster state. These objects are not created by helm chart and hence they are not removed either when you delete everything else.
This is the image I am using:
and the helm chart is https://github.com/helm/charts/tree/master/incubator/patroni
when I am installing it using
helm install patroni-postgres .
, the cluster is stuck in the leader election:/home/postgres/pgdata/pgroot/data
directory is empty.These are the running processes: