Some questions about repmgr behaviour

24 views
Skip to first unread message

José Francisco Irles Dura

unread,
Jun 18, 2021, 4:40:57 AMJun 18
to repmgr
Hi,

I'm building a 3 node cluster with debian buster, the versions are:
- postgresql 13.3 (from pgdg repo)
- repmgr 5.2.0 (from pgdg repo)

First: when I build a 2 node cluster (no quorum), if I stop de master, the slave promotes to master. Is it the expected behaviour?

Second: I want that repmgr waits some time to promote a slave node. The config param "primary_notification_timeout" is for that scenario?
I have setted that param to 300 (for example) but the cluster promote one node before that time (about 60 seconds).

This is my repmgrd.conf:
node_id='1'
node_name='pg1'
use_replication_slots='1'
conninfo='host=192.168.33.34 user=repmgr password=repmgrpass dbname=repmgr'
data_directory='/var/lib/postgresql/data'
pg_bindir='/usr/lib/postgresql/13/bin'
pg_basebackup_options='--wal-method=stream'
failover='automatic'
promote_command='/usr/local/bin/repmgrd_promote'
follow_command='repmgr standby follow -f /etc/repmgr/repmgrd.conf --log-to-fil --upstream-node-id=%n'
log_file='/var/log/postgresql/repmgr.log'
log_level='DEBUG'
primary_notification_timeout='300'

And thats is the log of the slave promoting when master switch off:

Best regards

Ian Barwick

unread,
Jun 20, 2021, 8:44:08 PMJun 20
to rep...@googlegroups.com, José Francisco Irles Dura
On 18/06/2021 17:40, José Francisco Irles Dura wrote:
> Hi,
>
> I'm building a 3 node cluster with debian buster, the versions are:
> - postgresql 13.3 (from pgdg repo)
> - repmgr 5.2.0 (from pgdg repo)
>
> First: when I build a 2 node cluster (no quorum), if I stop de master, the slave promotes to master. Is it the expected behaviour?

This is expected, unless you have configured the standby not to promote.

> Second: I want that repmgr waits some time to promote a slave node. The config param "primary_notification_timeout" is for that scenario?

No. In a failover situation, where a standby node is not promoted to
primary, "primary_notification_timeout" is the length of time the standby
node will wait for a notification from the new primary before falling
back to "degraded monitoring" (which is a situation where no primary
is available).

There is no particular provision for adding a delay to standby promotion. If you
want to do that, the best place would be in the script executed by "promote_command".


Regards

Ian Barwick

--
Ian Barwick https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Reply all
Reply to author
Forward
0 new messages