amazon-web-services - 使用 AWS DMS 进行 Postgres 到 Postgres 数据迁移时,如何修复“列“xlog_position”不存在”错误
问题描述
我正在尝试使用 AWS DMS 迁移和同步 PostgreSQL 数据库,但出现以下错误。
Last Error Task error notification received from subtask 0, thread 0 [reptask/replicationtask.c:2673] [1020487]
RetCode: "SQL_ERROR SqlState: 42703 NativeError: 1
Message: ERROR: column "xlog_position" does not exist; No query has been executed with that handle; RetCode: SQL_ERROR SqlState: 42P01 NativeError: 1
Message: ERROR: relation "pglogical.replication_set" does not exist; No query has been executed with that handle; RetCode: SQL_ERROR SqlState: 42703 NativeError: 1 Message: ERROR: column "xlog_position" does not exist; No query has been executed with that handle;
Could not find any supported plugins available on source; Could not resolve default plugin; Could not assign a postgres plugin to use for replication; Failure in setting Postgres CDC agent control structure; Error executing command; Stream component failed at subtask 0, component st_0_JX7ONUUGB4A2AR2VQ4FMEZ7PFU ; Stream component 'st_0_JX7ONUUGB4A2AR2VQ4FMEZ7PFU' terminated [reptask/replicationtask.c:2680] [1020487] Stop Reason FATAL_ERROR Error Level FATAL
我使用两个 PostgreSQL 实例作为源和目标。我已经测试并验证了复制实例可以访问两个数据库实例。目标实例用户对数据库具有完全访问权限。我是否需要安装任何插件或进行其他配置才能使此迁移设置正常工作?
解决方案
为 Amazon RDS for PostgreSQL 数据库实例启用逻辑解码
用户帐户需要
rds_superuser
角色才能启用逻辑复制。用户帐户还需要该rds_replication
角色授予管理逻辑槽和使用逻辑槽流式传输数据的权限。将 rds.logical_replication 静态参数设置为 1。作为应用此参数的一部分,我们还设置了参数
wal_level
、max_wal_senders
、max_replication_slots
和max_connections
。这些参数更改会增加 WAL 生成,因此您应该只在rds.logical_replication
使用逻辑插槽时设置该参数。重启数据库实例,使静态
rds.logical_replication
参数生效。按照下一节中的说明创建一个逻辑复制槽。此过程需要您指定解码插件。目前我们支持 PostgreSQL 附带的 test_decoding 输出插件。
最后一项可以使用以下命令完成:
SELECT * FROM pg_create_logical_replication_slot('test_slot', 'test_decoding');
推荐阅读
- node.js - 在本地运行 angular 和 node.js 项目而不共享代码
- python - Python 正则表达式捕获跨越多行的多个匹配项
- c++ - 将 Mat 传递给线程时,OpenCV C++ 内存泄漏
- tensorflow - 验证损失永远不会减少
- multithreading - 什么是新手的原子操作?
- swift - 谷歌地图内存问题
- amazon-web-services - 如何使用 SSM 调用 AWS Lambda 函数
- java - com.mysql.cj.jdbc.exceptions.MysqlDataTruncation:数据截断:第 1 行的列“矩阵”的数据太长
- javascript - Javascript使用自定义时区以毫秒为单位获取当前时间
- logging - 向使用 systemd 的 Kubernetes 集群添加集中式日志记录