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 1iAxwe-0001NN-1B for pgsql-general@arkaria.postgresql.org; Thu, 19 Sep 2019 15:02:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iAxwc-0003Zz-Vs for pgsql-general@arkaria.postgresql.org; Thu, 19 Sep 2019 15:02:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iAxwc-0003Zo-IS for pgsql-general@lists.postgresql.org; Thu, 19 Sep 2019 15:02:06 +0000 Received: from mail-oi1-x243.google.com ([2607:f8b0:4864:20::243]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iAxwZ-0006wz-UT for pgsql-general@lists.postgresql.org; Thu, 19 Sep 2019 15:02:05 +0000 Received: by mail-oi1-x243.google.com with SMTP id x3so3021011oig.2 for ; Thu, 19 Sep 2019 08:02:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:cc:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=NBWjePMkUL3J837OeHrjMkkk7nuM3olDp8maGSUhA80=; b=VTP+NEjNh2pxKyOmwQSC7yAld5gGbdZ8ejxfNdQQWP9OcVXF67KxzWHrWyF6dqwHCS oqwB8h3zH1ibKtR85rvQWN4+wx4ZMNAyoj36mDrCxlDYYQo9snZTAZTdhdn4v3Lguqd/ X9sQPaWH4eILeQXaVn9nw4K6KjdECaf1SPOmRcFObCz/sTcl3Qzth23LHEjT4mAuA/qL bHA481B+2m7iy7dWfAr/EGjPgr4WZ/0BL5d4+B5CYpjfSERr1qSvaE0dFvoo3nGFwNN+ /XNXoG24CxFrTY98Loj0HsCbOaHaPf+vf5QdRj/tg9ktP1LV/5bOEfslfSWaDkR2U86U X50w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=NBWjePMkUL3J837OeHrjMkkk7nuM3olDp8maGSUhA80=; b=nzOpFUVvxCfez+Mh/aQUvVUGT0HgWOsOXbfb7hih+GnO4hK8wVAPXIJ4KzY2fb3Gob 0c9ocfaGGMH2fCjmnvW89I5v9u++ABs51lGApqKB/SwbeUsn7EsGLZppckHleoBayt9f KvrA/5nJoALwFftwL5M41xDnQfNK8wTgevHF35qpUai0ANcbVVE+QXcAPUcB1kjJQghs jNFdARZCe6uiQk8/RxZzZ4QIQuAmbjeor7Ym67vDhmO+3nkp0Yyl0tfCxBwA6c3NXKJ3 WuiHEroEh8U++D1/kiu4Xjj/e1ulxiIhUAcUEAC2u0XFpaK1Aycfsli1lNt8wR4qNxab lEHA== X-Gm-Message-State: APjAAAWBj+NoiABllqPeh/nX2peCl/tSpzaW4P9hrez4TiwTjXu5Rpfa dK4hKPxOTtrFNJZNIr49SdyYXj2W75gYRw== X-Google-Smtp-Source: APXvYqyVro6HIq2yAtC330VgxuH0xtQDZ7UFi4ZuQEXI13bpzR8ozKVPjwDOrPsMXjYtu7CSaPoFXQ== X-Received: by 2002:aca:cd12:: with SMTP id d18mr2482520oig.140.1568905322981; Thu, 19 Sep 2019 08:02:02 -0700 (PDT) Received: from [192.168.1.10] (ip70-186-126-197.no.no.cox.net. [70.186.126.197]) by smtp.googlemail.com with ESMTPSA id x16sm2611683oie.7.2019.09.19.08.02.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Sep 2019 08:02:02 -0700 (PDT) Subject: Re: pgbackrest - question about restoring cluster to a new cluster on same server Cc: pgsql-general@lists.postgresql.org References: <0c037137-9480-3afa-a4b7-1400a9879cd2@gmail.com> <20190919141739.GP6962@tamriel.snowman.net> From: Ron Message-ID: <0e2efd9f-8c9e-2e70-5b64-364e55c19ec2@gmail.com> Date: Thu, 19 Sep 2019 10:02:01 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190919141739.GP6962@tamriel.snowman.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 9/19/19 9:17 AM, Stephen Frost wrote: [snip] > Ah, but you are talking about a cluster promotion, though you don't > realize it. Any time there is a "at some point, I was to stop replaying > WAL and start accepting new changes", there's a timeline switch and > notionally a promotion. > >> The point of the exercise would be to create an older copy of the cluster -- >> while the production cluster is still running, while production jobs are >> still pumping data into the production database -- from before the time of >> the data loss, and query it in an attempt to recover the records which were >> deleted. > Sure, that's all entirely possible and shouldn't be an issue. When you > go through the restore process and specify a point where you want the > restore to stop, so that you can connect and pull the down the table, > when PG reaches that point it'll promote and do a timeline switch. > > Now, if you don't actually want that restore to promote and come up as a > system that you can write to, you could instead say 'pause', and then > connect to the database and grab whatever data you needed. That should > also avoid the concern around archive command, provided you never > actually let that system finish recovery and instead just shut it down > while it's still read-only. > > If you want to play around with this stuff and see what happens with a > promote, or try doing a pause instead, you might be interested in: > > https://learn.crunchydata.com/ > > and specifically the pgbackrest one: > > https://learn.crunchydata.com/pg-administration/courses/basic-postgresql-for-dbas/pgbackrest/ > > Basically, it's kind of like a blog post where you can play around on a > scratch system that's built into the page and click through the steps to > see what happens, and change things around if you want. I've been a DBA for 20+ years, and restored a **lot** of **copies** of production databases.  PostgreSQL has some seriously different concepts. With every other system, it's: restore full backup to new location, restore differential backup, apply some roll-forward logs and you're done.  No pausing, promoting, etc. -- Angular momentum makes the world go 'round.