
Me encontré con este aviso de error al intentar ejecutar pg_rewind
la repmgr
antigua degradación principal de 's al modo de espera después de la recuperación. (el antiguo modo de espera @192.168.1.2 ya se ejecutó repmgr standby promote
)
postgres
version=15.4 repmgr
version=5.4dev y el comando para ejecutar dicho proceso y los siguientes comentarios son estos:
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
En realidad, le he otorgado el derecho de ejecución de la función pg_read_binary_file al representante del usuario, y aquí está la configuración para esta función:
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;
Le volví a conceder el derecho usando GRANT EXECUTE ON function pg_read_binary_file(text) TO rep;
y no hizo ninguna diferencia. ¿No es que el usuario rep
no tenga derecho a ejecutar la función, sino que la función no tiene derecho a hacerlo fetch remote file "global/pg_control"
? Por cierto, no le di a ssh el derecho de acceder a la cuenta de Postgres Linux en otro servidor por razones de seguridad.