Reconnect a Node
You might need to manually reconnect a node if your organization uses the following configuration (typically in a non-production deployment of the platform):
Keycloak for access management
PostgreSQL high-availability (HA) deployment for a database
Pgpool for load balancing
repmgr for replication and failover
In the unlikely event that a primary node fails, repmgr will promote a standby instance to be the primary node. When the original primary node recovers, repmgr marks it as inactive, and Pgpool excludes this node from load balancing.
To see the current status of repmgr within the cluster, run this command:
kubectl -n <namespace> exec -it postgresql-ha-postgresql-1 -- bash -c "/opt/bitnami/scripts/postgresql-repmgr/entrypoint.sh repmgr -f /opt/bitnami/repmgr/conf/repmgr.conf cluster show"
The output will look similar to the following:
➜ Dev kubectl -n test1 exec -it postgresql-ha-postgresql-1 -- bash -c "/opt/bitnami/scripts/postgresql-repmgr/entrypoint.sh repmgr -f /opt/bitnami/repmgr/conf/repmgr.conf cluster show" postgresql-repmgr 10:15:38.87 postgresql-repmgr 10:15:38.88 Welcome to the Bitnami postgresql-repmgr container postgresql-repmgr 10:15:38.88 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql-repmgr postgresql-repmgr 10:15:38.88 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql-repmgr/issues postgresql-repmgr 10:15:38.88 postgresql-repmgr 10:15:38.89 DEBUG ==> Configuring libnss_wrapper... ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string ------+----------------------------+---------+-----------+----------------------------+----------+----------+----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1000 | postgresql-ha-postgresql-0 | primary | - failed | ? | default | 100 | | user=repmgr password=Xz6ta4ncsJ host=postgresql-ha-postgresql-0.postgresql-ha-postgresql-headless.test1.svc.cluster.local dbname=repmgr port=5432 connect_timeout=5 1001 | postgresql-ha-postgresql-1 | primary | * running | | default | 100 | 2 | user=repmgr password=Xz6ta4ncsJ host=postgresql-ha-postgresql-1.postgresql-ha-postgresql-headless.test1.svc.cluster.local dbname=repmgr port=5432 connect_timeout=5 1002 | postgresql-ha-postgresql-2 | standby | running | postgresql-ha-postgresql-1 | default | 100 | 1 | user=repmgr password=Xz6ta4ncsJ host=postgresql-ha-postgresql-2.postgresql-ha-postgresql-headless.test1.svc.cluster.local dbname=repmgr port=5432 connect_timeout=5 WARNING: following issues were detected - unable to connect to node "postgresql-ha-postgresql-0" (ID: 1000) HINT: execute with --verbose option to see connection error messages command terminated with exit code 25
In this example, node postgresql-ha-postgresql-0 is unavailable.
If a primary node becomes unavailable, run the following command against that node to manually reconnect it as a standby node to the cluster:
kubectl -n <namespace> exec -it postgresql-ha-postgresql-1 -- bash -c "rm -fr /bitnami/postgresql/data/"