下沉到 Kinesis 时,具有自定义规则的 Amazon DMS 任务失败

Pra*_*ris 5 amazon-web-services aws-dms amazon-dms

我正在尝试使用 Amazon DMS 监听 Aurora 数据库更改并将更改推送到 Kinesis 流,其中监听流的 Lambda 函数将进行处理。

我指的是下面的文档来编写我的规则。

https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.Kinesis.html https://aws.amazon.com/blogs/database/use-the-aws-database-migration-service-to -stream-change-data-to-amazon-kinesis-data-streams/

这是我的 DMS 持续复制 (CDC) 任务的规则映射。

{
    "rules": [
        {
            "rule-type": "selection",
            "rule-id": "1",
            "rule-name": "1",
            "object-locator": {
                "schema-name": "my_db",
                "table-name": "my_table"
            },
            "rule-action": "include"
        },
        {
            "rule-type": "object-mapping",
            "rule-id": "2",
            "rule-name": "2",
            "rule-action": "map-record-to-record",
            "object-locator": {
                "schema-name": "my_db",
                "table-name": "my_table"
            },
            "mapping-parameters": {
                "partition-key": {
                    "attribute-name": "my_id",
                    "value": "${my_id}"
                }
            }
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

但是,当我对源表进行更改时,DMS 任务失败并出现以下错误。

2019-02-05T10:36:55 [TARGET_APPLY ]E: Error allocating memory for Json document [1020100] (field_mapping_utils.c:382)
2019-02-05T10:36:55 [TARGET_APPLY ]E: Failed while looking for object mapping for table my_table [1020100] (kinesis_utils.c:258)
2019-02-05T10:36:55 [TARGET_APPLY ]E: Error executing data handler [1020100] (streamcomponent.c:1778)
2019-02-05T10:36:55 [TASK_MANAGER ]E: Stream component failed at subtask 0, component st_0_some_random_id [1020100] (subtask.c:1366)
2019-02-05T10:36:55 [TASK_MANAGER ]E: Task error notification received from subtask 0, thread 1 [1020100] (replicationtask.c:2661)
2019-02-05T10:36:55 [TASK_MANAGER ]W: Task 'some_random_task_id' encountered a fatal error (repository.c:4704)
Run Code Online (Sandbox Code Playgroud)

当我在没有object-mapping规则的情况下尝试时,Kinesis 将获得"partitionKey": "my_db.my_table"具有正确值的记录,这是 table-to-table sink 的默认行为,但我们需要 table-to-kinesis sink。

为什么我partition-key这么在意?因为我需要利用 Kinesis 流中的所有分片。

有人能帮我吗?

更新:

当我添加"partition-key-type": "schema-table"到 时"mapping-parameters",它不会失败,任务不会失败,但会忽略该"partition-key"属性并且会"partitionKey": "my_db.my_table"像以前一样。

不确定点:

  1. 在 table-to-table sinking 中,它使用"partition-key-type": "schema-table",但从未提及 table-to-kinesis 的价值。
  2. 文档中的示例和解释非常有限,甚至是错误的(即某些规则 JSON 无效)

Pra*_*ris 3

所以,我在这里回答我自己的问题。

我们联系了 AWS 支持团队,他们表示这是他们的问题,而且文档并未反映确切的功能。他们还在内部提出了一个问题,并在未来修复它。

目前,由于 DMS 无法满足我们的期望,我们决定转向不同的解决方案。