archive_command failed causing master to run out of disk space. Is there a command that prioritizes master's...












0















I had replication set up with a simple archive_command in postgresql.conf:



archive_command = 'rsync -a %p _postgresql@serverip:/var/postgresql/wal_archive/%f'


Which worked great for 2+ years until the replica went down. After the replica went down, the archive command failed repeatedly so pg_xlog files on master were never deleted and master ran out of disk space.



In my use case the replica is nice to have but not that important. However ensuring master is always available is very important, so I'd like to use an archive command that will sacrifice the replica before problems arise on master.



I currently went to the other extreme and changed the archive_command to:



archive_command = 'rsync -a %p _postgresql@serverip:/var/postgresql/wal_archive/%f || true'


But this doesn't seem ideal either since even a few seconds of network outage could cause replication to fail.



Ideally I'd like to change the archive_command to something that will try to copy the WAL file to the replica a certain number of times, and if that fails, give up and remove the pg_xlog file. Any suggestions for a new archive_command?



(postgres 10.5)









share



























    0















    I had replication set up with a simple archive_command in postgresql.conf:



    archive_command = 'rsync -a %p _postgresql@serverip:/var/postgresql/wal_archive/%f'


    Which worked great for 2+ years until the replica went down. After the replica went down, the archive command failed repeatedly so pg_xlog files on master were never deleted and master ran out of disk space.



    In my use case the replica is nice to have but not that important. However ensuring master is always available is very important, so I'd like to use an archive command that will sacrifice the replica before problems arise on master.



    I currently went to the other extreme and changed the archive_command to:



    archive_command = 'rsync -a %p _postgresql@serverip:/var/postgresql/wal_archive/%f || true'


    But this doesn't seem ideal either since even a few seconds of network outage could cause replication to fail.



    Ideally I'd like to change the archive_command to something that will try to copy the WAL file to the replica a certain number of times, and if that fails, give up and remove the pg_xlog file. Any suggestions for a new archive_command?



    (postgres 10.5)









    share

























      0












      0








      0








      I had replication set up with a simple archive_command in postgresql.conf:



      archive_command = 'rsync -a %p _postgresql@serverip:/var/postgresql/wal_archive/%f'


      Which worked great for 2+ years until the replica went down. After the replica went down, the archive command failed repeatedly so pg_xlog files on master were never deleted and master ran out of disk space.



      In my use case the replica is nice to have but not that important. However ensuring master is always available is very important, so I'd like to use an archive command that will sacrifice the replica before problems arise on master.



      I currently went to the other extreme and changed the archive_command to:



      archive_command = 'rsync -a %p _postgresql@serverip:/var/postgresql/wal_archive/%f || true'


      But this doesn't seem ideal either since even a few seconds of network outage could cause replication to fail.



      Ideally I'd like to change the archive_command to something that will try to copy the WAL file to the replica a certain number of times, and if that fails, give up and remove the pg_xlog file. Any suggestions for a new archive_command?



      (postgres 10.5)









      share














      I had replication set up with a simple archive_command in postgresql.conf:



      archive_command = 'rsync -a %p _postgresql@serverip:/var/postgresql/wal_archive/%f'


      Which worked great for 2+ years until the replica went down. After the replica went down, the archive command failed repeatedly so pg_xlog files on master were never deleted and master ran out of disk space.



      In my use case the replica is nice to have but not that important. However ensuring master is always available is very important, so I'd like to use an archive command that will sacrifice the replica before problems arise on master.



      I currently went to the other extreme and changed the archive_command to:



      archive_command = 'rsync -a %p _postgresql@serverip:/var/postgresql/wal_archive/%f || true'


      But this doesn't seem ideal either since even a few seconds of network outage could cause replication to fail.



      Ideally I'd like to change the archive_command to something that will try to copy the WAL file to the replica a certain number of times, and if that fails, give up and remove the pg_xlog file. Any suggestions for a new archive_command?



      (postgres 10.5)







      postgresql replication postgresql-10





      share












      share










      share



      share










      asked 6 mins ago









      sheepdogsheepdog

      224110




      224110






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "182"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f227057%2farchive-command-failed-causing-master-to-run-out-of-disk-space-is-there-a-comma%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Database Administrators Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f227057%2farchive-command-failed-causing-master-to-run-out-of-disk-space-is-there-a-comma%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Ronny Ackermann

          Köttigit

          MySQL 8.0.15 starts normally but any connection hangs