[ClusterLabs] PostgreSQL server timelines offset after promote

FLORAC Thierry thierry.florac at onf.fr
Mon Mar 25 06:55:06 EDT 2024


Hi,

I'm trying to create a PostgreSQL master/slave cluster using streaming replication and pgsqlms agent.
Cluster is OK but my problem is this : the master node is sometimes restarted for system operations, and the slave is then promoted without any problem ; after reboot, the old master is re-promoted, but I often get an error in slave logs :

  FATAL:  la plus grande timeline 1 du serveur principal est derrière la timeline de restauration 2

which can be translated in english to :

  FATAL: the highest timeline 1 of main server is behind restoration timeline 2

Is there a way to avoid this?

This is my pacemaker configuration:
node 1: pgsql-master.heb.onf.fr \
        attributes master-pgsql-pel=1001
node 2: pgsql-slave.heb.onf.fr \
        attributes master-pgsql-pel=1000
primitive pgsql-mail MailTo \
        params email="thierry.florac at onf.fr" subject="[PRODUCTION] PostgreSQL server status changed: "
primitive pgsql-pel pgsqlms \
        params bindir="/usr/lib/postgresql/15/bin" pgdata="/var/local/postgresql/15/pel" pgport=5432 start_opts="-c config_file=/etc/postgresql/15/pel/postgresql.conf" \
        op methods interval=0s timeout=5 \
        op start timeout=60s interval=0s \
        op stop timeout=60s interval=0s \
        op promote timeout=30s interval=0s \
        op monitor interval=15s timeout=10s role=Promoted \
        op demote timeout=120s interval=0s \
        op reload interval=0s timeout=20 \
        op monitor interval=16s timeout=10s role=Unpromoted \
        op notify timeout=60s interval=0s
primitive pgsql-vip IPaddr2 \
        params iflabel=pgsql ip=100.127.36.50 \
        op start interval=0s timeout=20s \
        op stop interval=0s timeout=20s \
        op monitor interval=5s \
        meta target-role=Started
group pgsql-group pgsql-vip \
        meta target-role=Started
clone pgsql-ha pgsql-pel \
        meta notify=true master-max=1 target-role=Started promotable=true
location cli-prefer-pgsql-ha pgsql-ha role=Started inf: pgsql-master.heb.onf.fr
location cli-prefer-pgsql-vip pgsql-vip role=Started inf: pgsql-master.heb.onf.fr
colocation colocation-pgsql-vip-pgsql-ha-INFINITY inf: pgsql-vip:Started pgsql-ha:Promoted
order order-pgsql-ha-pgsql-vip-demote Mandatory: pgsql-ha:demote pgsql-vip:stop symmetrical=false
order order-pgsql-ha-pgsql-vip-promote Mandatory: pgsql-ha:promote pgsql-vip:start symmetrical=false
property cib-bootstrap-options: \
        have-watchdog=false \
        dc-version=2.1.5-a3f44794f94 \
        cluster-infrastructure=corosync \
        cluster-name=pgsql-heb-production \
        stonith-enabled=false \
        last-lrm-refresh=1710491873
And here are PostgreSQL replication settings:
listen_addresses = '*'

hot_standby = on
hot_standby_feedback = on

wal_level = replica
wal_log_hints = on
wal_receiver_status_interval = 5s
wal_keep_size = 256
max_wal_senders = 5

synchronous_commit = off
synchronous_standby_names = '*'

recovery_target_timeline = 'latest'

Best regards,
Thierry

--
Thierry Florac

Resp. Pôle Architecture Applicative et Mobile
DSI - Dépt. Études et Solutions Tranverses
2 bis avenue du Général Leclerc - CS 30042
94704 MAISONS-ALFORT Cedex
Tél : 01 40 19 59 64 - 06 26 53 42 09
www.onf.fr<https://www.onf.fr>

[https://www.ext.onf.fr/img/onf-signature.jpg]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clusterlabs.org/pipermail/users/attachments/20240325/f02c7594/attachment.htm>


More information about the Users mailing list