docker 部署 canal

1、docker部署canal/canal-server:v1.1.6

1.1、下载镜像

docker pull canal/canal-server:v1.1.6

1.2、挂载properties配置文件

1.2.1、先进行第一次运行,拷贝properties配置文件

docker run -p 11111:11111 --name canal -d canal/canal-server:v1.1.6

1.2.2、拷贝运行后的容器中配置文件,用来文件挂载

# 创建canal宿主机挂载目录
mkdir -p /docker/canal/conf
# 查看docker运行情况,复制容器id
docker ps
# 拷贝配置文件
docker cp canal:/home/admin/canal-server/conf/example/instance.properties /docker/canal/conf

1.2.3、移除当前容器

docker stop canal
docker rm canal

1.3、修改配置文件

#################################################
## mysql serverId , v1.0.26+ will autoGen
canal.instance.mysql.slaveId=3

# enable gtid use true/false
canal.instance.gtidon=false

# position info
canal.instance.master.address=192.168.209.104:3306
canal.instance.master.journal.name=
canal.instance.master.position=
canal.instance.master.timestamp=
canal.instance.master.gtid=

# rds oss binlog
canal.instance.rds.accesskey=
canal.instance.rds.secretkey=
canal.instance.rds.instanceId=

# table meta tsdb info
canal.instance.tsdb.enable=true
#canal.instance.tsdb.url=jdbc:mysql://127.0.0.1:3306/canal_tsdb
#canal.instance.tsdb.dbUsername=canal
#canal.instance.tsdb.dbPassword=canal

#canal.instance.standby.address =
#canal.instance.standby.journal.name =
#canal.instance.standby.position =
#canal.instance.standby.timestamp =
#canal.instance.standby.gtid=

# username/password
canal.instance.dbUsername=canal
canal.instance.dbPassword=canal
canal.instance.connectionCharset = UTF-8
# enable druid Decrypt database password
canal.instance.enableDruid=false
#canal.instance.pwdPublicKey=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALK4BUxdDltRRE5/zXpVEVPUgunvscYFtEip3pmLlhrWpacX7y7GCMo2/JM6LeHmiiNdH1FWgGCpUfircSwlWKUCAwEAAQ==

# table regex
canal.instance.filter.regex=.*\\..*
# table black regex
canal.instance.filter.black.regex=mysql\\.slave_.*,.\.BASE TABLE.
# table field filter(format: schema1.tableName1:field1/field2,schema2.tableName2:field1/field2)
#canal.instance.filter.field=test1.t_product:id/subject/keywords,test2.t_company:id/name/contact/ch
# table field black filter(format: schema1.tableName1:field1/field2,schema2.tableName2:field1/field2)
#canal.instance.filter.black.field=test1.t_product:subject/product_image,test2.t_company:id/name/contact/ch

# mq config
canal.mq.topic=example
# dynamic topic route by schema or table regex
#canal.mq.dynamicTopic=mytest1.user,topic2:mytest2\\..*,.*\\..*
canal.mq.partition=0

image

1.4、创建容器

docker run -p 11111:11111 --name canal -v /docker/canal/conf/instance.properties:/home/admin/canal-server/conf/example/instance.properties -d canal/canal-server:v1.1.6

报错修复
image
v1.1.6 会出现的问题
https://github.com/alibaba/canal/issues/4291
方案一:新建一个BASE TABLE 表
方案二:加过滤(无效)
方案三:升降级

posted @ 2023-05-04 10:34  尐海爸爸  阅读(1007)  评论(0编辑  收藏  举报