Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1osFHF-0005Ej-CQ for pgsql-general@arkaria.postgresql.org; Tue, 08 Nov 2022 03:27:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1osFHD-0000ji-UC for pgsql-general@arkaria.postgresql.org; Tue, 08 Nov 2022 03:27:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1osFHD-0000jZ-Ji for pgsql-general@lists.postgresql.org; Tue, 08 Nov 2022 03:27:51 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1osFHA-00083W-SK for pgsql-general@postgresql.org; Tue, 08 Nov 2022 03:27:50 +0000 Received: by mail-ed1-x529.google.com with SMTP id z18so20546129edb.9 for ; Mon, 07 Nov 2022 19:27:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=OVLXKBT3wN7fYth1FLWPI18B/Ce7NHsoYGRqsc7tGdY=; b=KVDc+uXO4Oim2wCOdF2xhvvUxSHGhXIz3sUjLGFEkpVxUofYTrcGckS0mlZyXd6gT8 uzkLNvHH3C2SWcoVhMwrMFxORsWdiTCi/iaWuBkwbUUP9PCmDguap9iXD5OFZhH12Mwi KVX1Sbf5Wv4VlJwomqqpSfor651rYX937T/aAFOc78pVEdR6KmzQaU+fYEUpbDXMZ6tP tD62TYDfmoDf7Svl25uJACoyOG5c1CQKjP6VPMIL38G1DnwJpe2sfXSWmz3pBU/3Ml/1 +TqL9oneX4QZNI0ZNKexWrjoXWad+WagJ+dvKnD+WlqU+FanVvsBGI6qZAMrl9WgJwf3 1e4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=OVLXKBT3wN7fYth1FLWPI18B/Ce7NHsoYGRqsc7tGdY=; b=hh858uapPZC1D5SPGhwbatG8LaIHDXPOfWW/O7tSOa2M8BvL43UvX0qyAo8TLC8UbK BAqbFNuoEOHkygr7lPIpUK/KfB8U0AmSAmCNS7BTfrCjMRJZXbDx60tNkfKDiU04uCiw n23iNOEcfGPseV6U0wMnlpuwimBGVf0MKQwYP50xqhjcVaP9iyfwW3CrR1mZzQ/b4OJj 6el4DEWANL7d1jBPbXKMT6BmjRSWnIP18jPP+8rVAhfQMaQerTX5RklvDyZQ8To3dIQp yJ24bDnrFnWWX0ljE2LtgAIE5QIuwENKVlECzfGXybj4PoLhrM9Rv/mmAwdL9tu95u+R 6edw== X-Gm-Message-State: ACrzQf0wm1cXkylRV6/UqKS3ULhb/3TtyKv7DX0+k6LEXwKIepWZOq/G 5a331Ug4JDXKP1wRFAJIQRA9wg== X-Google-Smtp-Source: AMsMyM4VAD0JFenZt90sCBeVYSI3MmIyA1qQo1RoTyxLsfDdlwNjqAlUAg2X9F7jobuPVGMyTbhnNQ== X-Received: by 2002:a05:6402:42c7:b0:461:c375:86b8 with SMTP id i7-20020a05640242c700b00461c37586b8mr53250827edc.40.1667878067365; Mon, 07 Nov 2022 19:27:47 -0800 (PST) Received: from localhost.localdomain (178-190-182-92.adsl.highway.telekom.at. [178.190.182.92]) by smtp.gmail.com with ESMTPSA id f19-20020a1709064dd300b0077a1dd3e7b7sm4143670ejw.102.2022.11.07.19.27.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 19:27:47 -0800 (PST) Message-ID: <785bc009a9b1cb2564fdf0e8e17bdf0960504fe5.camel@cybertec.at> Subject: Re: postgres replication without pg_basebackup? postgres 13.3 From: Laurenz Albe To: Pilar de Teodoro Cc: pgsql-general@postgresql.org Date: Tue, 08 Nov 2022 04:27:46 +0100 In-Reply-To: References: <682616b88f9e6bd7a745d74580833254879ce550.camel@cybertec.at> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 (3.42.4-2.fc35) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2022-11-07 at 23:11 +0100, Pilar de Teodoro wrote: > Thank you very much for the idea. [of running pg_rewind] > We ran pg_rewind correctly: > [postgres@gacsdb05 data-13.3]$ pg_rewind -c -R --target-pgdata=/PostgresDB/sas_hdd/data-13.3/  --source-server="host=XXXX port=XXXX user=postgres password=XXX"  > pg_rewind: source and target cluster are on the same timeline > pg_rewind: no rewind required I cannot verify that you ran it correctly. "Target" should be the old server with the extra transactions. "Source" should be the promoted standby server. Promotion switches to a new timeline, so it looks like you did something wrong. > but then we got the following error: > > [2022-11-07 22:57:55 CET-]LOG:  starting PostgreSQL 13.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10), 64-bit > [2022-11-07 22:57:55 CET-]LOG:  listening on IPv4 address "0.0.0.0", port XXXX > [2022-11-07 22:57:55 CET-]LOG:  could not create IPv6 socket for address "::": Address family not supported by protocol > [2022-11-07 22:57:55 CET-]LOG:  listening on Unix socket "/tmp/.s.PGSQL.XXXX" > [2022-11-07 22:57:55 CET-]LOG:  database system was shut down in recovery at 2022-11-07 22:57:47 CET > [2022-11-07 22:57:55 CET-]LOG:  restored log file "00000003.history" from archive > cp: cannot stat '/PostgresWalLogArchive/new/00000004.history': No such file or directory > [2022-11-07 22:57:55 CET-]LOG:  entering standby mode > [2022-11-07 22:57:55 CET-]LOG:  restored log file "00000003.history" from archive > [2022-11-07 22:57:55 CET-]LOG:  invalid primary checkpoint record > [2022-11-07 22:57:55 CET-]PANIC:  could not locate a valid checkpoint record > [2022-11-07 22:57:55 CET-]LOG:  startup process (PID 3011860) was terminated by signal 6: Aborted > [2022-11-07 22:57:55 CET-]LOG:  aborting startup due to startup process failure > [2022-11-07 22:57:55 CET-]LOG:  database system is shut down > > We have read we can run pg_resetwal but the Wal folder is the folder where the Wals are archived in the primary. Would that be correct to reset them? Don't run "pg_resetwal". At the very least, it will break your standby. At this point, your standby seems to be broken. I don't know what exactly you did, but it leeks like you should run a "pg_basebackup" after all. Yours, Laurenz Albe