9.5 9.5 安装 canal 和启动

步骤 1: 下载 Canal

wget https://github.com/alibaba/canal/releases/download/canal-1.1.2/canal.deployer-1.1.2.tar.gz

步骤 2: 解压

mkdir /opt/module/canal
tar -zxvf canal.deployer-1.1.2.tar.gz -C /opt/module/canal

步骤 3: 配置

  1. conf/canal.properties canal 的通用配置, 主要关注下canal.port, 默认是11111

  2. conf/example/instance.properties instance.properties是针对要追踪的 mysql 的实例配置

    #################################################
    ## mysql serverId , v1.0.26+ will autoGen
    # slaveId 必须配置, 不能和 mysql 的 id 重复
    canal.instance.mysql.slaveId=100
    
    # enable gtid use true/false
    canal.instance.gtidon=false
    
    # position info
    # mysql 的位置信息
    canal.instance.master.address=hadoop201: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=root
    canal.instance.dbPassword=aaa
    canal.instance.connectionCharset = UTF-8
    canal.instance.defaultDatabaseName =
    # 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=
    
    # mq config
    canal.mq.topic=example
    canal.mq.partition=0
    # hash partition config
    #canal.mq.partitionsNum=3
    #canal.mq.partitionHash=mytest.person:id,mytest.role:id
    #################################################
    

步骤 4: 启动 canal

bin/startup.sh

步骤 5: 查看日志

步骤 6: 关闭 Canal

bin/stop.sh
Copyright © 尚硅谷大数据 2019 all right reserved,powered by Gitbook
该文件最后修订时间: 2019-10-08 23:56:19

results matching ""

    No results matching ""