Re: Patroni configuration issue

From: Vijaykumar Jain <vijaykumarjain(dot)github(at)gmail(dot)com>
To: Deepak tyagi <deepaktyagi454(at)gmail(dot)com>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Patroni configuration issue
Date: 2021-07-05 22:07:55
Message-ID: CAM+6J9706uiLAtCXdk6Pd_L49fi7rjxvwNxb=rq5nT6Po9EOxw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Mon, 5 Jul 2021 at 23:58, Deepak tyagi <deepaktyagi454(at)gmail(dot)com> wrote:

> Hi,
> After installation and configuration patroni, we are getting below message
> while checking the patroni status:
>
> *Waiting for leader to bootstrap*
> [image: image.png]
> So can you please help me to fix it?
>
> although i have not used patroni, but in the interest of trying to
reproduce your problem, i tried to do a setup,
and i was able to reproduce it as below

all etcd and patroni on same node using patroni/README.rst at master ·
zalando/patroni (github.com)
<https://github.com/zalando/patroni/blob/master/docs/README.rst#running-and-configuring>
i.e on different terminals

> etcd --data-dir=data/etcd --enable-v2=true

> ./patroni.py postgres0.yml -- start this, wait for master to initalize
using initdb , patroni show msg "Lock owner: postgresql1; I am postgresql0"
now i force stop this newly elected master. note this node is holding a
lock for being a leader

> ./patroni.py postgres1.yml -- start this when p0 is down. ideally when
it is started as replica, it would run a pg_basebackup from the master and
identify as replica.
but since the master is down and holding the lock, it is unable to
initialize or run initdb, and hence runs with

2021-07-06 03:08:14,797 INFO: Lock owner: None; I am postgresql1
2021-07-06 03:08:14,798 INFO: waiting for leader to bootstrap

ideally, if the cluster was initialized early on with nodes running,
patroni would have failed over to this node, but since the db is *not*
initialized, it did not failover and kept waitng for a lock.
there are two options here,
either i check if there is any cluster initlialised with a lock is stopped
and start it back, or remove the stopped node from the cluster so that
another node waiting for lock can now initialize.

once this leader node restarted, the replica would basebackup from the
existing primary /leader
else if stopped leader is removed as above, then other node reinitializes
as master and you are good to go.

this ticket helped me understand the error.
Yet another 'waiting for leader to bootstrap' · Issue #937 ·
zalando/patroni (github.com) <https://github.com/zalando/patroni/issues/937>

I may be wrong in my simulation (my first time), but in that case you will
have to describe how did you setup your cluster, did you use any reference
etc?
maybe that might help me understand this more.

--
Thanks,
Vijay
Mumbai, India

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message abbas alizadeh 2021-07-06 02:24:00 Upgrade postgresql
Previous Message sm Linux 2021-07-05 20:21:22 Re: Patroni configuration issue