Re: A question regarding streaming replication

From: Holger Jakobs <holger(at)jakobs(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org,Mariel Cherkassky <mariel(dot)cherkassky(at)gmail(dot)com>,pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: A question regarding streaming replication
Date: 2019-07-31 09:45:13
Message-ID: A955EF8C-C39E-4A95-87EB-3A297F0AD8D1@jakobs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-performance

Beware, the echo command always returns the same exit status, whether the archiving had succeeded or not. You might lose WAL files!

Regarding the restore command: It will be executed only if the slave is not capable of receiving all WALs via streaming replication, e. g. in case the slave was of for a while.

Regards,
Holger

Am 31. Juli 2019 11:28:44 MESZ schrieb Mariel Cherkassky <mariel(dot)cherkassky(at)gmail(dot)com>:
>Hey all,
>I have a questions regarding streaming replication that I would like
>to
>ask in order to understand the feature better :
>I have 2 nodes configured with replication (primary + secondary).
>In my primary I configured streaming replcation + archiving. My archive
>command :
>gzip < %p > /var/lib/pgsql/archive/%f ; echo "archiving wal %f"
>
>Correct me if I'm wrong but my archive_command will be run when the
>archive_timeout is reached or when the wal is full (16MB). The wal file
>is
>created with default size of 16MB and it will be archived only after
>16MB
>of wal records will be created.
>
>In my secondary I have the following settings :
>restore_command = 'rsync -avzhe ssh postgres(at)my_primary
>:/var/lib/pgsql/archive/%f /var/lib/pgsql/archive/%f ; gunzip <
>/var/lib/pgsql/archive/%f > %p; echo "restore command was launched"'
>archive_cleanup_command = '/usr/pgsql-9.6/bin/pg_archivecleanup
>/var/lib/pgsql/archive %r; "archive_cleanupup for %r was launched"'
>
>Which means, that the restore command on the secondary connects to the
>primary, copies the wal file from the archive dir , unzip it and saves
>it
>in the pg_xlog dir of the database.
>
>my question :
>When exactly the restore_command will be used ? I use streaming
>replication
>therefore wal records are passed through wal_sender and wal receiver. I
>dont see in my logs in the secondary that the restore_command is used
>but I
>see that the same wal files as in the primary are exists on the pg_xlog
>in
>the secondary. Does the streaming replication generates wals on the
>secondary from the wals records that it receives from the primary ?

--
Holger Jakobs, Bergisch Gladbach
+49 178 9759012
- sent from mobile, therefore short -

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Milan Oparnica 2019-07-31 14:45:10 Managing 'Operators' in pgAdmin4
Previous Message Fabio Pardi 2019-07-31 09:41:55 Re: A question regarding streaming replication

Browse pgsql-performance by date

  From Date Subject
Next Message Daulat Ram 2019-07-31 11:31:45 Oracle to postgres migration via ora2pg (blob data)
Previous Message Fabio Pardi 2019-07-31 09:41:55 Re: A question regarding streaming replication