
當我嘗試執行復原後將舊的主降級為備用的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 的執行權授予使用者代表,以下是該角色的設定:
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 帳戶的權限。