Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Uyr8u-0007Me-I5 for pgsql-admin@arkaria.postgresql.org; Mon, 15 Jul 2013 22:21:16 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Uyr8u-0005eX-1K for pgsql-admin@arkaria.postgresql.org; Mon, 15 Jul 2013 22:21:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Uyqug-0002as-17 for pgsql-admin@postgresql.org; Mon, 15 Jul 2013 22:06:34 +0000 Received: from beast.tiendalinux.com ([65.99.217.191]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Uyqub-0003is-Fg for pgsql-admin@postgresql.org; Mon, 15 Jul 2013 22:06:33 +0000 Received: from localhost (localhost [127.0.0.1]) by beast.tiendalinux.com (Postfix) with ESMTP id 3843869BFC for ; Mon, 15 Jul 2013 16:55:19 -0500 (COT) X-Virus-Scanned: Debian amavisd-new at beast.tiendalinux.com Received: from beast.tiendalinux.com ([127.0.0.1]) by localhost (beast.tiendalinux.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id XJKx-7GFSiny for ; Mon, 15 Jul 2013 16:55:19 -0500 (COT) X-SMTP-Auth: no Received: from asterix.bog.tiendalinux.com (unknown [190.26.96.114]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "asterix.tiendalinux.com", Issuer "CA Cert Signing Authority" (not verified)) by beast.tiendalinux.com (Postfix) with ESMTPS id D7ACB69BF6 for ; Mon, 15 Jul 2013 16:55:18 -0500 (COT) Received: from localhost (localhost [127.0.0.1]) by asterix.bog.tiendalinux.com (Postfix) with ESMTP id F3BBD210 for ; Mon, 15 Jul 2013 17:06:23 -0500 (COT) X-Virus-Scanned: Debian amavisd-new at bog.tiendalinux.com Received: from asterix.bog.tiendalinux.com ([127.0.0.1]) by localhost (asterix.bog.tiendalinux.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qHzbpoHMskrU for ; Mon, 15 Jul 2013 17:06:21 -0500 (COT) Received: from [172.24.107.59] (unknown [172.24.107.59]) by asterix.bog.tiendalinux.com (Postfix) with ESMTP id 0B16F1FE for ; Mon, 15 Jul 2013 17:06:21 -0500 (COT) Message-ID: <51E4725C.3050609@tiendalinux.com> Date: Mon, 15 Jul 2013 17:06:20 -0500 From: "Nestor A. Diaz" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: Help with PITR in PostgreSQL 8.4 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.3 (--) 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 Hello People, I need some clarification on Continuous Archiving and Point-In-Time Recovery (PITR). I have been able to replicate a postgresql 8.4 database from one machine to another using rsync and wal files. I do this as follows (Using debian gnu/linux squeeze): In *master* i have the following options under postgresql.conf: archive_mode = on # allows archiving to be done archive_command = 'test ! -f /var/lib/postgresql/8.4/main/backup_in_progress || cp -i %p /var/lib/postgresql/8.4/main/wal-archive/%f' # command to use to archive a logfile segment I start the backup on *master*: touch /var/lib/postgresql/8.4/main/backup_in_progress DATE=$(date +%Y%m%d-%H%M%S) psql --cluster 8.4/main -c "SELECT pg_start_backup('backup_${DATE}');" Then rsync on *standby*. rsync -avz --partial --progress --delete --rsh=ssh \ --exclude 'lost+found' --exclude 'postmaster.pid' --exclude 'postmaster.opts' --exclude 'wal-archive' \ postgres@$SRC_HOST:/var/lib/postgresql/8.4/main/ /var/lib/postgresql/8.4/main/ Plus all the tablespaces which are located on different directories and rsynced with same options as above (except the exclude) Then stop backup on *main*. psql --cluster 8.4/main -c "SELECT pg_stop_backup();" And transfer all the WAL files from *master* to *standby*: rsync -avz --partial --progress --rsh=ssh \ --exclude 'lost+found' \ postgres@$SRC_HOST:/var/lib/postgresql/8.4/main/wal-archive/ /var/lib/postgresql/8.4/main/wal-archive/ In *standby* i have in recovery.conf: restore_command = '/usr/lib/postgresql/8.4/bin/pg_standby -l -d -s 2 -t /var/run/postgresql/8.4-main.trigger /var/lib/postgresql/8.4/main/wal-archive %f %p %r 2>>/var/log/postgresql/postgresql-8.4-main-standby.log' recovery_end_command = 'rm -f /var/run/postgresql/8.4-main.trigger' Then start the database on *standby* and everything worked fine, I replicated the main database from one machine to another and later on the *standby* machine I process the logical backups which off course takes a lot of time. But there is one big issue: The database is about: 300 Gb of size, so rsyncing the data from one machine to another takes more than 2 hours, I don't know if I can change some rsync options in order to improve since this is too much time. Another thing is to improve the script and not having to rsync the database and just transferring the wal files and apply them every day, this is what I am trying to do without luck. So the question is: Can I have some continues wal archiving and then transfer all WAL files to *standby* everyday, recover the database and backup all data without having to rsync the data every time i make a backup ? For now i have to stick with 8.4 . Thank you very much for your time and support. Slds. -- Typed on my key64.org keyboard Nestor A Diaz -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin