Thread: Why there are no max_wal_receivers

Why there are no max_wal_receivers

From
高健
Date:

Hello :


I found that for PG9.2.4, there is parameter max_wal_senders,

But there is no parameter of max_wal_receivers.

 

Is that to say, that If  max_wal_senders are 3.

Then 3 wal_senders will be activated ,

 

And then on the standby server, there will be 3 "receivers" for counter-part ?

 

Thanks

 

Jian Gao

Re: Why there are no max_wal_receivers

From
Amit Langote
Date:
Hi,

On Mon, Oct 7, 2013 at 12:02 PM, 高健 <luckyjackgao@gmail.com> wrote:
> Hello :
>
>
> I found that for PG9.2.4, there is parameter max_wal_senders,
>
> But there is no parameter of max_wal_receivers.
>
>

max_wal_senders is the maximum number of WAL sender processes that a
primary server can create in response to requests from the standby
servers. One WAL sender process is created on the primary server for
each standby which would running the corresponding WAL receiver. So
there is one-to-one mapping between WAL senders and WAL receivers
(standbys).

>
> Is that to say, that If  max_wal_senders are 3.
>
> Then 3 wal_senders will be activated ,
>
>
>
> And then on the standby server, there will be 3 "receivers" for counter-part
> ?
>

max_wal_senders=3 means, there can be maximum 3 standby servers
requesting primary to send the WAL.
So, while the primary server may be running multiple WAL senders,
there is only one WAL receiver on each standby server.

--
Amit Langote


Re: Why there are no max_wal_receivers

From
Adrian Klaver
Date:
On 10/06/2013 09:53 PM, Amit Langote wrote:
> Hi,
>
> On Mon, Oct 7, 2013 at 12:02 PM, 高健 <luckyjackgao@gmail.com> wrote:
>> Hello :
>>
>>
>> I found that for PG9.2.4, there is parameter max_wal_senders,
>>
>> But there is no parameter of max_wal_receivers.
>>
>>
>
> max_wal_senders is the maximum number of WAL sender processes that a
> primary server can create in response to requests from the standby
> servers. One WAL sender process is created on the primary server for
> each standby which would running the corresponding WAL receiver. So
> there is one-to-one mapping between WAL senders and WAL receivers
> (standbys).

Just to add, pg_basebackup also counts against the total of receivers:

http://www.postgresql.org/docs/9.3/interactive/app-pgbasebackup.html


>
> --
> Amit Langote
>
>


--
Adrian Klaver
adrian.klaver@gmail.com


Re: Why there are no max_wal_receivers

From
高健
Date:

Hello:


 


Thank you all for kindly replying my question.


I read the documentation about pg_basebackup.


The description says:

The server must also be configured with max_wal_senders set high enough to leave at least one session available for the backup.

Dose it mean:

If I am building a one master  -- one slave environment, I need the max_wal_sender to be at least 2.

But I think pg_basebackup just use the one sender process  temporarily, Is that right?


Best Regards



2013/10/7 Adrian Klaver <adrian.klaver@gmail.com>
On 10/06/2013 09:53 PM, Amit Langote wrote:
Hi,

On Mon, Oct 7, 2013 at 12:02 PM, 高健 <luckyjackgao@gmail.com> wrote:
Hello :


I found that for PG9.2.4, there is parameter max_wal_senders,

But there is no parameter of max_wal_receivers.



max_wal_senders is the maximum number of WAL sender processes that a
primary server can create in response to requests from the standby
servers. One WAL sender process is created on the primary server for
each standby which would running the corresponding WAL receiver. So
there is one-to-one mapping between WAL senders and WAL receivers
(standbys).

Just to add, pg_basebackup also counts against the total of receivers:

http://www.postgresql.org/docs/9.3/interactive/app-pgbasebackup.html



--
Amit Langote




--
Adrian Klaver
adrian.klaver@gmail.com

Re: Why there are no max_wal_receivers

From
Amit Langote
Date:
On Tue, Oct 8, 2013 at 3:05 PM, 高健 <luckyjackgao@gmail.com> wrote:
> Hello:
>
>
>
>
>
> Thank you all for kindly replying my question.
>
>
> I read the documentation about pg_basebackup.
>
>
> The description says:
>
> The server must also be configured with max_wal_senders set high enough to
> leave at least one session available for the backup.
>
> Dose it mean:
>
> If I am building a one master  -- one slave environment, I need the
> max_wal_sender to be at least 2.
>
> But I think pg_basebackup just use the one sender process  temporarily, Is
> that right?
>

Yes. It would be used for the duration of backup. But, it maybe better
to just reserve one slot for pg_basebackup if you intend to use it
often instead of editing postgresql.conf every time you need to take
backup.

--
Amit


Re: Why there are no max_wal_receivers

From
Adrian Klaver
Date:
On 10/07/2013 11:05 PM, 高健 wrote:
> Hello:
>
>
>
> Thank you all for kindly replying my question.
>
>
> I read the documentation about pg_basebackup.
>
>
> The description says:
>
> The server must also be configured with max_wal_senders set high enough
> to leave at least one session available for the backup.
>
> Dose it mean:
>
> If I am building a one master  -- one slave environment, I need the
> max_wal_sender to be at least 2.
>
> But I think pg_basebackup just use the one sender process  temporarily,
> Is that right?

Well actually it will use at least one and up to two connections, see
-Xs option



>
>
> Best Regards
>
>


--
Adrian Klaver
adrian.klaver@gmail.com