postgresql 如何正确设置权限以启动Postgres复制?

bnlyeluc  于 2023-10-18  发布在  PostgreSQL
关注(0)|答案(2)|浏览(189)

我正在尝试按照Debezium教程为Postgres设置一个复制用户。我正在创建复制用户,如下所示:

CREATE ROLE replication_role WITH REPLICATION LOGIN;

CREATE USER debezium WITH PASSWORD 'my-secret-pw';

GRANT replication_role TO debezium;

CREATE ROLE replication_group WITH LOGIN;

GRANT replication_group TO postgres;

GRANT replication_group TO debezium;

ALTER TABLE person OWNER TO replication_group;

并按如下方式设置复制用户:

List of roles
     Role name     |                         Attributes                         |              Member of               
-------------------+------------------------------------------------------------+--------------------------------------
 debezium          |                                                            | {replication_role,replication_group}
 postgres          | Superuser, Create role, Create DB, Replication, Bypass RLS | {replication_group}
 replication_group |                                                            | {}
 replication_role  | Replication                                                | {}

当我尝试启动Postgres源连接器时,我得到如下错误:

io.debezium.DebeziumException: Creation of replication slot failed
...
Caused by: org.postgresql.util.PSQLException: FATAL: must be superuser or replication role to start walsender

如何修复权限问题,以便可以从Postgres开始复制?

lymnna71

lymnna711#

不继承复制属性。该属性必须直接在将使用它的角色上设置。你说你在遵循教程,但据我所知,你没有。您似乎混淆了创建发布所需的权限/属性和流式发布所需的权限/属性。

wkyowqbh

wkyowqbh2#

ALTER USER debezium REPLICATION;

相关问题