开发者社区> 问答> 正文

使用docker-compose 管理cannal-server canal-admin canal

使用docker-compose 管理cannal-server canal-admin canal-adapter 由于机器的问题在启动过程中会爆错

2019-10-08 17:56:22.657 [main] INFO com.alibaba.otter.canal.deployer.CanalLauncher - ## set default uncaught exception handler 2019-10-08 17:56:22.884 [main] INFO com.alibaba.otter.canal.deployer.CanalLauncher - ## load canal configurations 2019-10-08 17:56:24.543 [main] ERROR com.alibaba.otter.canal.deployer.CanalLauncher - ## Something goes wrong when starting up the canal Server: com.alibaba.otter.canal.common.CanalException: load manager config failed. Caused by: java.lang.RuntimeException: requestGet remote error, request : http://canal-admin:8089/api/v1/config/server_polling?ip=172.25.0.6&port=11110&md5=&register=1&cluster=
at com.alibaba.otter.canal.instance.manager.plain.HttpHelper.get(HttpHelper.java:109) ~[canal.instance.manager-1.1.4.jar:na]

该问题是因为 canal-admin未完全启动导致的

重启 cannal-server后该问题解决

docker-compose restart cannal-server

cannal-server日志(canal.log)中出现错误日志

2019-10-08 18:05:15.679 [canal-instance-scan-0] ERROR c.a.o.c.deployer.monitor.ManagerInstanceConfigMonitor - scan failed java.lang.NullPointerException: null at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:210) ~[guava-18.0.jar:na] at com.google.common.collect.Lists.newArrayList(Lists.java:110) ~[guava-18.0.jar:na] at com.alibaba.otter.canal.deployer.monitor.ManagerInstanceConfigMonitor.scan(ManagerInstanceConfigMonitor.java:85) ~[canal.deployer-1.1.4.jar:na] at com.alibaba.otter.canal.deployer.monitor.ManagerInstanceConfigMonitor.access$000(ManagerInstanceConfigMonitor.java:29) ~[canal.deployer-1.1.4.jar:na] at com.alibaba.otter.canal.deployer.monitor.ManagerInstanceConfigMonitor$2.run(ManagerInstanceConfigMonitor.java:53) ~[canal.deployer-1.1.4.jar:na] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_181] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_181] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_181] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_181] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_181] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_181] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_181]

然后请求了下第一次错误的curl

curl -X GET http://127.0.0.1:8089/api/v1/config/server_polling?ip=172.23.0.6&port=11110&md5=&register=1

返回结果

{"code":50000,"message":"Missing request header 'user' for method parameter of type String","data":null}

看返回结果可能是解析返回结果中的data出现问题。但查看配置canal.user 有配置,以下是我的配置

canal-server canal.properties

################################################# ######### common argument ############# #################################################

tcp bind ip

canal.ip = canal-server

register ip to zookeeper

canal.register.ip = canal.port = 11111 canal.metrics.pull.port = 11112

canal instance user/passwd

canal.user = canal

canal.passwd = E3619321C1A937C46A0D8BD1DAC39F93B27D4458

canal.user = admin canal.passwd = 6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9

canal admin config

canal.admin.manager = canal-admin:8089 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.zkServers =

flush data to zk

canal.zookeeper.flush.period = 1000 canal.withoutNetty = false

tcp, kafka, RocketMQ

canal.serverMode = tcp

flush meta cursor/parse position to file

canal.file.data.dir = ${canal.conf.dir} canal.file.flush.period = 1000

memory store RingBuffer size, should be Math.pow(2,n)

canal.instance.memory.buffer.size = 16384

memory store RingBuffer used memory unit size , default 1kb

canal.instance.memory.buffer.memunit = 1024

meory store gets mode used MEMSIZE or ITEMSIZE

canal.instance.memory.batch.mode = MEMSIZE canal.instance.memory.rawEntry = true

detecing config

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

support maximum transaction size, more than the size of the transaction will be cut into multiple transactions delivery

canal.instance.transaction.size = 1024

mysql fallback connected to new master should fallback times

canal.instance.fallbackIntervalInSeconds = 60

network config

canal.instance.network.receiveBufferSize = 16384 canal.instance.network.sendBufferSize = 16384 canal.instance.network.soTimeout = 30

binlog filter config

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

binlog format/image check

canal.instance.binlog.format = ROW,STATEMENT,MIXED canal.instance.binlog.image = FULL,MINIMAL,NOBLOB

binlog ddl isolation

canal.instance.get.ddl.isolation = false

parallel parser config

canal.instance.parser.parallel = true

concurrent thread number, default 60% available processors, suggest not to exceed Runtime.getRuntime().availableProcessors()

#canal.instance.parser.parallelThreadSize = 16

disruptor ringbuffer size, must be power of 2

canal.instance.parser.parallelBufferSize = 256

table meta tsdb info

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

dump snapshot interval, default 24 hour

canal.instance.tsdb.snapshot.interval = 24

purge snapshot expire , default 360 hour(15 days)

canal.instance.tsdb.snapshot.expire = 360

aliyun ak/sk , support rds/mq

canal.aliyun.accessKey = canal.aliyun.secretKey =

################################################# ######### destinations ############# ################################################# canal.destinations = example

conf root dir

canal.conf.dir = ../conf

auto scan instance dir add/remove and start/stop instance

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 = spring 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 ############# ################################################## canal.mq.servers = 127.0.0.1:6667 canal.mq.retries = 0 canal.mq.batchSize = 16384 canal.mq.maxRequestSize = 1048576 canal.mq.lingerMs = 100 canal.mq.bufferMemory = 33554432 canal.mq.canalBatchSize = 50 canal.mq.canalGetTimeout = 100 canal.mq.flatMessage = true canal.mq.compressionType = none canal.mq.acks = all #canal.mq.properties. = canal.mq.producerGroup = test

Set this value to "cloud", if you want open message trace feature in aliyun.

canal.mq.accessChannel = local

aliyun mq namespace

#canal.mq.namespace =

################################################## ######### Kafka Kerberos Info ############# ##################################################

canal.mq.kafka.kerberos.enable = false

canal.mq.kafka.kerberos.krb5FilePath = "../conf/kerberos/krb5.conf"

canal.mq.kafka.kerberos.jaasFilePath = "../conf/kerberos/jaas.conf"

有老铁有遇到这个问题的吗?

原提问者GitHub用户xiao-xiao-xiao

展开
收起
Java工程师 2023-05-03 16:17:34 333 0
1 条回答
写回答
取消 提交回答
  • 你手工模拟的curl请求,缺少user/passwd信息,这个是header提交

    你可以本地运行PlainCanalConfigClientIntegration,验证一下具体报错的原因,可能是账号密码不匹配导致

    原回答者GitHub用户agapple

    2023-05-04 17:59:10
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
应用 Docker 进行持续交付:用技术改变交付路程 立即下载
从Docker到容器服务 立即下载
Docker@Alibaba——超大规模Docker化的实战经验 立即下载