Re: [External] Re: Slot issues

2018-10-14 Thread Vijaykumar Jain
What was the whole point of this divergence  :)

We use replication slots and it is for this reason we are able to scale our
applications by redirecting reads and writes backed by haproxy and
pgbouncer. with the health check of replication lag. It works awesome and
at a much much lower cost to what aws used to charge us for. (1 master,  3
slaves .. that goes to 7-8 during peak days)

With the use of logical replication we were able to create a multimaster
mesh that allowed the writes to certain tables across the ocean and all
regions subscribed to it.
As a result, at any given time all 5 availability. Zones had same data and
we would sustain an occasional WAN outage between two DCs.

We use around 300 Postgres servers, everything managed via puppet and
foreman.
And I have not seen any single issue w r t the one reported for any of our
setups.
So I guess it is generalising just based out of some threads :)
I do not use db2 but there has never been a need for one in my company as
we have multiple design patterns of Postgres architecture based of
requirements.




On Mon, 15 Oct 2018 at 3:46 AM Ravi Krishna  wrote:

> >
> > You're not forced to use slots.  Their purpose is to allow to force the
> > primary to keep necessary resources around. Which also allows to get rid
> > of the archive in some setups.
>
> Thanks.
>
> Disclaimer:  We don't use replication as we piggy back on AWS HA.
>
> The reason why I posted this is because majority of replication related
> messages in this forum
> is about slots :-)

-- 

Regards,
Vijay


Re: [External] Re: Slot issues

2018-10-14 Thread Vijaykumar Jain
ah that explains.
Thanks andres.

I do not use rsync, hence was not able to reproduce i guess :)

Regards,
Vijay


On Mon, Oct 15, 2018 at 2:46 AM bhargav kamineni 
wrote:

> Yeah i have used rsync , Got it now will increase the
> max_replication_slots to high enough , Thank you Andres Freund :-)
>
> On Mon, 15 Oct 2018 at 02:40, Andres Freund  wrote:
>
>> Hi,
>>
>> Please try to quote properly.
>>
>> On 2018-10-15 01:57:53 +0530, bhargav kamineni wrote:
>> > I got his on standby,  could you please explain in detail about
>> >  --*but that *on the standby* haven't set max_replication_slots high
>> enough*
>> > .
>>
>> What is max_replication_slots set to on the new standby?
>>
>> If you created the new basebackup using rsync, and didn't exclude
>> pg_replication_slot, it'll have copied the slots from the primary.  And
>> thus needs a high enough max_replication_slots to work with them.
>>
>> - Andres
>>
>


Re: [External] Re: Slot issues

2018-10-14 Thread Vijaykumar Jain
Sorry Bhargav.

I tried to simulate the scenarios,
3 node cluster
1primary, 2hot standby

given:
max_replication_slots = 2 on primary, and i try to create 2 hot standby
-> runs fine.
max_replication_slots = 1 on primary, and i try to create 2 hot standby ->
gives PANIC, increase replication slots. (the standby only cries with
replication slot does not exist, not increase number of replication slots)
max_replication_slots = 2 on primary, and max_replication_slots=1 on hot
standby, delete recovery.conf and recover from pg_baseback works fine.
max_replication_slots = 2 on primary, on standby i try to use a
replication_slot already existing, it gives correct error of slot in use
and not increase replication slot error.
my pg_replslot folder is consistent of the replication slots i have on the
master.


so i guess, i'll leave it to the experts.
but i still do not understand why would you get that error on standby,
unless you are doing cascading replication.

I'll watch this thread to see how this is resolved.

Thanks,
Vijay


Regards,
Vijay


On Mon, Oct 15, 2018 at 2:41 AM Andres Freund  wrote:

> Hi,
>
> Please try to quote properly.
>
> On 2018-10-15 01:57:53 +0530, bhargav kamineni wrote:
> > I got his on standby,  could you please explain in detail about
> >  --*but that *on the standby* haven't set max_replication_slots high
> enough*
> > .
>
> What is max_replication_slots set to on the new standby?
>
> If you created the new basebackup using rsync, and didn't exclude
> pg_replication_slot, it'll have copied the slots from the primary.  And
> thus needs a high enough max_replication_slots to work with them.
>
> - Andres
>
>


Re: [External] Re: Slot issues

2018-10-14 Thread bhargav kamineni
pg_replslot # ls -lrth
total 4.0K
drwx-- 2 postgres postgres 4.0K Oct 14 14:55 replication_slot



On Mon, 15 Oct 2018 at 02:11, Vijaykumar Jain  wrote:

> ok wait, you data directory path may be different :)
> i mean wherever your pg data dir is, from there find pg_replslot folder
> and list the contents of it.
>
> Regards,
> Vijay
>
>
> On Mon, Oct 15, 2018 at 2:10 AM Vijaykumar Jain 
> wrote:
>
>> i guess he is trying to confirm if the value of max_replication_slot is
>> the same on all the master and the standby nodes.
>>
>> also,
>>
>> I am trying to shoot in the dark.
>>
>> can you give the output of (on master)
>> ls /var/lib/postgresql//main/pg_replslot/*
>>
>> also the value of max_replication_slot on the master and all the
>> standby's.
>> also, how are you creating the replication slot?
>>
>> can you share the query?
>>
>> also pls share the content of the recovery.conf on the standby nodes
>> (both currently running and currently not running).
>> you can scribble company secret stuff.
>>
>>
>> Regards,
>> Vijay
>>
>>
>> On Mon, Oct 15, 2018 at 1:58 AM bhargav kamineni <
>> bhargavpostg...@gmail.com> wrote:
>>
>>> I got his on standby,  could you please explain in detail about
>>>  --*but that *on the standby* haven't set max_replication_slots high
>>> enough*.
>>>
>>> Thanks,
>>> Bhargav
>>>
>>> On Mon, 15 Oct 2018 at 01:50, Andres Freund  wrote:
>>>
 Hi,

 On 2018-10-15 00:15:53 +0530, bhargav kamineni wrote:
 > Hi Team,
 >
 > I am getting this ERROR while starting my second slave server
 >
 > PANIC:  too many replication slots active before shutdown
 > HINT:  Increase max_replication_slots and try again.
 >
 > max_replication_slots on my master is 2 and one of them is already
 active
 > for another slave,
 > do i need to increase this parameter for the need of working of
 another
 > slave ? if so whats the reason ?

 You're getting that error on the standby, not the primary, right?   In
 all likelihood the problem is that you copied over replication slots to
 your standby server, but that *on the standby* haven't set
 max_replication_slots high enough.

 Greetings,

 Andres Freund

>>>


Re: [External] Re: Slot issues

2018-10-14 Thread Vijaykumar Jain
ok wait, you data directory path may be different :)
i mean wherever your pg data dir is, from there find pg_replslot folder and
list the contents of it.

Regards,
Vijay


On Mon, Oct 15, 2018 at 2:10 AM Vijaykumar Jain  wrote:

> i guess he is trying to confirm if the value of max_replication_slot is
> the same on all the master and the standby nodes.
>
> also,
>
> I am trying to shoot in the dark.
>
> can you give the output of (on master)
> ls /var/lib/postgresql//main/pg_replslot/*
>
> also the value of max_replication_slot on the master and all the standby's.
> also, how are you creating the replication slot?
>
> can you share the query?
>
> also pls share the content of the recovery.conf on the standby nodes (both
> currently running and currently not running).
> you can scribble company secret stuff.
>
>
> Regards,
> Vijay
>
>
> On Mon, Oct 15, 2018 at 1:58 AM bhargav kamineni <
> bhargavpostg...@gmail.com> wrote:
>
>> I got his on standby,  could you please explain in detail about
>>  --*but that *on the standby* haven't set max_replication_slots high
>> enough*.
>>
>> Thanks,
>> Bhargav
>>
>> On Mon, 15 Oct 2018 at 01:50, Andres Freund  wrote:
>>
>>> Hi,
>>>
>>> On 2018-10-15 00:15:53 +0530, bhargav kamineni wrote:
>>> > Hi Team,
>>> >
>>> > I am getting this ERROR while starting my second slave server
>>> >
>>> > PANIC:  too many replication slots active before shutdown
>>> > HINT:  Increase max_replication_slots and try again.
>>> >
>>> > max_replication_slots on my master is 2 and one of them is already
>>> active
>>> > for another slave,
>>> > do i need to increase this parameter for the need of working of another
>>> > slave ? if so whats the reason ?
>>>
>>> You're getting that error on the standby, not the primary, right?   In
>>> all likelihood the problem is that you copied over replication slots to
>>> your standby server, but that *on the standby* haven't set
>>> max_replication_slots high enough.
>>>
>>> Greetings,
>>>
>>> Andres Freund
>>>
>>


Re: [External] Re: Slot issues

2018-10-14 Thread Vijaykumar Jain
i guess he is trying to confirm if the value of max_replication_slot is the
same on all the master and the standby nodes.

also,

I am trying to shoot in the dark.

can you give the output of (on master)
ls /var/lib/postgresql//main/pg_replslot/*

also the value of max_replication_slot on the master and all the standby's.
also, how are you creating the replication slot?

can you share the query?

also pls share the content of the recovery.conf on the standby nodes (both
currently running and currently not running).
you can scribble company secret stuff.


Regards,
Vijay


On Mon, Oct 15, 2018 at 1:58 AM bhargav kamineni 
wrote:

> I got his on standby,  could you please explain in detail about
>  --*but that *on the standby* haven't set max_replication_slots high
> enough*.
>
> Thanks,
> Bhargav
>
> On Mon, 15 Oct 2018 at 01:50, Andres Freund  wrote:
>
>> Hi,
>>
>> On 2018-10-15 00:15:53 +0530, bhargav kamineni wrote:
>> > Hi Team,
>> >
>> > I am getting this ERROR while starting my second slave server
>> >
>> > PANIC:  too many replication slots active before shutdown
>> > HINT:  Increase max_replication_slots and try again.
>> >
>> > max_replication_slots on my master is 2 and one of them is already
>> active
>> > for another slave,
>> > do i need to increase this parameter for the need of working of another
>> > slave ? if so whats the reason ?
>>
>> You're getting that error on the standby, not the primary, right?   In
>> all likelihood the problem is that you copied over replication slots to
>> your standby server, but that *on the standby* haven't set
>> max_replication_slots high enough.
>>
>> Greetings,
>>
>> Andres Freund
>>
>