<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi,</div>
<div class="elementToProof" style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I'm trying to create a PostgreSQL master/slave cluster using streaming replication and pgsqlms agent.</div>
<div class="elementToProof" style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
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 :</div>
<div class="elementToProof" style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
FATAL: la plus grande timeline 1 du serveur principal est derrière la timeline de restauration 2</div>
<div class="elementToProof" style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
which can be translated in english to :</div>
<div class="elementToProof" style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
FATAL: the highest timeline 1 of main server is behind restoration timeline 2</div>
<div class="elementToProof" style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Is there a way to avoid this?</div>
<div class="elementToProof" style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
This is my pacemaker configuration:</div>
<blockquote style="margin-left: 0.8ex; padding-left: 1ex; border-left: 3px solid rgb(200, 200, 200);">
<div class="elementToProof" style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
node 1: pgsql-master.heb.onf.fr \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
attributes master-pgsql-pel=1001</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
node 2: pgsql-slave.heb.onf.fr \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
attributes master-pgsql-pel=1000</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
primitive pgsql-mail MailTo \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
params email="thierry.florac@onf.fr" subject="[PRODUCTION] PostgreSQL server status changed: "</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
primitive pgsql-pel pgsqlms \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
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" \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
op methods interval=0s timeout=5 \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
op start timeout=60s interval=0s \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
op stop timeout=60s interval=0s \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
op promote timeout=30s interval=0s \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
op monitor interval=15s timeout=10s role=Promoted \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
op demote timeout=120s interval=0s \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
op reload interval=0s timeout=20 \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
op monitor interval=16s timeout=10s role=Unpromoted \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
op notify timeout=60s interval=0s</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
primitive pgsql-vip IPaddr2 \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
params iflabel=pgsql ip=100.127.36.50 \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
op start interval=0s timeout=20s \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
op stop interval=0s timeout=20s \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
op monitor interval=5s \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
meta target-role=Started</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
group pgsql-group pgsql-vip \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
meta target-role=Started</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
clone pgsql-ha pgsql-pel \</div>
<div class="elementToProof" style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
meta notify=true master-max=1 target-role=Started promotable=true</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
location cli-prefer-pgsql-ha pgsql-ha role=Started inf: pgsql-master.heb.onf.fr</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
location cli-prefer-pgsql-vip pgsql-vip role=Started inf: pgsql-master.heb.onf.fr</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
colocation colocation-pgsql-vip-pgsql-ha-INFINITY inf: pgsql-vip:Started pgsql-ha:Promoted</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
order order-pgsql-ha-pgsql-vip-demote Mandatory: pgsql-ha:demote pgsql-vip:stop symmetrical=false</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
order order-pgsql-ha-pgsql-vip-promote Mandatory: pgsql-ha:promote pgsql-vip:start symmetrical=false</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
property cib-bootstrap-options: \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
have-watchdog=false \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
dc-version=2.1.5-a3f44794f94 \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
cluster-infrastructure=corosync \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
cluster-name=pgsql-heb-production \</div>
<div style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
stonith-enabled=false \</div>
<div class="elementToProof" style="margin-left: 0px; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
last-lrm-refresh=1710491873</div>
</blockquote>
<div class="elementToProof" style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
And here are PostgreSQL replication settings:</div>
<blockquote style="margin-left: 0.8ex; padding-left: 1ex; border-left: 3px solid rgb(200, 200, 200);">
<div class="elementToProof" style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
listen_addresses = '*'</div>
<div style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
hot_standby = on</div>
<div style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
hot_standby_feedback = on</div>
<div style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
wal_level = replica</div>
<div style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
wal_log_hints = on</div>
<div style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
wal_receiver_status_interval = 5s</div>
<div style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
wal_keep_size = 256</div>
<div style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
max_wal_senders = 5</div>
<div style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
synchronous_commit = off</div>
<div style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
synchronous_standby_names = '*'</div>
<div style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
recovery_target_timeline = 'latest'</div>
</blockquote>
<div class="elementToProof" style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Best regards,</div>
<div class="elementToProof" style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thierry</div>
<div id="Signature">
<p style="background-color: white;"><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;">--<b><br>
Thierry Florac</b></span></p>
<p style="background-color: white;"><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: black;">Resp. Pôle Architecture Applicative et Mobile</span><span style="font-family: Arial, sans-serif; font-size: 8pt; color: black;"><br>
</span><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: black;">DSI - Dépt. Études et Solutions Tranverses</span><span style="font-family: Arial, sans-serif; font-size: 8pt; color: black;"><br>
</span><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(12, 35, 2);">2 bis avenue du Général Leclerc - CS 30042</span><span style="font-family: Arial, sans-serif; font-size: 8pt; color: rgb(12, 35, 2);"><br>
</span><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(12, 35, 2);">94704 MAISONS-ALFORT Cedex</span><span style="font-family: Arial, sans-serif; font-size: 8pt; color: black;"><br>
</span><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: black;">Tél : 01 40 19 59 64 - 06 26 53 42 09</span><span style="font-family: Arial, sans-serif; font-size: 8pt; color: black;"><br>
</span><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: blue;"><b><a href="https://www.onf.fr" target="_blank" rel="noopener noreferrer" style="color: blue; margin-top: 0px; margin-bottom: 0px;" data-ogsc="" data-linkindex="0" data-safelink="true" data-auth="NotApplicable">www.onf.fr</a></b></span></p>
<div style="background-color: white; border-width: 1px; border-style: solid; border-color: transparent; font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: black;">
<img style="width: 300px; height: 90px; max-width: initial;" width="300" height="90" src="https://www.ext.onf.fr/img/onf-signature.jpg">
</div>
<span style="font-family: "TW Cen MT", "Century Gothic", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
</body>
</html>