mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
Updated ClientAdapter (markdown)
@@ -43,44 +43,33 @@ client-adapter分为适配器和启动器两部分, 适配器为多个fat jar,
|
|||||||
#### adapter定义配置部分
|
#### adapter定义配置部分
|
||||||
```
|
```
|
||||||
canal.conf:
|
canal.conf:
|
||||||
canalServerHost: 127.0.0.1:11111 # 对应单机模式下的canal server的ip:port
|
canalServerHost: 127.0.0.1:11111 # 对应单机模式下的canal server的ip:port
|
||||||
zookeeperHosts: slave1:2181 # 对应集群模式下的zk地址, 如果配置了canalServerHost, 则以canalServerHost为准
|
zookeeperHosts: slave1:2181 # 对应集群模式下的zk地址, 如果配置了canalServerHost, 则以canalServerHost为准
|
||||||
bootstrapServers: slave1:6667 # kafka或rocketMQ地址, 与canalServerHost不能并存
|
mqServers: slave1:6667 #or rocketmq # kafka或rocketMQ地址, 与canalServerHost不能并存
|
||||||
flatMessage: true # 扁平message开关, 是否以json字符串形式投递数据, 仅在kafka/rocketMQ模式下有效
|
flatMessage: true # 扁平message开关, 是否以json字符串形式投递数据, 仅在kafka/rocketMQ模式下有效
|
||||||
canalInstances: # canal实例组, 如果是tcp模式可配置此项
|
batchSize: 50 # 每次获取数据的批大小, 单位为K
|
||||||
- instance: example # 对应canal destination
|
syncBatchSize: 1000 # 每次同步的批数量
|
||||||
groups: # 对应适配器分组, 分组间的适配器并行运行
|
retries: 0 # 重试次数
|
||||||
- outAdapters: # 适配器列表, 分组内的适配串行运行
|
timeout: # 同步超时时间, 单位毫秒
|
||||||
- name: logger # 适配器SPI名
|
mode: tcp # kafka rocketMQ # canal client的模式: tcp kafka rocketMQ
|
||||||
- name: hbase
|
srcDataSources: # 源数据库
|
||||||
properties: # HBase相关连接参数
|
defaultDS: # 自定义名称
|
||||||
hbase.zookeeper.quorum: slave1
|
url: jdbc:mysql://127.0.0.1:3306/mytest?useUnicode=true # jdbc url
|
||||||
hbase.zookeeper.property.clientPort: 2181
|
username: root # jdbc 账号
|
||||||
zookeeper.znode.parent: /hbase
|
password: 121212 # jdbc 密码
|
||||||
mqTopics: # MQ topic租, 如果是kafka或者rockeMQ模式可配置此项, 与canalInstances不能并存
|
canalAdapters: # 适配器列表
|
||||||
- mqMode: kafka # MQ的模式: kafak/rocketMQ
|
- instance: example # canal instance Name or mq topic name
|
||||||
topic: example # MQ topic
|
groups: # 分组列表
|
||||||
groups: # group组
|
- groupId: g1 # 分组id, 如果是MQ模式将用到该值
|
||||||
- groupId: g2 # group id
|
outerAdapters: # 分组内适配器列表
|
||||||
outAdapters: # 适配器列表, 以下配置和canalInstances中一样
|
- name: logger # 日志打印适配器
|
||||||
- name: logger
|
......
|
||||||
```
|
```
|
||||||
|
|
||||||
说明:
|
说明:
|
||||||
1. 一份数据可以被多个group同时消费, 多个group之间会是一个并行执行, 一个group内部是一个串行执行多个outAdapters, 比如例子中logger和hbase
|
1. 一份数据可以被多个group同时消费, 多个group之间会是一个并行执行, 一个group内部是一个串行执行多个outerAdapters, 比如例子中logger和hbase
|
||||||
2. 目前client adapter数据订阅的方式支持两种,直连canal server 或者 订阅kafka/RocketMQ的消息, 一个client adapter进程里可以同时两种
|
2. 目前client adapter数据订阅的方式支持两种,直连canal server 或者 订阅kafka/RocketMQ的消息
|
||||||
|
|
||||||
#### adapter参数配置部分
|
|
||||||
```
|
|
||||||
adapter.conf:
|
|
||||||
datasourceConfigs: # 数据源配置列表, 数据源将在适配器中用于ETL、数据同步回查等使用
|
|
||||||
defaultDS: # 数据源 dataSourceKey, 适配器中通过该值获取指定数据源
|
|
||||||
url: jdbc:mysql://127.0.0.1:3306/mytest?useUnicode=true
|
|
||||||
username: root
|
|
||||||
password: 121212
|
|
||||||
adapterConfigs: # 适配器内部配置列表
|
|
||||||
- hbase/mytest_person2.yml # 类型/配置文件名, 这里示例就是对应HBase适配器hbase目录下的mytest_person2.yml文件
|
|
||||||
```
|
|
||||||
|
|
||||||
## 三、适配器启动
|
## 三、适配器启动
|
||||||
|
|
||||||
@@ -101,11 +90,16 @@ spring:
|
|||||||
|
|
||||||
canal.conf:
|
canal.conf:
|
||||||
canalServerHost: 127.0.0.1:11111
|
canalServerHost: 127.0.0.1:11111
|
||||||
flatMessage: true
|
batchSize: 500
|
||||||
canalInstances:
|
syncBatchSize: 1000
|
||||||
|
retries: 0
|
||||||
|
timeout:
|
||||||
|
mode: tcp
|
||||||
|
canalAdapters:
|
||||||
- instance: example
|
- instance: example
|
||||||
adapterGroups:
|
groups:
|
||||||
- outAdapters:
|
- groupId: g1
|
||||||
|
outerAdapters:
|
||||||
- name: logger
|
- name: logger
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -169,6 +163,8 @@ curl http://127.0.0.1:8081/count/hbase/mytest_person2.yml
|
|||||||
|
|
||||||
### ES适配器
|
### ES适配器
|
||||||
|
|
||||||
|
同步关ES配置 : [[Sync-ES]]
|
||||||
|
|
||||||
### MongoDB适配器
|
### MongoDB适配器
|
||||||
|
|
||||||
### Redis适配器
|
### Redis适配器
|
||||||
Reference in New Issue
Block a user