为Interbase创建JDBC连接器源

时间:2018-12-06 02:35:54

标签: curl jdbc apache-kafka apache-kafka-connect interbase

我正在尝试使用curl命令为kafka创建JDBC连接器。请帮助我纠正此命令。

curl -X POST -H "Content-Type: application/json"  --data "{ \"name\": 
\"ib_connector\",\"config\": { \"connector.class\": \"io.confluent.connect.jdbc.JdbcSourceConnector\", \"tasks.max\": 1,
\"connection.url\": \"jdbc:interbase://ip:3050;Database=TEST2;user=SYSDBA;password=masterkey\",\"mode\": \"timestamp+incrementing\", \"incrementing.column.name\": \"id\",\"timestamp.column.name\": \"modified\", \"topic.prefix\": \"test-interbase-\", \"poll.interval.ms\": 1000 } }"
http://localhost:8083/connectors

在命令提示符下显示以下错误

curl: (52) Empty reply from server  

我正在这样运行docker-compose.yml文件

version: '3.7'
services:
  zookeeper:
    image: confluentinc/cp-zookeeper:${CONFLUENT_VERSION}
    networks:
      - kafka
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
      ZOOKEEPER_TICK_TIME: 2000
      KAFKA_JMX_PORT: 39999

  kafka:
    image: confluentinc/cp-kafka:${CONFLUENT_VERSION}
    depends_on:
      - zookeeper
    ports:
      - 9092:9092
    networks:
      - kafka
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
      KAFKA_JMX_PORT: 49999

  schema-registry:
    image: confluentinc/cp-schema-registry:${CONFLUENT_VERSION}
    depends_on:
      - zookeeper
      - kafka
    networks:
      - kafka
    environment:
      SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: zookeeper:2181
      SCHEMA_REGISTRY_HOST_NAME: schema-registry

  connect:
    image: confluentinc/cp-kafka-connect:${CONFLUENT_VERSION}
    depends_on:
      - zookeeper
      - kafka
      - schema-registry
    ports:
      - 8083:8083
    networks:
      - kafka
    volumes:
      - ${KAFKA_CONNECT_JARS_PATH}:/etc/kafka-connect/jars
    environment:
      CONNECT_BOOTSTRAP_SERVERS: 'kafka:9092'
      CONNECT_REST_ADVERTISED_HOST_NAME: connect
      CONNECT_REST_PORT: 8083
      CONNECT_GROUP_ID: compose-connect-group
      CONNECT_CONFIG_STORAGE_TOPIC: docker-connect-configs
      CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR: 1
      CONNECT_OFFSET_FLUSH_INTERVAL_MS: 10000
      CONNECT_OFFSET_STORAGE_TOPIC: docker-connect-offsets
      CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR: 1
      CONNECT_STATUS_STORAGE_TOPIC: docker-connect-status
      CONNECT_STATUS_STORAGE_REPLICATION_FACTOR: 1
      CONNECT_KEY_CONVERTER: io.confluent.connect.avro.AvroConverter
      CONNECT_KEY_CONVERTER_SCHEMA_REGISTRY_URL: 'http://schema-registry:8081'
      CONNECT_VALUE_CONVERTER: io.confluent.connect.avro.AvroConverter
      CONNECT_VALUE_CONVERTER_SCHEMA_REGISTRY_URL: 'http://schema-registry:8081'
      CONNECT_INTERNAL_KEY_CONVERTER: org.apache.kafka.connect.json.JsonConverter
      CONNECT_INTERNAL_VALUE_CONVERTER: org.apache.kafka.connect.json.JsonConverter
      CONNECT_ZOOKEEPER_CONNECT: 'zookeeper:2181'
      CONNECT_PLUGIN_PATH: '/usr/share/java,/etc/kafka-connect/jars'

networks:
  kafka:
    driver: bridge

kafka正在运行,并且我已经使用命令docker-compose up -d来运行它,并且得到了成功消息。我在Windows上运行它。下面是容器的状态。

当我运行docker-compose up -d时,它显示为Kafka_manager正在启动。但是,一旦我检查状态,它就会显示出口255。这是否会影响将配置保存到端口8083。

enter image description here

可能是什么原因。 Kafka-connect处于活动状态并且正在端口8083中运行。请帮助

1 个答案:

答案 0 :(得分:-1)

kafka在9092上运行,而connect worker在8083上运行。

您要在8083上发布配置,因此请确保您的工作人员已启动并正在运行。