Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YdduY-0001jp-8G for pgsql-admin@arkaria.postgresql.org; Thu, 02 Apr 2015 12:07:50 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YdduW-0003mr-Qd for pgsql-admin@arkaria.postgresql.org; Thu, 02 Apr 2015 12:07:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YdduV-0003ml-HG for pgsql-admin@postgresql.org; Thu, 02 Apr 2015 12:07:47 +0000 Received: from forward8l.mail.yandex.net ([84.201.143.141]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YdduM-0008BV-Sn for pgsql-admin@postgresql.org; Thu, 02 Apr 2015 12:07:46 +0000 Received: from smtp3h.mail.yandex.net (smtp3h.mail.yandex.net [84.201.186.20]) by forward8l.mail.yandex.net (Yandex) with ESMTP id 9F4A31A413A8; Thu, 2 Apr 2015 15:07:35 +0300 (MSK) Received: from smtp3h.mail.yandex.net (localhost [127.0.0.1]) by smtp3h.mail.yandex.net (Yandex) with ESMTP id 126501B486EC; Thu, 2 Apr 2015 15:07:34 +0300 (MSK) Received: from unknown (unknown [2a02:6b8:0:40c:1c42:4a03:2055:4192]) by smtp3h.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 7cI76JGbsD-7YqaKAfR; Thu, 2 Apr 2015 15:07:34 +0300 (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=simply.name; s=mail; t=1427976454; bh=eT4Wa4Opot0MFbS/Kd66zOKRj6ePwbQaEhMN96aPuHU=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To:X-Mailer; b=jr3nGsD6ROLp+yhjHONF9/pGQ5l/TSKfXbjQMxwSVTbdn+R00PvLPz8SoRYJLddKx hX8anUaR7JzEdaFExDBXRtR2GbrIZ3/inp1r+dCLQNK0CtkzkXqRBu3W+Okh+iJD61 /fyExxsCYKqTlWEH0NVu3jVyInYq9NwPbd6Z2/q4= Authentication-Results: smtp3h.mail.yandex.net; dkim=pass header.i=@simply.name Content-Type: multipart/alternative; boundary="Apple-Mail=_723E786D-803E-4DDA-B666-AA4C70841B6E" Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Subject: Re: base backup from the standby without pg_basebackup From: Vladimir Borodin In-Reply-To: Date: Thu, 2 Apr 2015 15:07:33 +0300 Cc: "pgsql-admin@postgresql.org" Message-Id: References: To: Alexey Klyukin X-Mailer: Apple Mail (2.2070.6) X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org --Apple-Mail=_723E786D-803E-4DDA-B666-AA4C70841B6E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi, Alexey. > 2 =D0=B0=D0=BF=D1=80. 2015 =D0=B3., =D0=B2 13:13, Alexey Klyukin = =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0=B0): >=20 > Hello, >=20 > We had an issue with backing up one of our master servers, since a > base backup increased the load on the master, resulting in slowdowns > in the application working with that database. While there are ways to > overcome this problem by using nice on the backend process doing the > backup or throttling the network connection, we've decided to use a > less complicated route of producing a base backup from an almost idle > standby server. >=20 > We don't use pg_basebackup, but our own tool, which does the rsync + > compression and also symlinks some directories from pg_data (such as > pg_log or pg_xlog) to the locations on different partitions. So, the > question is, how would one make a base backup from the [async] standby > without using pg_basebackup. Our steps were the following: >=20 > - make sure WAL files from the master are archived and reachable on > the new replica host (via NFS). > - run pg_start_backup('label') on the master > - initialise a new cluster, rsync files from the replica, create a > recovery.conf and so on (made by our tool) > - run pg_stop_backup() on the master. >=20 > The new replica did start and were restoring WAL files for a while, > but eventually we came across the PANIC message: >=20 > 2015-03-18 19:10:52.943 CET,,,17293,,55083494.438d,922,,2015-03-17 > 15:05:08 CET,1/0,0,PANIC,XX000,"WAL contains references to invalid > pages",,,,,"xlog redo visible: rel 1663/16414/24453; blk 26569",,,,"" >=20 > We did check the disk on that system (and now rechecking the memory), > but so far the hardware itself looks ok, which makes me wonder if the > procedure above is flawed? What would be the proper way to produce a > base backup from the standby without using pg_basebackup? I would recommend using barman. If you still want to use your own = solution, you could look at how barman actually does it. It has an = ability to take backups from replics and uses pgespresso [1] extension = for it. [0] http://docs.pgbarman.org/#main_features [1] https://github.com/2ndquadrant-it/pgespresso >=20 > Both master and replicas are running PostgreSQL 9.3.5. >=20 > Kind regards, > --=20 > Alexey Klyukin >=20 >=20 > --=20 > Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-admin -- May the force be with you=E2=80=A6 https://simply.name --Apple-Mail=_723E786D-803E-4DDA-B666-AA4C70841B6E Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hi, Alexey.

2 =D0=B0=D0=BF=D1=80. 2015 =D0=B3= ., =D0=B2 13:13, Alexey Klyukin <alexk@hintbits.com> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0= =D0=BB(=D0=B0):

Hello,

We had an issue with = backing up one of our master servers, since a
base backup = increased the load on the master, resulting in slowdowns
in = the application working with that database. While there are ways to
overcome this problem by using nice on the backend process = doing the
backup or throttling the network connection, = we've decided to use a
less complicated route of producing = a base backup from an almost idle
standby server.

We don't use pg_basebackup, but our own tool, = which does the rsync +
compression and also symlinks some = directories from pg_data (such as
pg_log or pg_xlog) to = the locations on different partitions. So, the
question = is, how would one make a base backup from the [async] standby
without using pg_basebackup. Our steps were the following:

- make sure WAL files from the master are = archived and reachable on
the new replica host (via = NFS).
- run pg_start_backup('label') on the master
- initialise a new cluster, rsync  files from the = replica, create a
recovery.conf and so on (made by our = tool)
- run pg_stop_backup() on the master.

The new replica did start and were restoring = WAL files for a while,
but eventually we came across the = PANIC message:

2015-03-18 19:10:52.943 = CET,,,17293,,55083494.438d,922,,2015-03-17
15:05:08 = CET,1/0,0,PANIC,XX000,"WAL contains references to invalid
pages",,,,,"xlog redo visible: rel 1663/16414/24453; blk = 26569",,,,""

We did check the disk on that = system (and now rechecking the memory),
but so far the = hardware itself looks ok, which makes me wonder if the
procedure above is flawed? What would be the proper way to = produce a
base backup from the standby without using = pg_basebackup?

I would recommend using barman. If you still want = to use your own solution, you could look at how barman actually does it. = It has an ability to take backups from replics and uses pgespresso [1] = extension for it.



Both master and replicas are running PostgreSQL 9.3.5.

Kind regards,
--
Alexey Klyukin


-- =
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes = to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin


--
May the force be with you=E2=80=A6

= --Apple-Mail=_723E786D-803E-4DDA-B666-AA4C70841B6E--