0

我正在尝试运行 jdbc sink connect with cratedb 作为 sink,如此所述。我想在 docker 中运行,所以我为连接器和我的 cratedb 创建了容器。但是在运行时,我在日志中不断收到以下错误。

连接器独立容器的 Docker 日志:

[2020-08-20 10:34:06,430] ERROR WorkerSinkTask{id=jdbc-sink-connector-0} Task threw an uncaught and unrecoverable exception (org.apache.kafka.connect.runtime.WorkerTask:179)
org.apache.kafka.connect.errors.ConnectException: Not a valid JDBC URL: "jdbc:postgresql://cratedb:4200/doc?user=crate",
    at io.confluent.connect.jdbc.dialect.DatabaseDialects.extractJdbcUrlInfo(DatabaseDialects.java:175)
    at io.confluent.connect.jdbc.dialect.DatabaseDialects.findBestFor(DatabaseDialects.java:119)
    at io.confluent.connect.jdbc.sink.JdbcSinkTask.initWriter(JdbcSinkTask.java:54)
    at io.confluent.connect.jdbc.sink.JdbcSinkTask.start(JdbcSinkTask.java:46)
    at org.apache.kafka.connect.runtime.WorkerSinkTask.initializeAndStart(WorkerSinkTask.java:300)
    at org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:189)
    at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:177)
    at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:227)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
[2020-08-20 10:34:06,433] ERROR WorkerSinkTask{id=jdbc-sink-connector-0} Task is being killed and will not recover until manually restarted (org.apache.kafka.connect.runtime.WorkerTask:180)

我的 Docker 文件:

version: '3.3'

services:

  zookeeper:
    container_name: zookeeper
    image: wurstmeister/zookeeper:latest
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
    ports:
      - '2181:2181'

  kafka:
    container_name: kafka
    image: wurstmeister/kafka:2.12-2.3.0
    env_file:
      - ".env"
    ports:
      - 9092:9092
    depends_on:
      - zookeeper
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

  connect-standalone:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: connect-standalone
    ports:
      - 8083:8083
    depends_on:
      - kafka
    volumes:
      - ./connect-input-file:/tmp

  cratedb:
    container_name: cratedb
    image: crate:latest
    ports:
      - "4200:4200"
    volumes:
      - /tmp/crate/01:/data
    command: ["crate",
              "-Cnode.name=cratedb",
              "-Cnode.data=true"]
    environment:
      - CRATE_HEAP_SIZE=2g

我的 jdbc-sink-connector.properties

name=jdbc-sink-connector
connector.class=io.confluent.connect.jdbc.JdbcSinkConnector
tasks.max=1
topics=metrics
connection.url="jdbc:postgresql://cratedb:4200/doc?user=crate",
auto.create=true

我不太确定我错过了什么。

4

1 回答 1

0

它可能是由4200作为 HTTP 的默认端口的端口引起的。PostgreSQL 的默认端口是5432

您还可以在此处查看我们用于测试的 docker-compose 文件

于 2020-09-01T13:27:34.073 回答