cloudsql 到 cloudsql 迁移权限问题

问题描述 投票:0回答:2

我正在尝试使用 gcp 数据库迁移工具将 cloudsql postgres 9.6 实例迁移到 cloudsql postgres 13 实例。

我在 UI 中使用标志将

cloudsql.enable_pglogical
cloudsql.logical_decoding
设置为打开,并重新启动实例,但在尝试使用 postgres 帐户运行迁移时仍然收到以下错误。

连接源数据库失败。确保用户具有所需的权限。解决问题然后重新启动迁移作业。详细信息:复制用户 postgres 没有足够的权限:复制用户对数据库 postgres 中的 schema pglogic 没有 USAGE 权限;复制用户没有对表 public.team_members 的 SELECT 权限,复制用户没有对表 public.doc_comment_read 的 SELECT 权限,复制用户没有对表 public.mailbox_google 的 SELECT 权限,复制用户没有 SELECT 权限在表 public.doc_editor 上,复制用户没有对表 public.mailbox_microsoft 的 SELECT 权限,复制用户没有对表 public.enrollment_whitelist 的 SELECT 权限,复制用户没有对表 public.group_members 的 SELECT 权限,复制用户没有表 public.team_invites 的 SELECT 权限,复制用户没有表 public 的 SELECT 权限...

google-cloud-platform google-cloud-sql
2个回答
0
投票

所以我发现了一些事情。

  1. 您不能使用 postgres 用户进行此迁移,因为 postgres 用户没有复制属性。

https://cloud.google.com/sql/docs/postgres/users

The postgres user is part of the cloudsqlsuperuser role, and has the following attributes (privileges): CREATEROLE, CREATEDB, and LOGIN. It does not have the SUPERUSER or REPLICATION attributes.

  1. 您需要确保使用数据库的所有者来进行迁移,而不是 postgres 用户。

  2. 您必须授予您的用户对 pglogic 模式的权限。

GRANT USAGE ON SCHEMA pglogical TO my_user;
GRANT ALL ON SCHEMA pglogical TO my_user;

  1. 将复制属性添加到您的用户(您需要从 postgres 用户执行此操作)

ALTER ROLE my_user with REPLICATION;


0
投票

补充一下,完全可以使用

postgres
用户进行复制。您需要为其设置复制属性

ALTER ROLE postgres with REPLICATION;

然后授予必要的权限(请参阅第 3 点)。

© www.soinside.com 2019 - 2024. All rights reserved.