无法在 2 个 GCP CloudSQL 实例之间设置 pglogical 复制

无法在 2 个 GCP CloudSQL 实例之间设置 pglogical 复制

我目前正在尝试在 2 个 GCP CloudSQL Postgres 实例之间设置pglogical复制,以便在区域之间快速迁移数据。

我按照 GCP 文档[1] 创建一个replicator用户,以该用户的身份安装pglogical扩展并执行所需的配置。

但是,每当我在目标服务上创建订阅时,状态最初变为initializing然后更改为down. Looking at thepostgres 日志,我可以在目标端看到以下错误:

db=api,user=replicator ERROR:  permission denied for function pg_replication_origin_session_setup

我可以在目标数据库中看到提到的函数,但是每当我尝试GRANT EXECUTE使用它时,都会收到如下警告。

postgres=> \df+ pg_replication_origin_session_setup

      List of functions
   Schema   |                Name                 | Result data type | Argument data types | Type | Volatility | Parallel |     Owner     | Securi
ty |         Access privileges         | Language |             Source code             |                                     Description

------------+-------------------------------------+------------------+---------------------+------+------------+----------+---------------+-------
---+-----------------------------------+----------+-------------------------------------+---------------------------------------------------------
-----------------------------
 pg_catalog | pg_replication_origin_session_setup | void             | text                | func | volatile   | unsafe   | cloudsqladmin | invoke
r  | cloudsqladmin=X/cloudsqladmin    +| internal | pg_replication_origin_session_setup | configure session to maintain replication progress track
ing for the passed in origin
            |                                     |                  |                     |      |            |          |               |
   | cloudsqlsuperuser=X/cloudsqladmin |          |                                     |
(1 row)

postgres=> \du replicator
                 List of roles
 Role name  | Attributes  |      Member of
------------+-------------+---------------------
 replicator | Replication | {cloudsqlsuperuser}

postgres=> GRANT EXECUTE ON FUNCTION pg_catalog.pg_replication_origin_session_setup TO replicator;
WARNING:  no privileges were granted for "pg_replication_origin_session_setup"
GRANT

有人曾经在 CloudSQL 上进行过设置吗pglogical?或者见过上述permission denied错误?


提前致谢。Gavin

[1]https://cloud.google.com/sql/docs/postgres/replication/configure-logical-replication#configure-your-postgresql-instance

相关内容