Skip to content

Support standby.signal file to mark postgres 12+ instances as replicas #1571

Open
@gavinwill

Description

@gavinwill

Use Case

Currently this role supports recovery.conf to configure a server to be a replica. As of postgresql 12+ recovery.conf has been removed and instead requires an empty file standby.signal to be in the data directory to mark the server as a replica.

it will then look to the config file to obtain settings such as primary_conninfo and restore_command amongst others to talk to upstream server for replication

Describe the Solution You Would Like

An option to mark postgresql 12+ servers as replicas with an option to tag replica=true or similar

Describe Alternatives You've Considered

Using the simple instance_directories functionality i tried to add the file

# “standby.signal” — which is an empty file—has replaced the recovery.conf file # and the presence of this file will signal to the cluster to run in standby / replica mode. #"/var/lib/postgresql/14/mydatabase/standby.signal": # ensure: file # owner: postgres # group: postgres

This works fine for an existing database and we can see that the output of pg_lsclusters shows as online,recovery howere on a fresh install and Init db the file is placed before init.db is run and then init.db complains that it cant initialise the database because the data dir is not empty (because standby.signal is in there)

Additional Context

Happy to make a PR - currently just wanted to log the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions