pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Zhaoxun Yan <yan.zhaoxun@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: pg_rewind: ERROR: could not fetch remote file "global/pg_control": ERROR: permission denied
Date: Fri, 29 Sep 2023 15:50:42 +0900
Message-ID: <ZRZzwrMJxugIK4Cf@paquier.xyz> (raw)
In-Reply-To: <CADEX6_UmT-uPk=W7HmD=t+8rNWQwtG+z1Ug_EDb_ejr9EsZ55g@mail.gmail.com>
References: <CADEX6_UmT-uPk=W7HmD=t+8rNWQwtG+z1Ug_EDb_ejr9EsZ55g@mail.gmail.com>

On Wed, Sep 27, 2023 at 05:27:44PM +0800, Zhaoxun Yan wrote:
> $ /usr/pgsql-16/bin/pg_rewind -D '/pgdata' --source-server='host=172.17.1.2
> port=5432 user=rep dbname=repmgr connect_timeout=5'
> pg_rewind: error: could not fetch remote file "global/pg_control": ERROR:
>  permission denied for function pg_read_binary_fileOriginally the server
> here at 172.17.0.2 was the primary and 172.17.1.2 was the standby
> replication server.  I have created the user 'rep' with full replication
> privilege as described on page:
> https://www.postgresql.org/docs/16/app-pgrewind.html
> 
> CREATE EXTENSION repmgr;
> GRANT pg_checkpoint TO rep;
> GRANT pg_read_all_stats TO rep;
> GRANT EXECUTE ON function pg_catalog.pg_ls_dir(text, boolean, boolean) TO rep;
> GRANT EXECUTE ON function pg_catalog.pg_stat_file(text, boolean) TO rep;
> GRANT EXECUTE ON function pg_catalog.pg_read_binary_file(text) TO rep;
> GRANT EXECUTE ON function pg_catalog.pg_read_binary_file(text, bigint,
> bigint, boolean

This set of permissions should be enough, so you got the idea from the
documentation the right way.  One guess: are you sure that these GRANT
queries have been run on the same database as the one queried by
pg_rewind when getting the files from an online source for the target
cluster to rewind?
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (4+ messages)  latest in thread

Message-ID: <ZRZzwrMJxugIK4Cf@paquier.xyz>
Permalink:  ../ZRZzwrMJxugIK4Cf@paquier.xyz/
Also on:    postgresql.org/message-id/ZRZzwrMJxugIK4Cf@paquier.xyz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: michael@paquier.xyz, yan.zhaoxun@gmail.com
  Subject: Re: pg_rewind: ERROR: could not fetch remote file "global/pg_control": ERROR: permission denied
  In-Reply-To: <ZRZzwrMJxugIK4Cf@paquier.xyz>
  References: <CADEX6_UmT-uPk=W7HmD=t+8rNWQwtG+z1Ug_EDb_ejr9EsZ55g@mail.gmail.com> <ZRZzwrMJxugIK4Cf@paquier.xyz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox