我在尝试pg_rewind
通过将repmgr
旧的主服务器降级为恢复后的备用服务器来执行时遇到了此错误通知。(旧的备用服务器@192.168.1.2已经执行repmgr standby promote
)
postgres
version=15.4 repmgr
version=5.4dev 执行该过程的命令以及以下反馈如下:
repmgr node rejoin --force-rewind -d 'host=192.168.1.2 port=5432 user=rep dbname=repmgr connect_timeout=5'
NOTICE: rejoin target is node "yzx2" (ID: 2)
NOTICE: pg_rewind execution required for this node to attach to rejoin target node 2
DETAIL: rejoin target server's timeline 2 forked off current database system timeline 1 before current recovery point 0/81C6D80
NOTICE: executing pg_rewind
DETAIL: pg_rewind command is "/usr/pgsql-15/bin/pg_rewind -D '/pgdata' --source-server='host=192.168.1.2 port=5432 user=rep dbname=repmgr connect_timeout=5'"
ERROR: pg_rewind execution failed
DETAIL: pg_rewind: error: could not fetch remote file "global/pg_control": ERROR: permission denied for function pg_read_binary_file
实际上我已经将函数pg_read_binary_file的执行权限授予了用户rep,下面是这个角色的设置:
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) TO rep;
我使用 重新授予权限GRANT EXECUTE ON function pg_read_binary_file(text) TO rep;
,但没有任何变化。并不是用户rep
无权执行该函数,而是该函数无权fetch remote file "global/pg_control"
?顺便说一句,出于安全原因,我没有授予 ssh 权限来访问另一台服务器上的 postgres Linux 帐户。