Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1itXaU-0007Ro-4o for pgsql-general@arkaria.postgresql.org; Mon, 20 Jan 2020 13:59:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1itXaS-0007SO-R6 for pgsql-general@arkaria.postgresql.org; Mon, 20 Jan 2020 13:59:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1itXaS-0007RD-Bq for pgsql-general@lists.postgresql.org; Mon, 20 Jan 2020 13:59:28 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1itXaI-0007Dx-4g for pgsql-general@lists.postgresql.org; Mon, 20 Jan 2020 13:59:23 +0000 Received: by mail-wm1-x330.google.com with SMTP id 20so14811336wmj.4 for ; Mon, 20 Jan 2020 05:59:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zunibal-com.20150623.gappssmtp.com; s=20150623; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=K1hBCmx1ZLPq3NrJjgd4NyTIyHn6fUEsE9qxgigz+oo=; b=l4ARB0aCRpvwFFTWKJGL8dARqa9RxzwXJh002uakUoi/Q5COWSg6sW6axJhfFCerWi to/YQd5x3SQA8FcLr+W+a5pXsfygkxDWyDPOj+5LPgWeSK+qkz1cUvmtvD9NIk9x7arJ B4CqE1vlR0X2wtc3tK9Pw/n3M0l7823PYDmSNrVmx00BR0UxSwDxvBMeJj5elm7A/uuh 4PeDf4TDHTC98Bo9UVdKkGjQDnAj4H2D3sYpNBL3YPpL/0b/wOiXzha30Gcqax6CtCAd HazlYl2jNi25K0ezpNPFBPAvF4X29UH8wdF3ctAFvFCI/cdBb213C5j3WM4gw5EBKyJC KUWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language; bh=K1hBCmx1ZLPq3NrJjgd4NyTIyHn6fUEsE9qxgigz+oo=; b=KJBQb8sleIfXBTyIydDsvf5ANpwGpkJ5n5UFEmKBelP+3f9c1EUdmTBx1lQDQ7O1eo ylBmKAvf9Lp0p7niUTcnoub0cNrFXVwTRqSTHMPOCsPdGhA4/Dzev/zNc9P1co8ZyW4l du94Z5XxwIVjoCVxrmYUBDuyKh9r9yeC8rXzzQjsuZIP7uRe9jvI31+bS3jzsCbLAfkQ DG18dPnozUzUrfAIOXnO5AjPCylyx9HoMYWPLbcWf/0MVVr6W6i09H3nNptB0DbxavBg 9wuj4oSyRRXZS67fra68ZUL6k0FO3zzmFII42V+3AbRJpAPfhIkzvho3Ck1hym9NUyIa rl6A== X-Gm-Message-State: APjAAAWeogaVGH201CDjVT4lQcn4aC1sAhaPYH+aDp8J6udS5FSPHLmJ OBIAyWDLUXkuzoTMACK0U13eXWh6kGvh9w== X-Google-Smtp-Source: APXvYqzmKabWGuoXHkQcYyWOK1zO+ate15MEwlceAbo+EViUniy191FyJptZ3XdsVOIjSM3FiGOGMw== X-Received: by 2002:a1c:4d18:: with SMTP id o24mr18862294wmh.35.1579528755084; Mon, 20 Jan 2020 05:59:15 -0800 (PST) Received: from [192.168.3.150] ([176.222.91.85]) by smtp.gmail.com with ESMTPSA id o4sm47493299wrw.97.2020.01.20.05.59.14 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Jan 2020 05:59:14 -0800 (PST) To: pgsql-general@lists.postgresql.org From: Ekaterina Amez Subject: Questions about how to streaming replication (pg 9.2) Message-ID: Date: Mon, 20 Jan 2020 14:59:13 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------7640D35F31A5ABA5C0E352C8" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------7640D35F31A5ABA5C0E352C8 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hi all, After your comments about how to upgrade postgres from 9.2 to 9.6 in an overloaded server I've been learning and testing streaming replication. But the info I've found about this topic is not enough for me (or I'm not able to completely understand it). (I'm bad with terminology as I've always had a problem trying to remember the technical name of things so I apologyze if I make any mistake with the name of things.) One of the parameters that have to be changed to get streaming replication work is /wal_archive./ I've been testing with /hot_standby/ option, as I've found it to be the simplest way to get streaming replication work. With this option there's not archive of WAL files, so we only have the files that exist in pg_xlog directory. And the number of these files is defined by /wal_keep_segments/. I'm explaining the replication process, so you can tell if is there something that I'm missing or not understanding. There are two ways of creating a streaming replica: one is setting /wal_level/ to /hot_standby/ and  the other one setting it to /archive/. Let's use /hot_standby/ option and let's suppose we make pg_basebackup that takes 1hr: after this base backup, slave has to synchronize with the master to get the changes that have been made in this hour. And as there is no repository for WAL files, we must ensure that pg_xlog contains enough files to this synchronization is achieved succesfully (/wal_keep_segments/). Is this right? I've been looking at the files in this directory, in master's PGDATA, and ls -lt gives me 62 files created in 1hr so being optimistic this config of wal files would be enough for my slave to synchronize with the master, am I right? (when taking this to production scenario I would add some more files to be sure slave doesn't miss anything) Would it be better to use wal archiving? The final goal is to create the replica having master and slave in the same server so I guess archive command would be something like "cp " without any file transfer involved. I suppose archiving folder can be in a different path than PGDATA. Thanks for your feedback, Ekaterina PS: Just in case anyone wants to know, this is part of the process of upgrade a server with 9.2 version that has no free space in PGDATA and that can't be stopped for much time. After asking here, the strategy to upgrade will be: replicate this DB to a path with space to grow, switch clusters (slave becoming master and creating a new slave to have just-in-case), and pg_upgrade slave/new master with --link option. --------------7640D35F31A5ABA5C0E352C8 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

Hi all,

After your comments about how to upgrade postgres from 9.2 to 9.6 in an overloaded server I've been learning and testing streaming replication. But the info I've found about this topic is not enough for me (or I'm not able to completely understand it).

(I'm bad with terminology as I've always had a problem trying to remember the technical name of things so I apologyze if I make any mistake with the name of things.)

One of the parameters that have to be changed to get streaming replication work is wal_archive. I've been testing with hot_standby option, as I've found it to be the simplest way to get streaming replication work. With this option there's not archive of WAL files, so we only have the files that exist in pg_xlog directory. And the number of these files is defined by wal_keep_segments.

I'm explaining the replication process, so you can tell if is there something that I'm missing or not understanding. There are two ways of creating a streaming replica: one is setting wal_level to hot_standby and  the other one setting it to archive. Let's use hot_standby option and let's suppose we make pg_basebackup that takes 1hr: after this base backup, slave has to synchronize with the master to get the changes that have been made in this hour. And as there is no repository for WAL files, we must ensure that pg_xlog contains enough files to this synchronization is achieved succesfully (wal_keep_segments). Is this right?

I've been looking at the files in this directory, in master's PGDATA, and ls -lt gives me 62 files created in 1hr so being optimistic this config of wal files would be enough for my slave to synchronize with the master, am I right? (when taking this to production scenario I would add some more files to be sure slave doesn't miss anything)

Would it be better to use wal archiving? The final goal is to create the replica having master and slave in the same server so I guess archive command would be something like "cp <source> <destination>" without any file transfer involved. I suppose archiving folder can be in a different path than PGDATA.

Thanks for your feedback,

Ekaterina


PS: Just in case anyone wants to know, this is part of the process of upgrade a server with 9.2 version that has no free space in PGDATA and that can't be stopped for much time. After asking here, the strategy to upgrade will be: replicate this DB to a path with space to grow, switch clusters (slave becoming master and creating a new slave to have just-in-case), and pg_upgrade slave/new master with --link option.

--------------7640D35F31A5ABA5C0E352C8--