赞
踩
- docker exec -it mysql /bin/bash #进入mysql容器
- vi /etc/mysql/mysql.conf.d/mysqld.cnf #编辑mysql配置文件,开启主从模式,binlog模式
添加如下配置:
上图配置如下:
- server-id=12345
- log-bin=/var/lib/mysql/mysql-bin
- binlog-format=ROW
- create user canal@'%' IDENTIFIED by 'canal';
- GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT,SUPER ON *.* TO 'canal'@'%';
- FLUSH PRIVILEGES;
docker restart mysql
- #拉取镜像
- docker pull docker.io/canal/canal-server
- #创建名为canal容器,并宿主机的11111端口,映射容器的11111端口
- docker run -p 11111:11111 --name canal -d docker.io/canal/canal-server
docker exec -it canal /bin/bash
- cd canal-server/conf/
- vi canal.properties
- cd example/
- vi instance.properties
- docker update --restart=always canal
- docker restart canal
下载地址:lt/spring-boot-starter-canal-master
- <dependencies>
- <!--canal依赖-->
- <dependency>
- <groupId>com.xpand</groupId>
- <artifactId>starter-canal</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- </dependency>
- <!--pojo ,feign依赖-->
- <dependency>
- <groupId>org.example</groupId>
- <artifactId>shop-service-content-api</artifactId>
- <version>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。