Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uD2to-005mLc-LG for pgsql-general@arkaria.postgresql.org; Thu, 08 May 2025 15:11:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uD2tn-004K6h-ET for pgsql-general@arkaria.postgresql.org; Thu, 08 May 2025 15:10:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uD2tm-004K6W-9s for pgsql-general@lists.postgresql.org; Thu, 08 May 2025 15:10:59 +0000 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uD2ti-000qeP-1f for pgsql-general@lists.postgresql.org; Thu, 08 May 2025 15:10:57 +0000 Received: from phl-compute-07.internal (phl-compute-07.phl.internal [10.202.2.47]) by mailfout.stl.internal (Postfix) with ESMTP id F2DD111401B3; Thu, 8 May 2025 11:10:52 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-07.internal (MEProxy); Thu, 08 May 2025 11:10:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1746717052; x=1746803452; bh=oR3TktOMHJMAC8qN14I/Z3p+Vr1fHXsWHosGI2z8y3Y=; b= PlQaeZxG3FkF4o2kQILNZZSc9Y54AUNO/YeHrsOE4/PRAq25NJ6hgDFcAUBln2N9 xAQc7JHh9GQBaiuq331EuXxx5//7Ig3C2jmhV7H2/BsnKhdfGMes29uIIbkpJW3t ZnnZXRrdVm7RttXRQiAmbkKKMbGGQGBCytCPqQ9oQMngoVHXtGiMfco12eP6XHRe C13G6lA35530JWCfKhvNM++WYdTpK8xtumn9fJTc+YTT32FvIUM3gUjfcyXVmwJf Ha/GIOXVjWFk6l90WQHSaSGadtFq9GWHbA2AUzmLL/ibLgEaFdWWc0KHtyaMYqro HaK8o86D3ljYVOZ1IAnfuA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1746717052; x= 1746803452; bh=oR3TktOMHJMAC8qN14I/Z3p+Vr1fHXsWHosGI2z8y3Y=; b=Z iNRrfHB1YS8oYrJe67mrfRNUz0Zy0OJW7WZs9KKvaq7XIdPT6BqR1qCa1xTu+5iu fP1WztCSImJRVuiLO1xm8jhrszqc5J9H+sLZD1+PMDHyB/BCOMVurEnn4gCDLVIT Qa6CLz3ftlfzEr1rQ8v9fOXjui4Zp2p+Sh+LOWnUeiOlxSSYDmK3FPNd9ZJs8ONT Zl4KlkQG+otcU+aPPpBkMwxwsOY2U0yuWFtIL7x8dmj7cMMh/EWCCnoAlPQeMF3L GT+u4SVt0oH6z28rtnOeImgWAQHib6iQXV+lBpTUh9UIrnn+fVNpXJK8GYATLC2a EDzkYxvlj9Ml6XWCo66Dg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvledttdeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddt vdejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvh gvrhesrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepfeegfeeiuedtgffg teeggfehkeejheetieeliefgteeikeejvdeiveeigfehvedtnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhes rghklhgrvhgvrhdrtghomhdpnhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouh htpdhrtghpthhtohepfhhluhgtrgduleejkeesghhmrghilhdrtghomhdprhgtphhtthho pehlrghurhgvnhiirdgrlhgsvgestgihsggvrhhtvggtrdgrthdprhgtphhtthhopehpgh hsqhhlqdhgvghnvghrrghlsehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 8 May 2025 11:10:51 -0400 (EDT) Message-ID: <696cacde-79d0-4897-93bc-68fa317a7eb4@aklaver.com> Date: Thu, 8 May 2025 08:10:51 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: pg_rewind problem: cannot find WAL To: Luca Ferrari , Laurenz Albe Cc: pgsql-general References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 5/8/25 04:26, Luca Ferrari wrote: > On Thu, May 8, 2025 at 8:54 AM Luca Ferrari wrote: >> >> I've pgbackrest making backups, so I have an archive_command. I'm >> going to see if putting a restore_command can fix the problem. >> > > But I'm facing a quite trivial problem: in ubuntu installation the > configuration files are separated from the PGDATA. > Apparently pg_rewind is trying to read postgresql.conf to get the > restore_command, and I don't know how to specify the different > location of the postgresql.conf (cannot specifcy -c as in postgres): > > $ /usr/lib/postgresql/17/bin/pg_rewind -D /var/lib/postgresql/17/main > --source-server="user=replica_fluca host=dev-psqlha3 > dbname=replica_fluca" -R -P --debug -c > postgres: could not access the server configuration file > "/var/lib/postgresql/17/main/postgresql.conf": No such file or > directory > no data was returned by command "/usr/lib/postgresql/17/bin/postgres > -D /var/lib/postgresql/17/main -C restore_command" > child process exited with exit code 2 > pg_rewind: error: could not read restore_command from target cluster > > Any idea? /usr/lib/postgresql/17/bin/pg_rewind --help pg_rewind resynchronizes a PostgreSQL cluster with another copy of the cluster. Usage: pg_rewind [OPTION]... Options: -c, --restore-target-wal use "restore_command" in target configuration to retrieve WAL files from archives -D, --target-pgdata=DIRECTORY existing data directory to modify --source-pgdata=DIRECTORY source data directory to synchronize with --source-server=CONNSTR source server to synchronize with -n, --dry-run stop before modifying anything -N, --no-sync do not wait for changes to be written safely to disk -P, --progress write progress messages -R, --write-recovery-conf write configuration for replication (requires --source-server) --config-file=FILENAME use specified main server configuration file when running target cluster --debug write a lot of debug messages --no-ensure-shutdown do not automatically fix unclean shutdown --sync-method=METHOD set method for syncing files to disk -V, --version output version information, then exit -?, --help show this help, then exit So use --config-file=FILENAME? > Clearly, postgresql.auto.conf is within PGDATA, and since my > recovery_command is there, one trick could be to touch and empty > PGDATA/postgresql.conf, pg_rewind, remove the fake configurtion file. > But I'm sure there is a smarter solution. > > Thanks, > Luca > > -- Adrian Klaver adrian.klaver@aklaver.com