vitabaks / postgresql_cluster

PostgreSQL High-Availability Cluster (based on Patroni). Automating with Ansible.
https://postgresql-cluster.org
MIT License
1.7k stars 411 forks source link

deploy_pgcluster.yml stucks at Wait for port 8008 to become open on the host job #747

Closed lokinehn closed 1 month ago

lokinehn commented 1 month ago

Hello. I'm new to patroni cluster, and trying to install cluster on 3 local VM with existing consul cluster without balancer. I have 3 VMs, one is in master state and two is replicas. All VMs has same variable: postgresql_exists: false

Almost all variables are default, excluding postgresql_data_dir: postgresql_data_dir: "/data/{{ postgresql_version }}/{{ postgresql_cluster_name }}"

When I run deploy_pgcluster.yml playbook, play stucks at Wait for port 8008 to become open on the host job.

I see 8008 port opened on host: tcp LISTEN 0 5 0.0.0.0:8008 0.0.0.0:* users:(("patroni",pid=52434,fd=4)) but postgresql is not started properly, I see such error in journalctl

Sep 04 12:59:57 host postgresql@16-main[49898]: Error: /usr/lib/postgresql/16/bin/pg_ctl /usr/lib/postgresql/16/bin/pg_ctl start -D /data/16/main -l /var/log/postgresql/postgresql-16-main.log -s -o  -c config_file="/etc/postgresql/16/main/postgresql.conf" exited with status 1:
Sep 04 12:59:57 host postgresql@16-main[49898]: pg_ctl: directory "/data/16/main" is not a database cluster directory
Sep 04 12:59:57 host systemd[1]: postgresql@16-main.service: Can't open PID file /run/postgresql/16-main.pid (yet?) after start: No such file or directory

As i get it suggests that postgresql wasn't initialized, so /data/16/main directory is empty.

How to fix this? Maybe I've missed any variables?

vitabaks commented 1 month ago

Hello

Please attache Patroni log.

sudo journalctl -u patroni -n 100
lokinehn commented 1 month ago

in the attachment logs.txt

vitabaks commented 1 month ago

Full log please.

sudo journalctl -u patroni
lokinehn commented 1 month ago

logs.txt

vitabaks commented 1 month ago

Are there logs in the /var/log/postgresql directory?

lokinehn commented 1 month ago

Yes, two files

postgresql-16-main.log: pg_ctl: directory "/data/16/main" is not a database cluster directory

postgresql-Wed.log - in the attachment logs.txt

vitabaks commented 1 month ago

Check your inventory file for ip addresses

2024-09-04 12:39:27 UTC [40399-12]  LOG:  specifying both host name and CIDR mask is invalid: "host1/32"
2024-09-04 12:39:27 UTC [40399-13]  CONTEXT:  line 100 of configuration file "/etc/postgresql/16/main/pg_hba.conf"
2024-09-04 12:39:27 UTC [40399-14]  LOG:  specifying both host name and CIDR mask is invalid: "host2/32"
2024-09-04 12:39:27 UTC [40399-15]  CONTEXT:  line 101 of configuration file "/etc/postgresql/16/main/pg_hba.conf"
2024-09-04 12:39:27 UTC [40399-16]  LOG:  specifying both host name and CIDR mask is invalid: "host3/32"
2024-09-04 12:39:27 UTC [40399-17]  CONTEXT:  line 102 of configuration file "/etc/postgresql/16/main/pg_hba.conf"
2024-09-04 12:39:27 UTC [40399-18]  FATAL:  could not load /etc/postgresql/16/main/pg_hba.conf
2024-09-04 12:39:27 UTC [40399-19]  LOG:  database system is shut down

See example https://github.com/vitabaks/postgresql_cluster/blob/master/automation/inventory

lokinehn commented 1 month ago

Inventory file looks like that:

all:
  children:
    cluster_name:
      children:
        postgres_cluster:
          children:
            master:
              hosts:
                ip_addr_1:
                  is_master: true
                  postgresql_exists: false
            replica:
              hosts:
                ip_addr_2:
                  is_master: false
                  postgresql_exists: false
                ip_add_3:
                  is_master: false
                  postgresql_exists: false

Addresses and cluster name has been changed

vitabaks commented 1 month ago

Please attach /etc/postgresql/16/main/pg_hba.conf

lokinehn commented 1 month ago

pg_hba.txt

vitabaks commented 1 month ago

Hmm,

the pg_hba.conf file that you sent does not really contain obvious errors related to specifying the hostname and CIDR mask, as indicated in the logs:

LOG: specifying both host name and CIDR mask is invalid: "host1/32"
lokinehn commented 1 month ago

Ok, should i use remove_cluster.yml playbook to delete all installations and reinstall cluster again? Should i use ONLY ip addresses in inventory, instead of FQDN?

vitabaks commented 1 month ago

Try stop the patroni service and execute initdb manually.

sudo systemctl stop patroni
sudo -u postgres /usr/lib/postgresql/16/bin/initdb -D /data/16/main --data-checksums

Or

pg_createcluster 16 main -D /data/16/main --data-checksums
vitabaks commented 1 month ago

Should i use ONLY ip addresses in inventory, instead of FQDN?

Yes, IP only

lokinehn commented 1 month ago

After command sudo -u postgres /usr/lib/postgresql/16/bin/initdb -D /data/16/main --data-checksums

The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are enabled.

fixing permissions on existing directory /data/16/main ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

initdb: warning: enabling "trust" authentication for local connections
initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /usr/lib/postgresql/16/bin/pg_ctl -D /data/16/main -l logfile start

After restarting patroni:

Sep 04 15:08:08 host1 systemd[1]: Starting patroni.service - Runners to orchestrate a high-availability PostgreSQL - Patroni...
Sep 04 15:08:08 host1 sudo[53454]: postgres : PWD=/ ; USER=root ; COMMAND=/sbin/modprobe softdog
Sep 04 15:08:08 host1 sudo[53454]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=112)
Sep 04 15:08:08 host1 sudo[53454]: pam_unix(sudo:session): session closed for user root
Sep 04 15:08:08 host1 sudo[53457]: postgres : PWD=/ ; USER=root ; COMMAND=/bin/chown postgres /dev/watchdog
Sep 04 15:08:08 host1 sudo[53457]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=112)
Sep 04 15:08:08 host1 sudo[53457]: pam_unix(sudo:session): session closed for user root
Sep 04 15:08:08 host1 systemd[1]: Started patroni.service - Runners to orchestrate a high-availability PostgreSQL - Patroni.
Sep 04 15:08:09 host1 patroni[53460]: 2024-09-04 15:08:09,071 INFO: No PostgreSQL configuration items changed, nothing to reload.
Sep 04 15:08:09 host1 patroni[53460]: 2024-09-04 15:08:09,077 CRITICAL: system ID mismatch, node host1 belongs to a different cluster: 7410755984962353331 != >
Sep 04 15:08:09 host1 systemd[1]: patroni.service: Main process exited, code=exited, status=1/FAILURE
Sep 04 15:08:09 host1 systemd[1]: patroni.service: Failed with result 'exit-code'.
Sep 04 15:08:09 host1 systemd[1]: patroni.service: Scheduled restart job, restart counter is at 5.
Sep 04 15:08:09 host1 systemd[1]: patroni.service: Start request repeated too quickly.
Sep 04 15:08:09 host1 systemd[1]: patroni.service: Failed with result 'exit-code'.
Sep 04 15:08:09 host1 systemd[1]: Failed to start patroni.service - Runners to orchestrate a high-availability PostgreSQL - Patroni.
vitabaks commented 1 month ago

OK, delete the cluster entry from DCS and postgres

sudo systemctl stop patroni
patronictl remove <cluster-name>
rm -rf /data/16/main
rm -rf /etc/postgresql/16/main

then run the playbook again.

lokinehn commented 1 month ago

Playbook stuck at the same job.

full output of journalctl -u patroni

Sep 04 15:30:26 host1 systemd[1]: Starting patroni.service - Runners to orchestrate a high-availability PostgreSQL - Patroni...
Sep 04 15:30:26 host1 sudo[4507]: postgres : PWD=/ ; USER=root ; COMMAND=/sbin/modprobe softdog
Sep 04 15:30:26 host1 sudo[4507]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=112)
Sep 04 15:30:26 host1 sudo[4507]: pam_unix(sudo:session): session closed for user root
Sep 04 15:30:26 host1 sudo[4509]: postgres : PWD=/ ; USER=root ; COMMAND=/bin/chown postgres /dev/watchdog
Sep 04 15:30:26 host1 sudo[4509]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=112)
Sep 04 15:30:26 host1 sudo[4509]: pam_unix(sudo:session): session closed for user root
Sep 04 15:30:26 host1 systemd[1]: Started patroni.service - Runners to orchestrate a high-availability PostgreSQL - Patroni.
Sep 04 15:30:27 host1 patroni[4513]: 2024-09-04 15:30:27,327 INFO: No PostgreSQL configuration items changed, nothing to reload.
Sep 04 15:30:27 host1 patroni[4513]: 2024-09-04 15:30:27,330 INFO: Deregister service postgres-cluster/host1
Sep 04 15:30:27 host1 patroni[4513]: 2024-09-04 15:30:27,336 INFO: Lock owner: None; I am host1
Sep 04 15:30:27 host1 patroni[4513]: 2024-09-04 15:30:27,336 INFO: Deregister service postgres-cluster/host1
Sep 04 15:30:27 host1 patroni[4513]: 2024-09-04 15:30:27,342 INFO: waiting for leader to bootstrap
Sep 04 15:30:27 host1 patroni[4513]: 2024-09-04 15:30:27,344 INFO: Lock owner: None; I am host1
Sep 04 15:30:27 host1 patroni[4513]: 2024-09-04 15:30:27,345 INFO: Deregister service postgres-cluster/host1
Sep 04 15:30:27 host1 patroni[4513]: 2024-09-04 15:30:27,346 INFO: waiting for leader to bootstrap
Sep 04 15:30:37 host1 patroni[4513]: 2024-09-04 15:30:37,345 INFO: Lock owner: None; I am host1
Sep 04 15:30:37 host1 patroni[4513]: 2024-09-04 15:30:37,346 INFO: Deregister service postgres-cluster/host1
Sep 04 15:30:37 host1 patroni[4513]: 2024-09-04 15:30:37,347 INFO: waiting for leader to bootstrap
Sep 04 15:30:47 host1 patroni[4513]: 2024-09-04 15:30:47,345 INFO: Lock owner: None; I am host1
Sep 04 15:30:47 host1 patroni[4513]: 2024-09-04 15:30:47,346 INFO: Deregister service postgres-cluster/host1
Sep 04 15:30:47 host1 patroni[4513]: 2024-09-04 15:30:47,347 INFO: waiting for leader to bootstrap
Sep 04 15:30:57 host1 patroni[4513]: 2024-09-04 15:30:57,344 INFO: Lock owner: None; I am host1
Sep 04 15:30:57 host1 patroni[4513]: 2024-09-04 15:30:57,346 INFO: Deregister service postgres-cluster/host1
Sep 04 15:30:57 host1 patroni[4513]: 2024-09-04 15:30:57,347 INFO: waiting for leader to bootstrap
Sep 04 15:31:07 host1 patroni[4513]: 2024-09-04 15:31:07,345 INFO: Lock owner: None; I am host1
Sep 04 15:31:07 host1 patroni[4513]: 2024-09-04 15:31:07,347 INFO: Deregister service postgres-cluster/host1
Sep 04 15:31:07 host1 patroni[4513]: 2024-09-04 15:31:07,348 INFO: waiting for leader to bootstrap
Sep 04 15:31:17 host1 patroni[4513]: 2024-09-04 15:31:17,344 INFO: Lock owner: None; I am host1
Sep 04 15:31:17 host1 patroni[4513]: 2024-09-04 15:31:17,346 INFO: Deregister service postgres-cluster/host1
Sep 04 15:31:17 host1 patroni[4513]: 2024-09-04 15:31:17,347 INFO: waiting for leader to bootstrap
Sep 04 15:31:27 host1 patroni[4513]: 2024-09-04 15:31:27,345 INFO: Lock owner: None; I am host1
Sep 04 15:31:27 host1 patroni[4513]: 2024-09-04 15:31:27,346 INFO: Deregister service postgres-cluster/host1
Sep 04 15:31:27 host1 patroni[4513]: 2024-09-04 15:31:27,347 INFO: waiting for leader to bootstrap
Sep 04 15:31:37 host1 patroni[4513]: 2024-09-04 15:31:37,344 INFO: Lock owner: None; I am host1
Sep 04 15:31:37 host1 patroni[4513]: 2024-09-04 15:31:37,346 INFO: Deregister service postgres-cluster/host1
Sep 04 15:31:37 host1 patroni[4513]: 2024-09-04 15:31:37,347 INFO: waiting for leader to bootstrap
Sep 04 15:31:47 host1 patroni[4513]: 2024-09-04 15:31:47,344 INFO: Lock owner: None; I am host1
Sep 04 15:31:47 host1 patroni[4513]: 2024-09-04 15:31:47,346 INFO: Deregister service postgres-cluster/host1
Sep 04 15:31:47 host1 patroni[4513]: 2024-09-04 15:31:47,347 INFO: waiting for leader to bootstrap
Sep 04 15:31:57 host1 patroni[4513]: 2024-09-04 15:31:57,345 INFO: Lock owner: None; I am host1
Sep 04 15:31:57 host1 patroni[4513]: 2024-09-04 15:31:57,347 INFO: Deregister service postgres-cluster/host1
Sep 04 15:31:57 host1 patroni[4513]: 2024-09-04 15:31:57,347 INFO: waiting for leader to bootstrap
Sep 04 15:32:07 host1 patroni[4513]: 2024-09-04 15:32:07,345 INFO: Lock owner: None; I am host1
Sep 04 15:32:07 host1 patroni[4513]: 2024-09-04 15:32:07,347 INFO: Deregister service postgres-cluster/host1
Sep 04 15:32:07 host1 patroni[4513]: 2024-09-04 15:32:07,347 INFO: waiting for leader to bootstrap
Sep 04 15:32:17 host1 patroni[4513]: 2024-09-04 15:32:17,344 INFO: Lock owner: None; I am host1
Sep 04 15:32:17 host1 patroni[4513]: 2024-09-04 15:32:17,346 INFO: Deregister service postgres-cluster/host1
Sep 04 15:32:17 host1 patroni[4513]: 2024-09-04 15:32:17,347 INFO: waiting for leader to bootstrap
Sep 04 15:32:27 host1 patroni[4513]: 2024-09-04 15:32:27,344 INFO: Lock owner: None; I am host1
Sep 04 15:32:27 host1 patroni[4513]: 2024-09-04 15:32:27,345 INFO: Deregister service postgres-cluster/host1
Sep 04 15:32:27 host1 patroni[4513]: 2024-09-04 15:32:27,346 INFO: waiting for leader to bootstrap
Sep 04 15:32:37 host1 patroni[4513]: 2024-09-04 15:32:37,344 INFO: Lock owner: None; I am host1
Sep 04 15:32:37 host1 patroni[4513]: 2024-09-04 15:32:37,345 INFO: Deregister service postgres-cluster/host1
Sep 04 15:32:37 host1 patroni[4513]: 2024-09-04 15:32:37,346 INFO: waiting for leader to bootstrap
Sep 04 15:32:47 host1 patroni[4513]: 2024-09-04 15:32:47,344 INFO: Lock owner: None; I am host1
Sep 04 15:32:47 host1 patroni[4513]: 2024-09-04 15:32:47,345 INFO: Deregister service postgres-cluster/host1
Sep 04 15:32:47 host1 patroni[4513]: 2024-09-04 15:32:47,346 INFO: waiting for leader to bootstrap
Sep 04 15:32:57 host1 patroni[4513]: 2024-09-04 15:32:57,344 INFO: Lock owner: None; I am host1
Sep 04 15:32:57 host1 patroni[4513]: 2024-09-04 15:32:57,346 INFO: Deregister service postgres-cluster/host1
Sep 04 15:32:57 host1 patroni[4513]: 2024-09-04 15:32:57,347 INFO: waiting for leader to bootstrap
Sep 04 15:33:07 host1 patroni[4513]: 2024-09-04 15:33:07,344 INFO: Lock owner: None; I am host1
Sep 04 15:33:07 host1 patroni[4513]: 2024-09-04 15:33:07,345 INFO: Deregister service postgres-cluster/host1
Sep 04 15:33:07 host1 patroni[4513]: 2024-09-04 15:33:07,346 INFO: waiting for leader to bootstrap
Sep 04 15:33:17 host1 patroni[4513]: 2024-09-04 15:33:17,344 INFO: Lock owner: None; I am host1
Sep 04 15:33:17 host1 patroni[4513]: 2024-09-04 15:33:17,345 INFO: Deregister service postgres-cluster/host1
Sep 04 15:33:17 host1 patroni[4513]: 2024-09-04 15:33:17,346 INFO: waiting for leader to bootstrap
Sep 04 15:33:27 host1 patroni[4513]: 2024-09-04 15:33:27,344 INFO: Lock owner: None; I am host1
Sep 04 15:33:27 host1 patroni[4513]: 2024-09-04 15:33:27,345 INFO: Deregister service postgres-cluster/host1
Sep 04 15:33:27 host1 patroni[4513]: 2024-09-04 15:33:27,346 INFO: waiting for leader to bootstrap
Sep 04 15:33:37 host1 patroni[4513]: 2024-09-04 15:33:37,344 INFO: Lock owner: None; I am host1
Sep 04 15:33:37 host1 patroni[4513]: 2024-09-04 15:33:37,345 INFO: Deregister service postgres-cluster/host1
Sep 04 15:33:37 host1 patroni[4513]: 2024-09-04 15:33:37,347 INFO: waiting for leader to bootstrap
Sep 04 15:33:47 host1 patroni[4513]: 2024-09-04 15:33:47,344 INFO: Lock owner: None; I am host1
Sep 04 15:33:47 host1 patroni[4513]: 2024-09-04 15:33:47,346 INFO: Deregister service postgres-cluster/host1
Sep 04 15:33:47 host1 patroni[4513]: 2024-09-04 15:33:47,347 INFO: waiting for leader to bootstrap
Sep 04 15:33:57 host1 patroni[4513]: 2024-09-04 15:33:57,344 INFO: Lock owner: None; I am host1
Sep 04 15:33:57 host1 patroni[4513]: 2024-09-04 15:33:57,345 INFO: Deregister service postgres-cluster/host1
Sep 04 15:33:57 host1 patroni[4513]: 2024-09-04 15:33:57,346 INFO: waiting for leader to bootstrap
Sep 04 15:34:07 host1 patroni[4513]: 2024-09-04 15:34:07,344 INFO: Lock owner: None; I am host1
Sep 04 15:34:07 host1 patroni[4513]: 2024-09-04 15:34:07,345 INFO: Deregister service postgres-cluster/host1
Sep 04 15:34:07 host1 patroni[4513]: 2024-09-04 15:34:07,346 INFO: waiting for leader to bootstrap
Sep 04 15:34:17 host1 patroni[4513]: 2024-09-04 15:34:17,344 INFO: Lock owner: None; I am host1
Sep 04 15:34:17 host1 patroni[4513]: 2024-09-04 15:34:17,346 INFO: Deregister service postgres-cluster/host1
Sep 04 15:34:17 host1 patroni[4513]: 2024-09-04 15:34:17,347 INFO: waiting for leader to bootstrap
Sep 04 15:34:27 host1 patroni[4513]: 2024-09-04 15:34:27,344 INFO: Lock owner: None; I am host1
Sep 04 15:34:27 host1 patroni[4513]: 2024-09-04 15:34:27,346 INFO: Deregister service postgres-cluster/host1
Sep 04 15:34:27 host1 patroni[4513]: 2024-09-04 15:34:27,347 INFO: waiting for leader to bootstrap
Sep 04 15:34:37 host1 patroni[4513]: 2024-09-04 15:34:37,344 INFO: Lock owner: None; I am host1
Sep 04 15:34:37 host1 patroni[4513]: 2024-09-04 15:34:37,346 INFO: Deregister service postgres-cluster/host1
Sep 04 15:34:37 host1 patroni[4513]: 2024-09-04 15:34:37,347 INFO: waiting for leader to bootstrap
Sep 04 15:34:47 host1 patroni[4513]: 2024-09-04 15:34:47,344 INFO: Lock owner: None; I am host1
Sep 04 15:34:47 host1 patroni[4513]: 2024-09-04 15:34:47,345 INFO: Deregister service postgres-cluster/host1
Sep 04 15:34:47 host1 patroni[4513]: 2024-09-04 15:34:47,346 INFO: waiting for leader to bootstrap
Sep 04 15:34:57 host1 patroni[4513]: 2024-09-04 15:34:57,344 INFO: Lock owner: None; I am host1
Sep 04 15:34:57 host1 patroni[4513]: 2024-09-04 15:34:57,346 INFO: Deregister service postgres-cluster/host1
Sep 04 15:34:57 host1 patroni[4513]: 2024-09-04 15:34:57,347 INFO: waiting for leader to bootstrap
Sep 04 15:35:07 host1 patroni[4513]: 2024-09-04 15:35:07,345 INFO: Lock owner: None; I am host1
Sep 04 15:35:07 host1 patroni[4513]: 2024-09-04 15:35:07,347 INFO: Deregister service postgres-cluster/host1
Sep 04 15:35:07 host1 patroni[4513]: 2024-09-04 15:35:07,348 INFO: waiting for leader to bootstrap
Sep 04 15:35:17 host1 patroni[4513]: 2024-09-04 15:35:17,344 INFO: Lock owner: None; I am host1
Sep 04 15:35:17 host1 patroni[4513]: 2024-09-04 15:35:17,346 INFO: Deregister service postgres-cluster/host1
Sep 04 15:35:17 host1 patroni[4513]: 2024-09-04 15:35:17,347 INFO: waiting for leader to bootstrap
Sep 04 15:35:27 host1 patroni[4513]: 2024-09-04 15:35:27,346 INFO: Lock owner: None; I am host1
Sep 04 15:35:27 host1 patroni[4513]: 2024-09-04 15:35:27,348 INFO: Deregister service postgres-cluster/host1
Sep 04 15:35:27 host1 patroni[4513]: 2024-09-04 15:35:27,349 INFO: waiting for leader to bootstrap
Sep 04 15:35:37 host1 patroni[4513]: 2024-09-04 15:35:37,345 INFO: Lock owner: None; I am host1
Sep 04 15:35:37 host1 patroni[4513]: 2024-09-04 15:35:37,347 INFO: Deregister service postgres-cluster/host1
Sep 04 15:35:37 host1 patroni[4513]: 2024-09-04 15:35:37,347 INFO: waiting for leader to bootstrap
Sep 04 15:35:47 host1 patroni[4513]: 2024-09-04 15:35:47,345 INFO: Lock owner: None; I am host1
Sep 04 15:35:47 host1 patroni[4513]: 2024-09-04 15:35:47,347 INFO: Deregister service postgres-cluster/host1
Sep 04 15:35:47 host1 patroni[4513]: 2024-09-04 15:35:47,347 INFO: waiting for leader to bootstrap
Sep 04 15:35:57 host1 patroni[4513]: 2024-09-04 15:35:57,345 INFO: Lock owner: None; I am host1
Sep 04 15:35:57 host1 patroni[4513]: 2024-09-04 15:35:57,347 INFO: Deregister service postgres-cluster/host1
Sep 04 15:35:57 host1 patroni[4513]: 2024-09-04 15:35:57,347 INFO: waiting for leader to bootstrap
Sep 04 15:36:07 host1 patroni[4513]: 2024-09-04 15:36:07,344 INFO: Lock owner: None; I am host1
Sep 04 15:36:07 host1 patroni[4513]: 2024-09-04 15:36:07,346 INFO: Deregister service postgres-cluster/host1
Sep 04 15:36:07 host1 patroni[4513]: 2024-09-04 15:36:07,347 INFO: waiting for leader to bootstrap
Sep 04 15:36:17 host1 patroni[4513]: 2024-09-04 15:36:17,345 INFO: Lock owner: None; I am host1
Sep 04 15:36:17 host1 patroni[4513]: 2024-09-04 15:36:17,347 INFO: Deregister service postgres-cluster/host1
Sep 04 15:36:17 host1 patroni[4513]: 2024-09-04 15:36:17,347 INFO: waiting for leader to bootstrap
Sep 04 15:36:27 host1 patroni[4513]: 2024-09-04 15:36:27,345 INFO: Lock owner: None; I am host1
Sep 04 15:36:27 host1 patroni[4513]: 2024-09-04 15:36:27,347 INFO: Deregister service postgres-cluster/host1
Sep 04 15:36:27 host1 patroni[4513]: 2024-09-04 15:36:27,348 INFO: waiting for leader to bootstrap
Sep 04 15:36:37 host1 patroni[4513]: 2024-09-04 15:36:37,344 INFO: Lock owner: None; I am host1
Sep 04 15:36:37 host1 patroni[4513]: 2024-09-04 15:36:37,346 INFO: Deregister service postgres-cluster/host1
Sep 04 15:36:37 host1 patroni[4513]: 2024-09-04 15:36:37,347 INFO: waiting for leader to bootstrap

postgresql logs are empty

vitabaks commented 1 month ago
  1. Did you remember to pre-execute patronictl remove command?

  2. Is it possible to repeat on new VMs with a different cluster name?

  3. please attach the automation directory, I will try to reproduce it.

lokinehn commented 1 month ago
  1. Yes, it gave me an error:

    root@host:/etc/postgresql/16/main# patronictl remove postgres-cluster
    Error: Can not find suitable configuration of distributed configuration store
    Available implementations: consul, kubernetes
  2. I'll try

vitabaks commented 1 month ago
patronictl -c /etc/patroni/patroni.yml remove <cluster-name>
lokinehn commented 1 month ago

This command helped to remove existed patroni installation. After reinstall everything is ok.

Thanks so much for help