1

I am trying to create a JDBC connector for kafka using curl command. Please help me to correct this command.

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

Shows the following error in command prompt

curl: (52) Empty reply from server  

I am running through docker-compose.yml file as this

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 is running and i have used the command docker-compose up -d to run it and i got success message. I am running it on windows.Below is the status of containers.

When i run docker-compose up -d it is shown as Kafka_manager is starting. But as soon as i check the status it shows exit 255. Does it affect saving configuration to port 8083.

enter image description here

What could be the reason. Kafka-connect is active and running in port 8083. Please help

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Bommu
  • 229
  • 1
  • 4
  • 14
  • What version of Kafka are you using? How are you running Kafka Connect? Are you using Confluent CLI, or another method? – Robin Moffatt Dec 06 '18 at 09:53
  • I am using docker to run kafka. – Bommu Dec 06 '18 at 09:59
  • 1
    Can you update your question to include how you're running it? Are you using Docker Compose? Is Kafka Connect definitely running? Have you expose the port to your host machine? – Robin Moffatt Dec 06 '18 at 11:56
  • Here's a simple example of a Docker Compose for running Kafka + Kafka Connect https://github.com/confluentinc/demo-scene/blob/master/cos/docker-compose.yml – Robin Moffatt Dec 06 '18 at 11:56
  • I have edited the question. And i have used almost same docker compose file as in this link. The docker compose is running and the port is in same machine. – Bommu Dec 06 '18 at 13:21
  • 1
    You say "Kafka is active and running in port 8083", but it's **Kafka Connect** that should be on port 8083. Can you update your question with the output of `docker-compose ps` ? – Robin Moffatt Dec 06 '18 at 13:43
  • You aren't required to use curl, by the way. Postman could be a better option, but it still won't return a result if things aren't actually running – OneCricketeer Dec 06 '18 at 15:26
  • @RobinMoffatt Kafka Connect is in port 8083 not kafka . Thank you – Bommu Dec 07 '18 at 02:13
  • 1
    Please don't post screenshots for console output. Text is much easier to read :) – Robin Moffatt Dec 07 '18 at 09:40
  • I'm ignoring Kafka Manager etc because that's not going to affect Kafka Connect. Let's focus on Kafka Connect. What's the output of `curl -s http://localhost:8083` ? And what's the output of `docker-compose logs kafka-connect | grep "Kafka Connect started"` ? If you view the full contents of the Connect worker (`docker-compose logs kafka-connect`) are there any errors? – Robin Moffatt Dec 07 '18 at 09:48
  • @robin The command `curl -s http://localhost:8083` didn't show anything as output. The command `compose logs kafka-connect` showed UnknownHostException for Zookeeper. Now it is alright and only have warnings. And i tried to run curl turning off firewall. That also didn't work. – Bommu Dec 07 '18 at 10:27
  • @RobinMoffatt Sorry for posting screenshots :) – Bommu Dec 07 '18 at 10:29
  • 1
    Can you post your _actual_ Docker Compose file that you're using? Either update your question, or put it on gist.github.com or similar – Robin Moffatt Dec 07 '18 at 11:40
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/184876/discussion-between-bommu-and-robin-moffatt). – Bommu Dec 07 '18 at 13:05
  • I have posted the docker-compose file in github. Herw is the link. https://gist.github.com/Bommu03/76fd0b30ba1438c9a8fdd7d555c3fa5d. Thank you. – Bommu Dec 07 '18 at 23:50

1 Answers1

-1

kafka runs on 9092 while connect worker on 8083.

you are posting configuration on 8083 so make sure you have worker up and running.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245