
Me deparei com este aviso de erro ao tentar executar pg_rewind
o repmgr
antigo rebaixamento primário para espera após a recuperação. (o antigo standby @192.168.1.2 já foi executado repmgr standby promote
)
postgres
version=15.4 repmgr
version=5.4dev e o comando para executar tal processo e os seguintes comentários são estes:
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
Na verdade, concedi a execução da função pg_read_binary_file diretamente ao representante do usuário, e aqui está a configuração para esta função:
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;
Concedi novamente o direito usando GRANT EXECUTE ON function pg_read_binary_file(text) TO rep;
, e não fez diferença. Não é que o usuário rep
não tenha o direito de executar a função, mas que a função não tenha o direito de fetch remote file "global/pg_control"
? Aliás, eu não dei ao ssh o direito de acessar a conta postgres Linux em outro servidor por motivos de segurança.