mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
Updated Canal Kafka RocketMQ QuickStart (markdown)
@@ -60,13 +60,6 @@ canal.mq.partition=0
|
||||
```
|
||||
对应ip 地址的MySQL 数据库需进行相关初始化与设置, 可参考 [Canal QuickStart](https://github.com/alibaba/canal/wiki/QuickStart)
|
||||
|
||||
dynamicTopic规则:
|
||||
表达式如果只有库名则匹配库名的数据都会发送到对应名称topic, 如果是库名.表名则匹配的数据会发送到以'库名_表名'为名称的topic。如要指定topic名称,则可以配置:
|
||||
```
|
||||
canal.mq.dynamicTopic=example1:.*;exmaple2:mytest2\\..*;example3:mytest3.user
|
||||
```
|
||||
以topic名 ':' 正则规则作为配置, 多个topic配置之间以 ';'隔开, message会发送到所有符合规则的topic
|
||||
|
||||
#### b. 修改canal 配置文件`vi /usr/local/canal/conf/canal.properties `
|
||||
```
|
||||
# ...
|
||||
@@ -118,15 +111,19 @@ canal.mq.transaction = false
|
||||
|
||||
### canal.mq.dynamicTopic 表达式说明
|
||||
|
||||
canal 1.1.3版本之后, 支持配置格式:schema 或 schema.table,多个配置之间使用逗号分隔
|
||||
* 例子1:test\\\\.test 指定匹配的单表,发送到以 test_test为名字的topic上
|
||||
* 例子2:.\\\\..\* 匹配所有表,每个表都会发送到各自表名的topic上
|
||||
canal 1.1.3版本之后, 支持配置格式:schema 或 schema.table,多个配置之间使用逗号或分号分隔
|
||||
* 例子1:test\\\\.test 指定匹配的单表,发送到以test_test为名字的topic上
|
||||
* 例子2:.\\\\..\* 匹配所有表,则每个表都会发送到各自表名的topic上
|
||||
* 例子3:test 指定匹配对应的库,一个库的所有表都会发送到库名的topic上
|
||||
* 例子4:test\\\\.* 指定匹配的表达式,针对匹配的表会发送到各自表名的topic上
|
||||
* 例子5:test,test1\\\\.test1,指定多个表达式,会将test库的表都发送到test的topic上,test1\\\\.test1的表发送到对应的test1_test1 topic上,其余的表发送到默认的canal.mq.topic值
|
||||
|
||||
支持指定topic名称匹配, 配置格式:topicName:schema 或 schema.table,多个配置之间使用逗号分隔, 多组之间使用 ; 分隔
|
||||
* 例子:test:test,test1\\\\.test1;test2:test2,test3\\\\.test1 针对匹配的表会发送到指定的topic上
|
||||
为满足更大的灵活性,允许对匹配条件的规则指定发送的topic名字,配置格式:topicName:schema 或 topicName:schema.table
|
||||
* 例子1: test:test\\\\.test 指定匹配的单表,发送到以test为名字的topic上
|
||||
* 例子2: test:.\\\\..\* 匹配所有表,因为有指定topic,则每个表都会发送到test的topic下
|
||||
* 例子3: test:test 指定匹配对应的库,一个库的所有表都会发送到test的topic下
|
||||
* 例子4:testA:test\\\\.* 指定匹配的表达式,针对匹配的表会发送到testA的topic下
|
||||
* 例子5:test0:test,test1:test1\\\\.test1,指定多个表达式,会将test库的表都发送到test0的topic下,test1\\\\.test1的表发送到对应的test1的topic下,其余的表发送到默认的canal.mq.topic值
|
||||
|
||||
大家可以结合自己的业务需求,设置匹配规则,建议MQ开启自动创建topic的能力
|
||||
|
||||
|
||||
Reference in New Issue
Block a user