Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jaZKX-0004RA-Pa for pgsql-general@arkaria.postgresql.org; Mon, 18 May 2020 06:32:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jaZKU-0006lH-1N for pgsql-general@arkaria.postgresql.org; Mon, 18 May 2020 06:32:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jaZKT-0006lA-Pf for pgsql-general@lists.postgresql.org; Mon, 18 May 2020 06:32:49 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jaZKM-00015g-Da for pgsql-general@postgresql.org; Mon, 18 May 2020 06:32:49 +0000 Received: by mail-wm1-x341.google.com with SMTP id z72so8904426wmc.2 for ; Sun, 17 May 2020 23:32:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=M/3yqVNiuFuBjjgaXsnIG3RkDRZYZslI+26B8CM7nZA=; b=mqTEhc4W7eqfMYPtdlz16wo8phYJPGx13lA0ytzTmO+zYQXMGEmbbEqjOcDxTz6OXF edf+zla290Ovx+OMvR149OGgXthQwvcgpyXHMLC4DbIm9QLeCMVkV4LxWk5ErAKmb/n5 FT6/vhR0b7X3UQf03nCZ5RtwV77vZ8DXOwsIr2qRfUUQ3ohkApHYdCJaCqaBbVsUrKm9 /o++k4TJcmoEeYj2eW67H710ovDnO6OsMmJ1GkfOdHRuTAB5vn6Syu4IGWSIOQzcXxQD Rkn3wpeSuPHZW9GwafwQRO7fDU2Bb94azMe94/LBE2jRyZ4EZQ3UxHf/d9LT6/o4rzt5 LS2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=M/3yqVNiuFuBjjgaXsnIG3RkDRZYZslI+26B8CM7nZA=; b=W54OGgI1x/EpYUPa3sRW9/eChg6xGb1kU+uOFTXaExxEduYcOQ7r4nO26co97LdhcJ aCJGU3p6VKYlnHSyIP7CoTz/fc2MvGZGvgZhKaN6bwtmmncqEkP0O37rdIuFLVt7sT9R mn9QClEmrBSGp8EcLvKVrFI5kAyt6xD4dmwEyrFS9VX/KcaAnGYrmO6luu9zFMR6fRJF fjGx8G7FqgCZUnWfwxO4UkkVRVpJH+TO8qvchG4Y+EIEt+sWSeHTnyq4dP3jlv8SNaSI XG2oYP6gxmVOENLM7QvtvWrPYZDwSi0UJ85OPUaR+xXHoadwDiGfZ0pP8neP5PfnfLpO xLjQ== X-Gm-Message-State: AOAM532qOnonaDduB98lct7X27nOcrocHhBaT/w7YCapkZhU7c5QGDlK Fof/WMLBXgfnY3+RUanwURV85w== X-Google-Smtp-Source: ABdhPJzXm/ytv/hySH1ZQmHMBsaq+SBw1ozKCGjgySm8RVJw4c31kyo70LnMDW4Phjo14qvlIQW4XA== X-Received: by 2002:a05:600c:2102:: with SMTP id u2mr17089331wml.19.1589783561026; Sun, 17 May 2020 23:32:41 -0700 (PDT) Received: from localhost.localdomain (217-149-172-219.nat.highway.telekom.at. [217.149.172.219]) by smtp.gmail.com with ESMTPSA id m13sm8863313wmi.42.2020.05.17.23.32.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2020 23:32:40 -0700 (PDT) Message-ID: Subject: Re: Hot and PITR backups in same server From: Laurenz Albe To: Andrus , pgsql-general Date: Mon, 18 May 2020 08:32:39 +0200 In-Reply-To: <6D4B5482A2F645E6A7D4EF0BF098F3E0@dell2> References: <6D4B5482A2F645E6A7D4EF0BF098F3E0@dell2> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.5 (3.32.5-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sun, 2020-05-17 at 17:41 +0300, Andrus wrote: > How to implement hot standby and PITR recovery possibility in same backup server. > > Plan is: > > 1. Create base backup using > > pg_basebackup --checkpoint=fast --verbose --progress --write-recovery-conf -D /var/lib/postgresql/12/standby > > 2. Create backup copy of /var/lib/postgresql/12/standby directory for PITR > > 3. set max_wal_size in postgresql.conf to 5 TB > > 4. Start backup server for hot standby backups. > > If data from earlier point of time is required: > > 1. Stop backup server > 2. Replace its data dirctory from of initial data directory contents created in previous p.2 > 4. Copy pg_wal contents from hot standby pg_wal directory to initial pg_wal directory in base backup > 5. Specify recovery time in postgresql.conf and start backup server to recover to this point of time. > > The most suspicius point is p.4 : copying manually pg_wal contents from hot data to base backup data. > > It this OK ? Or is some better way to implement hot stadby and PITR possibility in same computer ? > Postgres 12 in Debian is used. This is confused or at least confusing. - "max_wal_size" of 5TB is clearly insane. - I don't understand what you mean by "Start backup server for hot standby backups". Do I get it right that you want to copy a streaming replication standby server's data directory to perform PITR? That doesn't see like a good plan, because the standby usually won't be much behind the primary server, and you can only recover to a later point in time. If you care to elaborate, perhaps the question can be answered. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com