Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TvwXq-0004EK-LN for pgsql-admin@arkaria.postgresql.org; Thu, 17 Jan 2013 20:58:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TvwXp-0001em-VT for pgsql-admin@arkaria.postgresql.org; Thu, 17 Jan 2013 20:58:42 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TvBKW-0007IE-Dg for pgsql-admin@postgresql.org; Tue, 15 Jan 2013 18:33:48 +0000 Received: from mail-pa0-f54.google.com ([209.85.220.54]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TvBKU-0003j1-8w for pgsql-admin@postgresql.org; Tue, 15 Jan 2013 18:33:47 +0000 Received: by mail-pa0-f54.google.com with SMTP id bi5so266107pad.27 for ; Tue, 15 Jan 2013 10:33:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:content-type:x-gm-message-state; bh=4PYqVsgP08nQ6XoerX1pPRCY/mbgjmiomOYOFLUZX90=; b=Gvgo/L6A5nJUsCJ/+JwEUwdZBLU0EAs8zmzTcOXZC9WHMzHstTfhnKWTu2z+LnUFUM AF/QABOmfI283wE8+peq1sXPhmU9JyQ5pQbZLpEMgYnTnXBRo5gI/jg1PqVyj7/mT2uu sUm1GZNu2/ItVZldPCDINckvt7+qm0ABLtfofjI1K5ExnfWHFT/hZGTxrplIeDIyb+Y4 D9NUHwzo0ZYOFms9KceINh61Lls5rsnz45MCglbpFTpE9FrSlm4X3CkFkmFVhK+eNLDT r67Kl+DvhI3VeHJRRaPgzaVO1UQrxLaZECH2b8aA8FC+iMzIibACk10TFT96LET/eIPi //tw== X-Received: by 10.68.135.98 with SMTP id pr2mr101713843pbb.101.1358274824555; Tue, 15 Jan 2013 10:33:44 -0800 (PST) Received: from phil-mbp.local ([38.99.37.210]) by mx.google.com with ESMTPS id bc1sm3188552pab.12.2013.01.15.10.33.43 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 15 Jan 2013 10:33:44 -0800 (PST) Message-ID: <50F5A106.3050109@identified.com> Date: Tue, 15 Jan 2013 10:33:42 -0800 From: Phil Monroe User-Agent: Postbox 3.0.6 (Macintosh/20121022) MIME-Version: 1.0 To: Heikki Linnakangas CC: pgsql-admin@postgresql.org, Infrastructure , Vladimir Giverts , Tejas , Sasha Kipervarg Subject: Re: Postgres WAL Recovery Fails... And Then Works... References: <50F0CB3E.4080708@identified.com> <50F534C6.4000501@vmware.com> In-Reply-To: <50F534C6.4000501@vmware.com> Content-Type: multipart/alternative; boundary="------------000808010000000507070507" X-Gm-Message-State: ALoCoQm9MXlJrnR85aUMmEblCIKRJ15IhnuBGgx5RqwG981w2fKpwCgXXaWeYyCYDr6ngO+eDRsP X-Pg-Spam-Score: -2.6 (--) 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 This is a multi-part message in MIME format. --------------000808010000000507070507 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sorry, Initial response got blocked since I replied with the logs quoted again. > > Also, which version of postgres are you using? PostgreSQL 9.2.1 on Ubuntu 12.04 > > > Except in my case no number of restarts helped. You didn't say, were > you explicitly copying $PGDATA or using some other mechanism to > migrate the data elsewhere? So we have a very large database (~5TB), so we use a script to do parallel rsyncs to copy the data directory (https://gist.github.com/4477190/#file-pmrcp-rb). The whole copy process ended up taking ~3.5 hours. So we did a physical copy of $PGDATA (which is located at /var/lib/postgresql/9.2/main/ on both machines.). We followed the following process to do this: 1. Master archives WAL files to Backup Host. 2. Execute on Master: psql -c "select pg_start_backup('DATE-slave-restore')" 3. Execute on Master: RCP='rsync -cav --inplace -e rsh' EXCLUDE='pg_xlog' pmrcp /var/lib/postgresql/9.2/main/ prd-db-01:/var/lib/postgresql/9.2/main/ > /tmp/backup.log 4. Execute on Master: psql -c "select pg_stop_backup()" 5. On Slave, setup recovery.conf to read WAL archive on Backup Host 6. Execute on Slave: pg_ctlcluster 9.2 main start (as described in initial email) Best, Phil --------------000808010000000507070507 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit
Sorry, Initial response got blocked since I replied with the logs quoted again.


Also, which version of postgres are you using?


PostgreSQL 9.2.1 on Ubuntu 12.04



Except in my case no number of restarts helped.  You didn't say, were
you explicitly copying $PGDATA or using some other mechanism to
migrate the data elsewhere?



So we have a very large database (~5TB), so we use a script to do parallel rsyncs to copy the data directory (https://gist.github.com/4477190/#file-pmrcp-rb). The whole copy process ended up taking ~3.5 hours. So we did a physical copy of $PGDATA (which is located at /var/lib/postgresql/9.2/main/ on both machines.). We followed the following process to do this:

1. Master archives WAL files to Backup Host.
2. Execute on Master: psql -c "select pg_start_backup('DATE-slave-restore')"
3. Execute on Master: RCP='rsync -cav --inplace -e rsh' EXCLUDE='pg_xlog' pmrcp /var/lib/postgresql/9.2/main/ prd-db-01:/var/lib/postgresql/9.2/main/ > /tmp/backup.log
4. Execute on Master: psql -c "select pg_stop_backup()"
5. On Slave, setup recovery.conf to read WAL archive on Backup Host
6. Execute on Slave:  pg_ctlcluster 9.2 main start (as described in initial email)


Best,
Phil
--------------000808010000000507070507--