Skip to content

Commit

Permalink
cdc: update topic expression description (#15115)
Browse files Browse the repository at this point in the history
  • Loading branch information
3AceShowHand authored Oct 8, 2023
1 parent 2a6ff7f commit dbed07d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ticdc/ticdc-sink-to-kafka.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,10 @@ dispatchers = [

Topic 分发器用 topic = "xxx" 来指定,并使用 topic 表达式来实现灵活的 topic 分发策略。topic 的总数建议小于 1000。

Topic 表达式的基本规则为 `[prefix]{schema}[middle][{table}][suffix]`,详细解释如下:
Topic 表达式的基本规则为 `[prefix][{schema}][middle][{table}][suffix]`,详细解释如下:

- `prefix`:可选项,代表 Topic Name 的前缀。
- `{schema}`必选项,用于匹配库名。
- `{schema}`可选项,用于匹配库名。
- `middle`:可选项,代表库表名之间的分隔符。
- `{table}`:可选项,用于匹配表名。
- `suffix`:可选项,代表 Topic Name 的后缀。
Expand All @@ -195,11 +195,13 @@ Topic 表达式的基本规则为 `[prefix]{schema}[middle][{table}][suffix]`,
一些示例如下:

- `matcher = ['test1.table1', 'test2.table2'], topic = "hello_{schema}_{table}"`
- 对于表 `test1.table1` 对应的数据变更事件,发送到名为 `hello_test1_table1` 的 topic 中
- 对于表 `test2.table2` 对应的数据变更事件,发送到名为 `hello_test2_table2` 的 topic 中
- 对于表 `test1.table1` 对应的数据变更事件,发送到名为 `hello_test1_table1` 的 topic 中
- 对于表 `test2.table2` 对应的数据变更事件,发送到名为 `hello_test2_table2` 的 topic 中
- `matcher = ['test3.*', 'test4.*'], topic = "hello_{schema}_world"`
- 对于 `test3` 下的所有表对应的数据变更事件,发送到名为 `hello_test3_world` 的 topic 中
- 对于 `test4` 下的所有表对应的数据变更事件,发送到名为 `hello_test4_ world` 的 topic 中
- 对于 `test3` 下的所有表对应的数据变更事件,发送到名为 `hello_test3_world` 的 topic 中。
- 对于 `test4` 下的所有表对应的数据变更事件,发送到名为 `hello_test4_world` 的 topic 中。
- `matcher = ['test5.*, 'test6.*'], topic = "hard_code_topic_name"`
- 对于 `test5` 和 `test6` 下的所有表对应的数据变更事件,发送到名为 `hard_code_topic_name` 的 topic 中。你可以直接指定 topic 名称。
- `matcher = ['*.*'], topic = "{schema}_{table}"`
- 对于 TiCDC 监听的所有表,按照“库名_表名”的规则分别分发到独立的 topic 中;例如对于 `test.account` 表,TiCDC 会将其数据变更日志分发到名为 `test_account` 的 Topic 中。
Expand Down

0 comments on commit dbed07d

Please sign in to comment.