canal-admin 1.1.5 启动实例,对应目录下没有生成meta.bat文件,日志运行正常,但是kafka中没有数据。
server配置
################################################# ######### common argument ############# #################################################
canal.ip =
canal.register.ip = canal.port = 11111 canal.metrics.pull.port = 11112
#canal.admin.manager = 127.0.0.1:8089 canal.admin.port = 11110 canal.admin.user = admin canal.admin.passwd = 123456
canal.zkServers =
canal.zookeeper.flush.period = 1000 canal.withoutNetty = false
canal.serverMode = kafka
canal.file.data.dir = ${canal.conf.dir} canal.file.flush.period = 1000
canal.instance.memory.buffer.size = 16384
canal.instance.memory.buffer.memunit = 1024
canal.instance.memory.batch.mode = MEMSIZE canal.instance.memory.rawEntry = true
canal.instance.detecting.enable = false #canal.instance.detecting.sql = insert into retl.xdual values(1,now()) on duplicate key update x=now() canal.instance.detecting.sql = select 1 canal.instance.detecting.interval.time = 3 canal.instance.detecting.retry.threshold = 3 canal.instance.detecting.heartbeatHaEnable = false
canal.instance.transaction.size = 1024
canal.instance.fallbackIntervalInSeconds = 60
canal.instance.network.receiveBufferSize = 16384 canal.instance.network.sendBufferSize = 16384 canal.instance.network.soTimeout = 30
canal.instance.filter.druid.ddl = true canal.instance.filter.query.dcl = false canal.instance.filter.query.dml = false canal.instance.filter.query.ddl = false canal.instance.filter.table.error = false canal.instance.filter.rows = false canal.instance.filter.transaction.entry = false
canal.instance.binlog.format = ROW,STATEMENT,MIXED canal.instance.binlog.image = FULL,MINIMAL,NOBLOB
canal.instance.get.ddl.isolation = false
canal.instance.parser.parallel = true
#canal.instance.parser.parallelThreadSize = 16
canal.instance.parser.parallelBufferSize = 256
canal.instance.tsdb.enable = true canal.instance.tsdb.dir = ${canal.file.data.dir:../conf}/${canal.instance.destination:} canal.instance.tsdb.url = jdbc:h2:${canal.instance.tsdb.dir}/h2;CACHE_SIZE=1000;MODE=MYSQL; canal.instance.tsdb.dbUsername = canal canal.instance.tsdb.dbPassword = canal
canal.instance.tsdb.snapshot.interval = 24
canal.instance.tsdb.snapshot.expire = 360
################################################# ######### destinations ############# ################################################# canal.destinations =
canal.conf.dir = ../conf
canal.auto.scan = true canal.auto.scan.interval = 5
canal.instance.tsdb.spring.xml = classpath:spring/tsdb/h2-tsdb.xml #canal.instance.tsdb.spring.xml = classpath:spring/tsdb/mysql-tsdb.xml
canal.instance.global.mode = manager canal.instance.global.lazy = false canal.instance.global.manager.address = ${canal.admin.manager} #canal.instance.global.spring.xml = classpath:spring/memory-instance.xml canal.instance.global.spring.xml = classpath:spring/file-instance.xml #canal.instance.global.spring.xml = classpath:spring/default-instance.xml
################################################## ######### MQ Properties ############# ##################################################
canal.aliyun.accessKey = canal.aliyun.secretKey = canal.aliyun.uid=
canal.mq.flatMessage = true canal.mq.canalBatchSize = 50 canal.mq.canalGetTimeout = 100
canal.mq.accessChannel = local
canal.mq.database.hash = true canal.mq.send.thread.size = 30 canal.mq.build.thread.size = 8
################################################## ######### Kafka ############# ################################################## kafka.bootstrap.servers = broker:9092 kafka.acks = all kafka.compression.type = none kafka.batch.size = 16384 kafka.linger.ms = 1 kafka.max.request.size = 1048576 kafka.buffer.memory = 33554432 kafka.max.in.flight.requests.per.connection = 1 kafka.retries = 0
kafka.kerberos.enable = false kafka.kerberos.krb5.file = "../conf/kerberos/krb5.conf" kafka.kerberos.jaas.file = "../conf/kerberos/jaas.conf"
################################################## ######### RocketMQ ############# ################################################## rocketmq.producer.group = test rocketmq.enable.message.trace = false rocketmq.customized.trace.topic = rocketmq.namespace = rocketmq.namesrv.addr = 127.0.0.1:9876 rocketmq.retry.times.when.send.failed = 0 rocketmq.vip.channel.enabled = false
################################################## ######### RabbitMQ ############# ################################################## rabbitmq.host = rabbitmq.virtual.host = rabbitmq.exchange = rabbitmq.username = rabbitmq.password =
实例配置
#################################################
canal.instance.mysql.slaveId=1112
canal.instance.gtidon=false
canal.instance.master.address=127.0.0.1:3306 canal.instance.master.journal.name=mybinlog.000031 canal.instance.master.position=239588509 canal.instance.master.timestamp= canal.instance.master.gtid=
canal.instance.rds.accesskey= canal.instance.rds.secretkey= canal.instance.rds.instanceId=
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=
canal.instance.dbUsername=username canal.instance.dbPassword=123456 canal.instance.connectionCharset = UTF-8
canal.instance.enableDruid=false #canal.instance.pwdPublicKey=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALK4BUxdDltRRE5/zXpVEVPUgunvscYFtEip3pmLlhrWpacX7y7GCMo2/JM6LeHmiiNdH1FWgGCpUfircSwlWKUCAwEAAQ==
canal.instance.filter.regex=db.table
canal.instance.filter.black.regex=
#canal.instance.filter.field=test1.t_product:id/subject/keywords,test2.t_company:id/name/contact/ch
#canal.instance.filter.black.field=test1.t_product:subject/product_image,test2.t_company:id/name/contact/ch
canal.mq.topic=KAKA_TOPIC
#canal.mq.dynamicTopic=mytest1.user,mytest2\..,.\..* canal.mq.partition=0
#canal.mq.partitionsNum=3 #canal.mq.partitionHash=test.table:id^name,.\.. #################################################
日志
2021-03-30 15:30:40.340 [canal-instance-scan-0] INFO c.a.o.c.i.spring.support.PropertyPlaceholderConfigurer - Loading properties file from class path resource [canal.properties] 2021-03-30 15:30:40.340 [canal-instance-scan-0] INFO c.a.o.c.i.spring.support.PropertyPlaceholderConfigurer - Loading properties file from class path resource [DEMO/instance.properties] 2021-03-30 15:30:40.340 [canal-instance-scan-0] WARN c.a.o.c.i.spring.support.PropertyPlaceholderConfigurer - Could not load properties from class path resource [DEMO/instance.properties]: class path resource [DEMO/instance.properties] cannot be opened because it does not exist 2021-03-30 15:30:40.350 [canal-instance-scan-0] INFO c.a.o.c.i.spring.support.PropertyPlaceholderConfigurer - Loading properties file from class path resource [canal.properties] 2021-03-30 15:30:40.350 [canal-instance-scan-0] INFO c.a.o.c.i.spring.support.PropertyPlaceholderConfigurer - Loading properties file from class path resource [DEMO/instance.properties] 2021-03-30 15:30:40.350 [canal-instance-scan-0] WARN c.a.o.c.i.spring.support.PropertyPlaceholderConfigurer - Could not load properties from class path resource [DEMO/instance.properties]: class path resource [DEMO/instance.properties] cannot be opened because it does not exist 2021-03-30 15:30:40.364 [canal-instance-scan-0] INFO c.a.otter.canal.instance.spring.CanalInstanceWithSpring - start CannalInstance for 1-DEMO 2021-03-30 15:30:40.364 [canal-instance-scan-0] WARN c.a.o.canal.parse.inbound.mysql.dbsync.LogEventConvert - --> init table filter : ^db.table$ 2021-03-30 15:30:40.364 [canal-instance-scan-0] WARN c.a.o.canal.parse.inbound.mysql.dbsync.LogEventConvert - --> init table black filter : 2021-03-30 15:30:40.364 [canal-instance-scan-0] INFO c.a.otter.canal.instance.core.AbstractCanalInstance - start successful.... 2021-03-30 15:30:40.372 [destination = DEMO , address = /127.0.0.1:3306 , EventParser] WARN c.a.o.c.p.inbound.mysql.rds.RdsBinlogEventParserProxy - ---> begin to find start position, it will be long time for reset or first position 2021-03-30 15:30:40.950 [destination = DEMO , address = /127.0.0.1:3306 , EventParser] WARN c.a.o.c.p.inbound.mysql.rds.RdsBinlogEventParserProxy - prepare to find start position mybinlog.000031:239588444:1617084100000 2021-03-30 15:30:40.963 [destination = DEMO , address = /127.0.0.1:3306 , EventParser] WARN c.a.o.c.p.inbound.mysql.rds.RdsBinlogEventParserProxy - ---> find start position successfully, EntryPosition[included=false,journalName=mybinlog.000031,position=239588444,serverId=146,gtid=,timestamp=1617084100000] cost : 591ms , the next step is binlog dump
打开debug日志后,日志如下:
2021-03-30 16:39:47.563 [destination = DEMO , address = /DEMO , EventParser] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource 2021-03-30 16:39:47.566 [destination = DEMO , address = /DEMO , EventParser] DEBUG org.springframework.orm.ibatis.SqlMapClientTemplate - Opened SqlMapSession [com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl@41af2209] for iBATIS operation 2021-03-30 16:39:47.566 [destination = DEMO , address = /DEMO , EventParser] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource 2021-03-30 16:39:47.566 [destination = DEMO , address = /DEMO , EventParser] DEBUG java.sql.Connection - {conn-100003} Connection 2021-03-30 16:39:47.566 [destination = DEMO , address = /DEMO , EventParser] DEBUG org.springframework.orm.ibatis.SqlMapClientTemplate - Obtained JDBC Connection [conn1: url=jdbc:h2:../conf/DEMO/h2 user=CANAL] for iBATIS operation 2021-03-30 16:39:47.566 [destination = DEMO , address = /DEMO , EventParser] DEBUG java.sql.Connection - {conn-100003} Preparing Statement: select xxxx from table
2021-03-30 16:39:47.567 [destination = DEMO , address = /DEMO , EventParser] DEBUG java.sql.PreparedStatement - {pstm-100004} Executing Statement: select xxxx from table
2021-03-30 16:39:47.567 [destination = DEMO , address = /DEMO , EventParser] DEBUG java.sql.PreparedStatement - {pstm-100004} Parameters: [DEMO, -2, 1617092407000] 2021-03-30 16:39:47.567 [destination = DEMO , address = /DEMO , EventParser] DEBUG java.sql.PreparedStatement - {pstm-100004} Types: [java.lang.String, java.lang.Long, java.lang.Long] 2021-03-30 16:39:47.567 [destination = DEMO , address = /DEMO , EventParser] DEBUG java.sql.ResultSet - {rset-100005} ResultSet 2021-03-30 16:39:47.567 [destination = DEMO , address = /DEMO , EventParser] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource 2021-03-30 16:39:47.567 [destination = DEMO , address = /DEMO , EventParser] WARN c.a.o.c.p.inbound.mysql.rds.RdsBinlogEventParserProxy - ---> find start position successfully, EntryPosition[included=false,journalName=mybinlog.000031,position=269996422,serverId=146,gtid=,timestamp=1617092407000] cost : 4719ms , the next step is binlog dump 2021-03-30 16:39:47.568 [destination = DEMO , address = /DEMO , EventParser] INFO c.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - disConnect MysqlConnection to /DEMO... 2021-03-30 16:39:47.568 [destination = DEMO , address = /DEMO , EventParser] INFO c.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - connect MysqlConnection to /DEMO... 2021-03-30 16:39:47.569 [destination = DEMO , address = /DEMO , EventParser] INFO c.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - handshake initialization packet received, prepare the client authentication packet to send 2021-03-30 16:39:47.569 [destination = DEMO , address = /DEMO , EventParser] INFO c.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - client authentication packet is sent out. 2021-03-30 16:39:47.569 [destination = DEMO , address = /DEMO , EventParser] DEBUG c.a.otter.canal.parse.driver.mysql.MysqlUpdateExecutor - read update result... 2021-03-30 16:39:47.569 [destination = DEMO , address = /DEMO , EventParser] INFO c.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - disConnect MysqlConnection to /DEMO... 2021-03-30 16:39:47.569 [destination = DEMO , address = /DEMO , EventParser] INFO c.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - connect MysqlConnection to /DEMO... 2021-03-30 16:39:47.569 [destination = DEMO , address = /DEMO , EventParser] INFO c.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - handshake initialization packet received, prepare the client authentication packet to send 2021-03-30 16:39:47.569 [destination = DEMO , address = /DEMO , EventParser] INFO c.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - client authentication packet is sent out. 2021-03-30 16:39:47.578 [destination = DEMO , address = /127.0.0.1:3306 , EventParser] DEBUG c.a.otter.canal.parse.driver.mysql.MysqlUpdateExecutor - read update result... 2021-03-30 16:39:47.579 [destination = DEMO , address = /127.0.0.1:3306 , EventParser] DEBUG c.a.otter.canal.parse.driver.mysql.MysqlUpdateExecutor - read update result... 2021-03-30 16:39:47.579 [destination = DEMO , address = /127.0.0.1:3306 , EventParser] DEBUG c.a.otter.canal.parse.driver.mysql.MysqlUpdateExecutor - read update result... 2021-03-30 16:39:47.579 [destination = DEMO , address = /127.0.0.1:3306 , EventParser] DEBUG c.a.otter.canal.parse.driver.mysql.MysqlUpdateExecutor - read update result... 2021-03-30 16:39:47.579 [destination = DEMO , address = /127.0.0.1:3306 , EventParser] INFO c.a.otter.canal.parse.inbound.mysql.MysqlConnection - Register slave RegisterSlaveCommandPacket[reportHost=xxxx,reportPort=xxxx,reportUser=username,reportPasswd=admin,serverId=1113,command=21] 2021-03-30 16:39:47.580 [destination = DEMO , address = /127.0.0.1:3306 , EventParser] INFO c.a.otter.canal.parse.inbound.mysql.MysqlConnection - COM_BINLOG_DUMP with position:BinlogDumpCommandPacket[binlogPosition=269996422,slaveServerId=1113,binlogFileName=mybinlog.000031,command=18] 2021-03-30 16:39:47.581 [MultiStageCoprocessor-other-DEMO-0] INFO com.taobao.tddl.dbsync.binlog.LogEvent - common_header_len= 19, number_of_event_types= 38
可以看到已经取到了position,猜想可能是canal内部处理有问题,但是奇怪的是没有错误日志
原提问者GitHub用户JNSimba
经过测试,更换服务器是可以的,由于之前是直接再canal-admin页面上直接增加的,所以做了以下操作:
删除掉原server,直接将canal.deployer包拷贝到有问题的服务器,启动即可
原回答者GitHub用户agappleJNSimba
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。