Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id B3EC063275F for ; Fri, 27 Feb 2009 03:47:49 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 22557-10 for ; Fri, 27 Feb 2009 03:47:46 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from web56001.mail.re3.yahoo.com (web56001.mail.re3.yahoo.com [216.252.110.180]) by mail.postgresql.org (Postfix) with SMTP id 3F1E763238D for ; Fri, 27 Feb 2009 03:47:46 -0400 (AST) Received: (qmail 20777 invoked by uid 60001); 27 Feb 2009 07:47:44 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1235720864; bh=nmbZ/48erJ8xnqgkD0ll4Po09wIjznBQwD55kIjFxCs=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=1KTopxqtb7rkkOxUjYNBz+W/ldcX7FG7i8L06gb3rfJetV+gjbU1NAwZnLS+bhlaD6aJ+HR5v88tvKxg9oYnCl8FbSKukORm/XvD+vsd2FvVDg0zMY8wQa5ag/6xWmlkrJ6BQBe6GQMnNXro2KogFrT6MomQK+K65S1yayWYMFE= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=UtaEikHXkeyBCdxGGgwtKLmIxOjgTG6nkz53q0Pwng+96Fsf/fx4Y3/kYpkuIEyBOGrqgSd+tIy2o/so3/Ly6b9vGhUN6FuMXqwlTSCBCvtAmi5qbXM7LrWq/Qr86vyUpKd/Tpao+6w4LveuUyQ+rjuYwtYSMQOfAg0zLgx/dJg=; Message-ID: <818050.20576.qm@web56001.mail.re3.yahoo.com> X-YMail-OSG: WWCdD_EVM1ku8I5Dg0fa3iNYjpw9gwhcakaZemWQEALAIPBVKRD9oumS2NcmJ0jdFysET69kdcHyJ1niXhnEXnjmOAKvazkiqiIDr45sxeSXFlxTG3Ye44M4h67deDqPPIzF83YpoGFTc6CWWsnLYgu0Sd0ltpguh9VTXs2awYonN1S8eiAZAiFNgOmive7yPM6Q2ABs98h3e.KRg8B3GvEHmp3OrYpUvA-- Received: from [76.16.230.246] by web56001.mail.re3.yahoo.com via HTTP; Thu, 26 Feb 2009 23:47:44 PST X-Mailer: YahooMailWebService/0.7.289.1 Date: Thu, 26 Feb 2009 23:47:44 -0800 (PST) From: Brad Wiemerslage Subject: warm standby, pg_standby, invalid checkpoint record To: pgsql-admin@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200902/254 X-Sequence-Number: 31475 I'm attempting to get warm standby up and running with a pair of servers ru= nning ubuntu 8.04 and postgresql 8.3. Been following the docs: http://www.postgresql.org/docs/8.3/static/warm-standby.html http://www.postgresql.org/docs/current/static/pgstandby.html Also, basically following the ideas here in this blog post: http://scale-out-blog.blogspot.com/2009/02/simple-ha-with-postgresql-point-= in-time.html I've customized the original script he refers to in the article, which is h= ere in its entirety for reference: https://s3.amazonaws.com/extras.continuent.com/standby.sh Here is the meat of my customized script, which runs on the standby. The p= ostgresql server on the standby is stopped first.=20 start_backup=3D"SELECT pg_start_backup('my_backup');" stop_backup=3D"SELECT pg_stop_backup();" echo "$start_backup" | $psql -h$PRIMARY -U myuser -d mydb -e rsync --delete -avz -e "ssh -i /path/to/key" myuser@$PRIMARY:$PG_DATA/ $PG_= DATA echo "$stop_backup" | $psql -h $PRIMARY -U myuser -d mydb -e The files seem to copied over to the standby machine just fine. Success is= reported with respect to the backup commands. Permissions seem fine. =20 Next, there are some steps which blow out some files. As I understand it, = you no longer need the files on the standby that were in pg_xlog on the pri= mary.=20 rm -f $PG_DATA/recovery.* rm -f $PG_DATA/8.3/main/logfile rm -f $PG_DATA/8.3/main/postmaster.pid rm -f $PG_DATA/8.3/main/pg_xlog/0* rm -f $PG_DATA/8.3/main/pg_xlog/archive_status/0* This step seems to work fine.=20 Then, the archives are pulled. They are pulled to /mnt/postgresql_archives= with this command: rsync --delete -avz -e "ssh -i /path/to/key" myuser@$PRIMARY:$PG_ARCHIVES/ = $PG_ARCHIVES Everything looks good. I end up with an up to date list of WAL files in /m= nt/postgresql_archives on the standby. Here is a listing: root@standby:/mnt/postgresql_archives# ls total 688996 drwxr-xr-x 2 postgres postgres 4096 2009-02-27 01:13 . drwxr-xr-x 14 root root 4096 2009-02-27 01:17 .. -rw-rw---- 1 postgres postgres 16777216 2009-02-27 00:19 00000001000000000= 00000CB -rw-rw---- 1 postgres postgres 16777216 2009-02-27 00:29 00000001000000000= 00000CC -rw-rw---- 1 postgres postgres 16777216 2009-02-27 00:38 00000001000000000= 00000CD -rw-rw---- 1 postgres postgres 245 2009-02-27 00:38 00000001000000000= 00000CD.00000020.backup -rw-rw---- 1 postgres postgres 16777216 2009-02-27 00:48 00000001000000000= 00000CE -rw-rw---- 1 postgres postgres 16777216 2009-02-27 00:54 00000001000000000= 00000CF -rw-rw---- 1 postgres postgres 16777216 2009-02-27 00:58 00000001000000000= 00000D0 -rw-rw---- 1 postgres postgres 16777216 2009-02-27 01:01 00000001000000000= 00000D1 -rw-rw---- 1 postgres postgres 16777216 2009-02-27 01:03 00000001000000000= 00000D2 -rw-rw---- 1 postgres postgres 16777216 2009-02-27 01:13 00000001000000000= 00000D3 Then, the recovery.conf is put in place. I've tried two different versions= , which end up giving me the same error. Here are the two different versio= ns. =20 #1: restore_command =3D '/usr/lib/postgresql/8.3/bin/pg_standby -c -d -s 2 = -t /mnt/postgresql_archives/pgsql.trigger /mnt/postgresql_archives %f %p >>= /mnt/postgresql_archives/standby.log 1>&2' #2: restore_command =3D 'cp /mnt/server/archivedir/%f "%p"' I don't believe that #2 is suitable for warm standby, but just tried it to = debug after #1 wouldn't work. Now, I try to start up the server. For it t= o work in standby mode, additional archive files will be pulled from the pr= imary machine on a periodic basis. I'm using this command, which deletes t= hem on the primary when they are no longer necessary. It also seems to wor= k fine. =20 rsync -avz -e "ssh -i /path/to/key" myuser@$PRIMARY:$PG_ARCHIVES/ $PG_ARCHI= VES I guess I'm a little confused about exactly what is happening here when the= server comes up, but here is the error message I'm getting. It seems to b= e looking for the files in pg_pxlog, which is cleared out. So, the error m= akes sense. But isn't it supposed to be looking in /mnt/postgresql_archive= s per the restore_command(s)? The files are available there. =20 2009-02-27 01:26:52.867 EST,,,7422,,49a787ac.1cfe,2,,2009-02-27 01:26:52 ES= T,,0,LOG,58P01,"could not open file ""pg_xlog/0000000100000000000000CD"" (l= og file 0, segment 20 5): No such file or directory",,,,,,,, 2009-02-27 01:26:52.867 EST,,,7422,,49a787ac.1cfe,3,,2009-02-27 01:26:52 ES= T,,0,LOG,00000,"invalid checkpoint record",,,,,,,, 2009-02-27 01:26:52.867 EST,,,7422,,49a787ac.1cfe,4,,2009-02-27 01:26:52 ES= T,,0,PANIC,XX000,"could not locate required checkpoint record",,"If you are= not restoring from a =A0backup, try removing the file ""/var/lib/postgresql/8.3/main/backup_labe= l"".",,,,,, 2009-02-27 01:26:52.868 EST,,,7419,,49a787ab.1cfb,1,,2009-02-27 01:26:51 ES= T,,0,LOG,00000,"startup process (PID 7422) was terminated by signal 6: Abor= ted",,,,,,,, 2009-02-27 01:26:52.868 EST,,,7419,,49a787ab.1cfb,2,,2009-02-27 01:26:51 ES= T,,0,LOG,00000,"aborting startup due to startup process failure",,,,,,,, So, I tried copying the files in the /mnt/postgresql_archives over to pg_xl= og. This seemed to work, and the updates were applied. Never at any point= did I get a recovery.done file. Also, for whatever reason, I was never ab= le to get any debug info from pg_standby in standby.log. Anyhow, I've burned up a couple days trying to figure this out. Any help w= ould be much appreciated. =20 Thanks, Brad=0A=0A=0A