Обсуждение: WAL archiving to two locations in warm standby

Поиск
Список
Период
Сортировка

WAL archiving to two locations in warm standby

От
Alanoly Andrews
Дата:

Hello,

 

I have a Warm Standby set up on two machines (running AIX and Korn shell) in a Postgres 8.4.7 environment. The “archive_command” is set to copy a completed WAL archive to two locations, one on the primary and the other on the Standby machine. Thus:

  archive_command = '/bin/cp %p /pgarclog/l01/%f; rcp /pgdata01/pg_xlog/%f mach2:/pgarclog/l01/%f '

 

As each WAL completes, it is copied over to the primary location and also remote-copied over to the standby machine(“mach2” above). This works quite fine. The problem is that if the standby machine is down for some reason or the network is down, the archive command keeps re-trying the command. If the standby machine is unreachable for a long period, this is undesirable. What I would like to tell the postgres engine on the primary is to be “satisfied” if the archiving to the primary location succeeded and to NOT re-try if the failure was in the remote copy.

 

Is there a way to achive this through the “archive_command” or otherwise?

 

Thanks.

 

Alanoly Andrews (alanolya@invera.com)



This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately.

Ce courriel est confidentiel et prot�g�. L'exp�diteur ne renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) d�sign�(s) est interdite. Si vous recevez ce courriel par erreur, veuillez m'en aviser imm�diatement, par retour de courriel ou par un autre moyen.

Mail sent via the Abaca EPG


Re: WAL archiving to two locations in warm standby

От
Raghavendra
Дата:
In PostgreSQL, instance cannot recognize the network failure, however, I think you can do with OS scripting and calling in "archive_command".
Eg:-
archive command = '/home/scripts/arch_copy.sh %p %f'

---
Regards,
Raghavendra
EnterpriseDB Corporation



On Mon, Jul 18, 2011 at 6:46 PM, Alanoly Andrews <alanolya@invera.com> wrote:

Hello,

 

I have a Warm Standby set up on two machines (running AIX and Korn shell) in a Postgres 8.4.7 environment. The “archive_command” is set to copy a completed WAL archive to two locations, one on the primary and the other on the Standby machine. Thus:

  archive_command = '/bin/cp %p /pgarclog/l01/%f; rcp /pgdata01/pg_xlog/%f mach2:/pgarclog/l01/%f '

 

As each WAL completes, it is copied over to the primary location and also remote-copied over to the standby machine(“mach2” above). This works quite fine. The problem is that if the standby machine is down for some reason or the network is down, the archive command keeps re-trying the command. If the standby machine is unreachable for a long period, this is undesirable. What I would like to tell the postgres engine on the primary is to be “satisfied” if the archiving to the primary location succeeded and to NOT re-try if the failure was in the remote copy.

 

Is there a way to achive this through the “archive_command” or otherwise?

 

Thanks.

 

Alanoly Andrews (alanolya@invera.com)



This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately.

Ce courriel est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce courriel par erreur, veuillez m'en aviser immédiatement, par retour de courriel ou par un autre moyen.

Mail sent via the Abaca EPG



Re: WAL archiving to two locations in warm standby

От
"Kevin Grittner"
Дата:
Alanoly Andrews <alanolya@invera.com> wrote:

> What I would like to tell the postgres engine on the primary is to
> be "satisfied" if the archiving to the primary location succeeded
> and to NOT re-try if the failure was in the remote copy
>
> Is there a way to achive this through the "archive_command" or
> otherwise?

archive_command can call a script, which can be arbitrarily complex,
so sure -- you can do whatever you want within it.  That said, why
not copy the archive to the local directory, and then have an rsync
process on the other machine (going through a remote daemon) try to
pull new files over once per minute?  That works well for us.

-Kevin