Skip to content

pg_controldata reports number 0 on secondary and can't connect to read only session #1112

Description

I am stuck with this while trying to get a secondary online. Primary and monitor is good.

Monitor marked secondary as unhealthy, this is the secondary's logs

Running pg_autoctl create postgres
Copying custom pg_hba.conf and pg_ident.conf
01:55:43 4 INFO  Using default --ssl-mode "verify-full"
01:55:43 4 INFO  Started pg_autoctl postgres service with pid 7
01:55:43 7 INFO   /usr/bin/pg_autoctl do service postgres --pgdata /var/lib/postgresql/pgaf -v
01:55:43 4 INFO  Started pg_autoctl node-init service with pid 8
01:55:43 8 FATAL The state file "/var/lib/postgresql/.local/share/pg_autoctl/var/lib/postgresql/pgaf/pg_autoctl.state" exists and there's no init in progress
01:55:43 8 INFO  HINT: use `pg_autoctl run` to start the service.
01:55:43 4 WARN  pg_autoctl service node-init exited with exit status 0
01:55:43 7 INFO  Postgres controller service received signal SIGTERM, terminating
01:55:43 4 INFO  Stop pg_autoctl
01:55:43 1 INFO  Started pg_autoctl postgres service with pid 16
01:55:43 16 INFO   /usr/bin/pg_autoctl do service postgres --pgdata /var/lib/postgresql/pgaf -v
01:55:43 17 INFO   /usr/bin/pg_autoctl do service node-active --pgdata /var/lib/postgresql/pgaf -v
01:55:43 1 INFO  Started pg_autoctl node-active service with pid 17
01:55:43 17 INFO  Reloaded the new configuration from "/var/lib/postgresql/.config/pg_autoctl/var/lib/postgresql/pgaf/pg_autoctl.cfg"
01:55:43 17 FATAL pg_auto_failover does not support PostgreSQL before Postgres 10, we have pg_control version number 0 from pg_controldata "/var/lib/postgresql/pgaf"
01:55:43 17 ERROR Failed to setup Postgres as a standby after primary connection settings change
01:55:43 17 WARN  Failed to reload pg_autoctl configuration, see above for details
01:55:43 17 INFO  pg_autoctl service is running, current state is "catchingup"
01:55:43 17 WARN  Postgres is not running and we are in state catchingup
01:55:43 17 WARN  Failed to update the keeper's state from the local PostgreSQL instance.
01:55:44 17 INFO  Fetched current list of 1 other nodes from the monitor to update HBA rules, including 1 changes.
01:55:44 17 INFO  Checking for HBA rules for node 5 "hanode1" (192.168.122.101:5432)
01:55:44 17 WARN  Skipping HBA edits (per --skip-pg-hba) for rule: hostssl replication "pgautofailover_replicator" 192.168.122.101/32 trust
01:55:44 17 WARN  Skipping HBA edits (per --skip-pg-hba) for rule: hostssl "postgres" "pgautofailover_replicator" 192.168.122.101/32 trust
01:55:44 27 INFO   /usr/lib/postgresql/17/bin/postgres -D /var/lib/postgresql/pgaf -p 5432 -h *
01:55:44 16 INFO  Postgres is now serving PGDATA "/var/lib/postgresql/pgaf" on port 5432 with pid 27
01:55:44 17 WARN  PostgreSQL was not running, restarted with pid 27
01:55:45 17 WARN  Failed to connect to "postgres://@/var/run/postgresql:5432/postgres?", retrying until the server is ready
01:55:47 17 ERROR Connection to database failed: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: session is read-only
01:55:47 17 ERROR Failed to connect to "postgres://@/var/run/postgresql:5432/postgres?" after 7 attempts in 2082 ms, pg_autoctl stops retrying now
01:55:47 17 WARN  Failed to update the local Postgres metadata
01:55:47 17 WARN  Failed to update the keeper's state from the local PostgreSQL instance.
01:55:47 17 INFO  pg_autoctl managed to ensure current state "catchingup": PostgreSQL is running
01:55:48 17 WARN  Failed to connect to "postgres://@/var/run/postgresql:5432/postgres?", retrying until the server is ready
01:55:50 17 ERROR Connection to database failed: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: session is read-only
01:55:50 17 ERROR Failed to connect to "postgres://@/var/run/postgresql:5432/postgres?" after 2 attempts in 2011 ms, pg_autoctl stops retrying now
01:55:50 17 WARN  Failed to update the local Postgres metadata
01:55:50 17 WARN  Failed to update the keeper's state from the local PostgreSQL instance.
01:55:50 17 INFO  pg_autoctl managed to ensure current state "catchingup": PostgreSQL is running

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions