下载地址
部署架构
-
启动admin
配置
修改canal.admin\conf\application.yml
server:
port: 8089
spring:
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
spring.datasource:
address: rm-aaaaaa.mysql.rds.aliyuncs.com:3306
database: canal
username: aaaa
password: Zaaaaa
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://${spring.datasource.address}/${spring.datasource.database}?useUnicode=true&characterEncoding=UTF-8&useSSL=false
hikari:
maximum-pool-size: 30
minimum-idle: 1
canal:
adminUser: admin #server 连接的用户名
adminPasswd: admin #server 连接的密码 需要用明文的
执行conf/canal_manager.sql
会生成用于管理Canal的相关表
启动admin
进入bin目录,执行启动命令
./startup.sh
进入log目录查看日志信息,如下就是启动成功
2023-03-05 11:11:14.167 [main] INFO o.s.w.s.m.m.annotation.ExceptionHandlerExceptionResolver - Detected @ExceptionHandler methods in customExceptionHandler
2023-03-05 11:11:14.207 [main] INFO o.s.b.a.web.servlet.WelcomePageHandlerMapping - Adding welcome page: class path resource [public/index.html]
2023-03-05 11:11:14.489 [main] INFO o.s.jmx.export.annotation.AnnotationMBeanExporter - Registering beans for JMX exposure on startup
2023-03-05 11:11:14.493 [main] INFO o.s.jmx.export.annotation.AnnotationMBeanExporter - Bean with name 'dataSource' has been autodetected for JMX exposure
2023-03-05 11:11:14.498 [main] INFO o.s.jmx.export.annotation.AnnotationMBeanExporter - Located MBean 'dataSource': registering with JMX server as MBean [com.zaxxer.hikari:name=dataSource,type=HikariDataSource]
2023-03-05 11:11:14.510 [main] INFO org.apache.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-8090"]
2023-03-05 11:11:14.516 [main] INFO org.apache.tomcat.util.net.NioSelectorPool - Using a shared selector for servlet write/read
2023-03-05 11:11:14.530 [main] INFO o.s.boot.web.embedded.tomcat.TomcatWebServer - Tomcat started on port(s): 8090 (http) with context path ''
2023-03-05 11:11:14.535 [main] INFO com.alibaba.otter.canal.admin.CanalAdminApplication - Started CanalAdminApplication in 3.872 seconds (JVM running for 4.538)
登录
部署机器ip+配置端口即可访问
http://192.168.0.141:8089/
账户密码:admin 123456
-
配置canal-deployer
(admin 会下发默认配置)
删除 canal.properties 将 canal_local.properties 重命名为 canal.properties
# canal admin config
canal.admin.manager = 127.0.0.1:8090
canal.admin.port = 11110
canal.admin.user = admin
canal.admin.passwd = 4ACFE3202A5FF5CF467898FC58AAB1D615029441
# admin auto register
canal.admin.register.auto = true
canal.admin.register.cluster =
canal.admin.register.name =
进入canal.deployer/bin
启动canal服务端
./startup.sh
此时canal服务端会自动注册到管理端
-
配置canal- adapter
配置canal.properties (server 的一些配置信息 源数据存放地址)
https://www.jianshu.com/p/69b9c205bc3a?v=1679042860823
配置instance(具体监听哪个数据库)
https://www.jianshu.com/writer#/notebooks/53784732/notes/110751165
配置adapter(sink)
-
错误信息
server中的状态为’断开’
应该是密码验证问题:
canal server 与 canal admin 的认证机制
canal admin 的 conf/application.yml 里面定义了账号密码明文
canal.adminUser: admin
canal.adminPasswd:admin
canal server 的 conf/canal_local.properties 里面定义了账号密码密文
canal.admin.user: admin
canal.admin.passwd:4ACFE3202A5FF5CF467898FC58AAB1D615029441
密文的生成方式: select password(‘admin’);
双向认证: canal server 向 canal admin 注册的时候会以密码密文做认证, canal admin 对 canal
server 做连通性测试的时候也会将密码明文加密之后做认证 (连通性测试失败的时候,canal admin web 会显示对应的
canal server 处于 “断开” 状态)