下载并解压缩
sudo wget https://github.com/alibaba/canal/releases/download/canal-1.1.5-alpha-1/canal.admin-1.1.5-SNAPSHOT.tar.gz sudo tar -zxvf canal.admin-1.1.5-SNAPSHOT.tar.gz 1.4.1.2. 配置文件application.yml
server: port: 8089 spring: jackson: date-format: yyyy-MM-dd HH:mm:ss time-zone: GMT+8 spring.datasource: address: 192.168.2.108:3306 database: canal_manager username: canal password: canal driver-class-name: com.mysql.jdbc.Driver # 数据库连接字符串末尾需添加`serverTimezone=UTC`, 否则启动时会报时区异常; url: jdbc:mysql://${spring.datasource.address}/${spring.datasource.database}?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC hikari: maximum-pool-size: 30 minimum-idle: 1 canal: # 配置 canal-admin 的管理员账号和密码 adminUser: admin adminPasswd: 123456canal_manager.sql
在管理canal-admin数据的数据库中执行该 sql 脚本, 初始化一些表;
1.4.1.3. 启动 canal-admin 服务Linux 对应的启动脚本 ./bin/startup.sh, Windows 对应的启动脚本 ./bin/startup.bat; 以 Windows 为例:
λ .\startup.bat start cmd : java -Xms128m -Xmx512m -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -DappName=canal-admin -classpath "D:\env\green\canal-1.1.5-admin\bin\\..\conf\..\lib\*;D:\env\green\canal-1.1.5-admin\bin\\..\conf" com.alibaba.otter.canal.admin.CanalAdminApplication 2020-04-13 20:01:39.495 [main] INFO com.alibaba.otter.canal.admin.CanalAdminApplication - Starting CanalAdminApplication on Memento-PC with PID 50696 (D:\env\green\canal-1.1.5-admin\lib\canal-admin-server-1.1.5-SNAPSHOT.jar started by Memento in D:\env\green\canal-1.1.5-admin\bin) 2020-04-13 20:01:39.527 [main] INFO com.alibaba.otter.canal.admin.CanalAdminApplication - No active profile set, falling back to default profiles: default 2020-04-13 20:01:39.566 [main] INFO o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@13a5bf6: startup date [Mon Apr 13 20:01:39 CST 2020]; root of context hierarchy 2020-04-13 20:01:41.149 [main] INFO o.s.boot.web.embedded.tomcat.TomcatWebServer - Tomcat initialized with port(s): 8089 (http) 2020-04-13 20:01:41.166 [main] INFO org.apache.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8089"] 2020-04-13 20:01:41.176 [main] INFO org.apache.catalina.core.StandardService - Starting service [Tomcat] 2020-04-13 20:01:41.177 [main] INFO org.apache.catalina.core.StandardEngine - Starting Servlet Engine: Apache Tomcat/8.5.29 ... 2020-04-13 20:01:42.996 [main] INFO org.apache.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-8089"] 2020-04-13 20:01:43.007 [main] INFO org.apache.tomcat.util.net.NioSelectorPool - Using a shared selector for servlet write/read 2020-04-13 20:01:43.019 [main] INFO o.s.boot.web.embedded.tomcat.TomcatWebServer - Tomcat started on port(s): 8089 (http) with context path '' 2020-04-13 20:01:43.024 [main] INFO com.alibaba.otter.canal.admin.CanalAdminApplication - Started CanalAdminApplication in 3.919 seconds (JVM running for 5.241) 1.4.1.4. 注意事项canal-admin 连接数据库的账号, 必须有建表, 读写数据的权限, 如果还是采用上文中创建的 canal 账号, 需要另外扩展一下权限:
GRANT ALL PRIVILEGES ON *.* TO 'canal'@'%' ; 1.4.2. 添加单机 canal-server 节点 1.4.2.1. 启动 canal-server 节点服务单机 canal-server 照常启动, 此时, canal-server 默认加载的 ../conf/canal.properties 里的配置信息, 可以从 ../bin/startup.bat[startup.sh] 脚本中获悉, 获取从执行的脚本命令提示里获悉;
1.4.2.2. 新建单机 server在 canal-admin 中新建一个单机 server