Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gONHR-0006aG-Cn for pgsql-admin@arkaria.postgresql.org; Sun, 18 Nov 2018 13:38:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gONHP-0003bu-Hs for pgsql-admin@arkaria.postgresql.org; Sun, 18 Nov 2018 13:38:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gONHP-0003bm-AS for pgsql-admin@lists.postgresql.org; Sun, 18 Nov 2018 13:38:27 +0000 Received: from hermes.gatewaynet.com ([193.92.121.98]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gONHI-0001qg-Gr for pgsql-admin@lists.postgresql.org; Sun, 18 Nov 2018 13:38:26 +0000 Received: from hercules.internal.net (hercules.internal.net [10.9.200.8]) by hermes.gatewaynet.com (8.14.3/8.14.3/Debian-9.4) with ESMTP id wAIDcIQO013405 for ; Sun, 18 Nov 2018 15:38:18 +0200 Received: from [10.9.251.7] (dcmchgw.internal.net [10.9.0.1]) by hercules.internal.net (Postfix) with ESMTPS id 623961350772 for ; Sun, 18 Nov 2018 15:38:12 +0200 (EET) Subject: Re: postgresql history and timelines To: pgsql-admin@lists.postgresql.org References: From: Achilleas Mantzios Message-ID: <60ed06d9-6e04-f8a4-afbc-c607a2d3aa35@matrix.gatewaynet.com> Date: Sun, 18 Nov 2018 15:38:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Virus-Scanned: clamav-milter 0.98.7 at hermes X-Virus-Status: Clean X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on hermes.gatewaynet.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 18/11/18 11:29 π.μ., Mariel Cherkassky wrote: > Hi guys, > Wanted to understand something that isnt clear to me, please correct > me if I'm wrong : > > -When we want to recover our database or promote a secondary to be a > master a new time line will be created. A new file will be created in > the pg_xlog directory named '00000TIMELINEID.history'. > -During the daily work, the primary or the secondary shouldnt have a > .history file right ? > -The history file contains only the timeline id and the location to > start from the timeline. > -When using repmgr, after cloning the primary and starting the > secondary the secondary should replay wals from : > 1.archives > 2.local wals > 3.Streaming replication from primary > ? Streaming and if not available from the archives. Careful with the archives. Local wals are a result of receiving them via restore, they are not a source to replay from. > > I cloned the primary to the secondary, and when I tried to start the > secondary I got the next message : >  LOG:  restored log file "000000010000090A00000002" from archive > FATAL:  requested timeline 2 is not a child of this server's history >  DETAIL:  Latest checkpoint is at xx on timeline 1, but in the history > of the requested timeline, the server forked off from that timeline at YY. > Cloning must be done withing a start / stop backup or done with pg_basebackup. After the cloning, you must first create recovery.conf, set it up correctly and then start the standby, pg_basebackup does this for you. What the message says to you is that smth messed up with the timelines, wrong/old backup, garbage files in pg_xlog, etc. > So I didnt recover my primary or promoted a secondary so how is it > possible that I have a file from timeline 2 ? Are there other > operations that creates a new timeline ? > Can you describe the precise sequence of steps that you took? > > Thanks.