Skip to content

pg_autoctl create monitor failed on existing instance on Debian 12 #1075

@PatrickBzh

Description

@PatrickBzh

Hello pg_auto_failover's Team,

I'm trying to setup a pg_auto_failover ecosystem on test platform before setting a production one.
I'm using debian postgresql-common facilities to manage my PG instances,
so configurations files are set into /etc/postgresql/<version>/<instance>/
and datas are in pg_data specifics lv (pg_wal are on separated lv partitions)

I've got an existing fresh new PG16 instance running on a port (3000) on debian 12
Pg_auto_failover is 2.1-3.pgdg120+1

When creating the monitor, pg_autoctl failed with the message :
17:17:52 184169 ERROR Installing pg_auto_failover monitor in existing PostgreSQL instance at "/pg_data/16-monitor/instance" running on port 3000 is not supported.

running vebose, I've got the following logs

[pguser@vpostgres-test3-ope:~ 05:17 PM]$ pg_autoctl create monitor --pgctl /usr/lib/postgresql/${PG_VERSION}/bin/pg_ctl --auth trust --pgdata /pg_data/${PG_VERSION}-monitor/instance --pgport 3000 --hostname vpostgres-test3-ope.ifremer.fr  --ssl-self-signed --run -vvv
17:17:56 184176 TRACE config.c:166: SetConfigFilePath: "/export/home/postgresql/.config/pg_autoctl/pg_data/16-monitor/instance/pg_autoctl.cfg"
17:17:56 184176 TRACE config.c:194: SetStateFilePath: "/export/home/postgresql/.local/share/pg_autoctl/pg_data/16-monitor/instance/pg_autoctl.state"
17:17:56 184176 TRACE config.c:209: SetKeeperStateFilePath: "/export/home/postgresql/.local/share/pg_autoctl/pg_data/16-monitor/instance/pg_autoctl.init"
17:17:56 184176 TRACE config.c:263: SetPidFilePath: "/tmp/pg_autoctl/pg_data/16-monitor/instance/pg_autoctl.pid"
17:17:56 184176 TRACE pgsetup.c:1620: pgsetup_validate_ssl_settings
17:17:56 184176 INFO  pgsetup.c:1729: Using default --ssl-mode "require"
17:17:56 184176 INFO  pgsetup.c:1732: Using --ssl-self-signed: pg_autoctl will create self-signed certificates, allowing for encrypted network traffic
17:17:56 184176 WARN  pgsetup.c:1735: Self-signed certificates provide protection against eavesdropping; this setup does NOT protect against Man-In-The-Middle attacks nor Impersonation attacks.
17:17:56 184176 WARN  pgsetup.c:1738: See https://www.postgresql.org/docs/current/libpq-ssl.html for details
17:17:56 184176 DEBUG monitor_config.c:256: Reading configuration from /export/home/postgresql/.config/pg_autoctl/pg_data/16-monitor/instance/pg_autoctl.cfg
17:17:56 184176 TRACE ini_file.c:131: pg_autoctl.role = monitor
17:17:56 184176 TRACE ini_file.c:131: pg_autoctl.hostname = vpostgres-test3-ope.ifremer.fr
17:17:56 184176 TRACE ini_file.c:131: postgresql.pgdata = /pg_data/16-monitor/instance
17:17:56 184176 TRACE ini_file.c:131: postgresql.pg_ctl = /usr/lib/postgresql/16/bin/pg_ctl
17:17:56 184176 TRACE ini_file.c:131: postgresql.username = autoctl_node
17:17:56 184176 TRACE ini_file.c:131: postgresql.dbname = pg_auto_failover
17:17:56 184176 TRACE ini_file.c:131: postgresql.host = /var/run/postgresql
17:17:56 184176 TRACE ini_file.c:131: postgresql.port = 3000
17:17:56 184176 TRACE ini_file.c:131: postgresql.listen_addresses = *
17:17:56 184176 TRACE ini_file.c:131: postgresql.auth_method = trust
17:17:56 184176 TRACE ini_file.c:131: ssl.sslmode = require
17:17:56 184176 TRACE ini_file.c:131: ssl.active = 1
17:17:56 184176 TRACE ini_file.c:131: ssl.cert_file = /pg_data/16-monitor/instance/server.crt
17:17:56 184176 TRACE ini_file.c:131: ssl.key_file = /pg_data/16-monitor/instance/server.key
17:17:56 184176 DEBUG pgsetup.c:122: pg_setup_init: /usr/lib/postgresql/16/bin/pg_ctl version 16.8
17:17:56 184176 TRACE pgsetup.c:671: read_pg_pidfile: pid 184120, port 3000, host /var/run/postgresql, status "ready"
17:17:56 184176 TRACE pgsetup.c:1013: pg_setup_is_ready: ready
17:17:56 184176 TRACE pgsetup.c:671: read_pg_pidfile: pid 184120, port 3000, host /var/run/postgresql, status "ready"
17:17:56 184176 TRACE pgsetup.c:1013: pg_setup_is_ready: ready
17:17:56 184176 TRACE monitor_config.c:328: monitor_config_write_file "/export/home/postgresql/.config/pg_autoctl/pg_data/16-monitor/instance/pg_autoctl.cfg"
17:17:56 184176 DEBUG pgctl.c:212: /usr/lib/postgresql/16/bin/pg_controldata /pg_data/16-monitor/instance
17:17:56 184176 TRACE pgsetup.c:671: read_pg_pidfile: pid 184120, port 3000, host /var/run/postgresql, status "ready"
17:17:56 184176 TRACE pgsetup.c:1013: pg_setup_is_ready: ready
17:17:56 184176 ERROR monitor_pg_init.c:95: Installing pg_auto_failover monitor in existing PostgreSQL instance at "/pg_data/16-monitor/instance" running on port 3000 is not supported.
17:17:56 184176 TRACE lock_utils.c:203: ipcrm -s 557088

monitor_pg_init.c:95 points to monitor_pg_init() function which is used for from scratch installations.
few lines below, there is another function : monitor_install() which is used for an existing instance.

How can I explain that pg_auto_failover considers that the instance should be created from scratch even though it found the pid of the running instance?

How may i install the monitor on my debian based instances ?

Many thanks for your reply
Regards,
Patrick.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions