Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wy3Fi-0006Mz-3A for pgsql-admin@arkaria.postgresql.org; Fri, 20 Jun 2014 18:09:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wy3Fh-00053R-In for pgsql-admin@arkaria.postgresql.org; Fri, 20 Jun 2014 18:09:29 +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 1Wy3Ff-000514-RF for pgsql-admin@postgresql.org; Fri, 20 Jun 2014 18:09:27 +0000 Received: from nm7-vm4.bullet.mail.ne1.yahoo.com ([98.138.91.167]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Wy3FX-0005Cx-OD for pgsql-admin@postgresql.org; Fri, 20 Jun 2014 18:09:26 +0000 Received: from [98.138.101.130] by nm7.bullet.mail.ne1.yahoo.com with NNFMP; 20 Jun 2014 18:09:17 -0000 Received: from [98.138.101.175] by tm18.bullet.mail.ne1.yahoo.com with NNFMP; 20 Jun 2014 18:09:16 -0000 Received: from [127.0.0.1] by omp1086.mail.ne1.yahoo.com with NNFMP; 20 Jun 2014 18:09:16 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 873798.28716.bm@omp1086.mail.ne1.yahoo.com Received: (qmail 80947 invoked by uid 60001); 20 Jun 2014 18:09:16 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1403287756; bh=A5VtyrNXUm3EgRDP4QlNhJcI32n8bYV5NvRImtpkb5Y=; h=References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=cWPnUo2XZCsxH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ZlciB1c2luZyB0aGUgZm9sbG93aW5nIHN0ZXBzIHNldmVyYWwgdGltZXM6Cj4KPiAxKSBlbnN1cmUgdGhlIHBvc3RncmVzcWwgZGF0YSBkaXJlY3RvcnksIC92YXIvbGliL3Bnc3FsLzkuMy9kYXRhLCBpcyBlbXB0eS4KPiAyKSBydW46IHBnX2Jhc2ViYWNrdXABMAEBAQE- X-Mailer: YahooMailWebService/0.8.191.1 References: <53A47312.9040600@gmail.com> Message-ID: <1403287756.14509.YahooMailNeo@web122305.mail.ne1.yahoo.com> Date: Fri, 20 Jun 2014 11:09:16 -0700 From: Kevin Grittner Reply-To: Kevin Grittner Subject: Re: Cannot rebuild a standby server To: John Scalia , "pgsql-admin@postgresql.org" In-Reply-To: <53A47312.9040600@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -1.9 (-) 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 John Scalia wrote: > In the true definition of insanity, I've tried to rebuild a standby > streaming replication server using the following steps several times: > > 1) ensure the postgresql data directory, /var/lib/pgsql/9.3/data, is empt= y. > 2) run: pg_basebackup -h -D /var/lib/pgsql/9.3/data > 3) manually copy the WAL's from the primary server's pg_xlog directory > to the directory specified in the standby's recovery.conf restore_command. Step 3 is enough to cause database corruption on the replica. > 4) rm any artifacts from the standby's new data directory like the > backup_label file. So is that. > 5) copy the saved recovery.conf into the standby's data directory and che= ck > it is accurate. > 6) Start the database using "service postgresql-9.3 start" > > Every time, however, the following appears in the pg_log/postgresql-Fri.l= og: > LOG: entering standby mode > LOG: restored log file "00000003.history" > LOG: invalid secondary checkpoint record > PANIC: could not locate a valid checkpoint record Yep, that's about the best result you can expect with the above procedure; it is also occasionally possible to get it to start, but if it did there would almost certainly be data loss or corruption. > All this was originally caused by testing the failover mechanism in pgpoo= l. That > didn't succeed and I'm trying to get the servers back to their original > states. I've done this kind > of thing before, but don't know what's wrong with this effort. What have > I missed? You should enable WAL archiving and the restore_command in recovery.conf should copy WAL files from the archive.=A0 The pg_xlog directory should be empty when starting recovery unless the primary is stopped and you only copy pg_xlog files from the stopped server into the pg_xlog directory of the recovery cluster.=A0 Don't delete the backup_label file, because it has the information recovery needs about the point from which it should start WAL replay -- without it, it will have to guess, and is very likely to get that wrong. The documentation is your friend.=A0 It gives pretty specific instructions for what to do. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company --=20 Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin