reactive-tech / kubegres

Kubegres is a Kubernetes operator allowing to deploy one or many clusters of PostgreSql instances and manage databases replication, failover and backup.
https://www.kubegres.io
Apache License 2.0
1.32k stars 74 forks source link

Replicas are not synced completely #160

Closed marczahn closed 1 year ago

marczahn commented 1 year ago

I have set up a Postgres on Kubernetes cluster with Kubegres with 3 instances - 1 master and 2 replicas. Now, I am facing the problem that the replication doesn't really work. What is synced, is when databased are newly created. What is not synced:

I went through those steps: https://www.kubegres.io/doc/getting-started.html Did I miss sth.? I am also not sure if it is part of postgres itself or kubegres.

This is the log of one of the replicas:

2023-07-24 12:46:31.983 GMT [1] LOG:  starting PostgreSQL 12.4 (Debian 12.4-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
2023-07-24 12:46:31.983 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2023-07-24 12:46:31.983 GMT [1] LOG:  listening on IPv6 address "::", port 5432
2023-07-24 12:46:31.986 GMT [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-07-24 12:46:31.995 GMT [26] LOG:  database system was interrupted; last known up at 2023-07-24 12:46:30 GMT
2023-07-24 12:46:32.071 GMT [26] LOG:  entering standby mode
2023-07-24 12:46:32.074 GMT [26] LOG:  redo starts at 0/E000028
2023-07-24 12:46:32.075 GMT [26] LOG:  consistent recovery state reached at 0/E000100
2023-07-24 12:46:32.075 GMT [1] LOG:  database system is ready to accept read only connections
2023-07-24 12:46:32.079 GMT [30] LOG:  started streaming WAL from primary at 0/F000000 on timeline 4

When I delete a database from the master, it's not deleted from the replicas. When I try to remove it from the replicas explicitly, then I get the error that it is a read-only transaction (as expected).

This might be related to https://github.com/reactive-tech/kubegres/issues/59 , but seems not to be the same.

alex-arica commented 1 year ago

I was not able to reproduce this issue. I created new table in the primary and I can see it in the replica. And when I insert new data in the new table and it is replicated to replicas.

Could you please upgrade to the latest version of Kubegres and try again?

marczahn commented 1 year ago

Hi Alex, I don't work there anymore and have currently too much to do to deal with it. I'll close it for now and open this issue later in case it pops up again.

alex-arica commented 1 year ago

Thank you.