cp-docker-images icon indicating copy to clipboard operation
cp-docker-images copied to clipboard

Connecting REST proxy to localhost kafka

Open LukasM7 opened this issue 6 years ago • 1 comments

I am trying to connect REST proxy running in docker to my existing setup running zk and kafka on local machine using windows.

I started with modifying the all-in-one platform docker compose file to only include schema registry and rest proxy.

` --- version: '2' services: schema-registry: image: confluentinc/cp-schema-registry:5.1.0 hostname: schema-registry container_name: schema-registry ports: - "8081:8081" environment: SCHEMA_REGISTRY_HOST_NAME: schema-registry SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: 'host.docker.internal:2181'

rest-proxy: image: confluentinc/cp-kafka-rest:5.1.0 depends_on: - schema-registry ports: - 8082:8082 hostname: rest-proxy container_name: rest-proxy environment: KAFKA_REST_HOST_NAME: rest-proxy KAFKA_REST_BOOTSTRAP_SERVERS: 'host.docker.internal:9092' KAFKA_REST_LISTENERS: 'host.docker.internal:8082' KAFKA_REST_SCHEMA_REGISTRY_URL: 'host.docker.internal:8081'`

with this file schema registry runs as expected but for rest proxy I get a few warning messages rest-proxy | [2019-02-12 10:22:57,503] WARN Property bootstrap.servers is not valid (kafka.utils.VerifiableProperties) rest-proxy | [2019-02-12 10:22:57,505] WARN Property host.name is not valid (kafka.utils.VerifiableProperties) rest-proxy | [2019-02-12 10:22:57,506] WARN Property listeners is not valid (kafka.utils.VerifiableProperties) rest-proxy | [2019-02-12 10:22:57,508] WARN Property schema.registry.url is not valid (kafka.utils.VerifiableProperties) ... rest-proxy exited with code 1

How do I configure REST proxy to connect to schema registry, kafka and zk?

LukasM7 avatar Feb 12 '19 10:02 LukasM7

The following should work, assuming you set up the kafka properties advertised.listeners to include PLAINTEXT://host.docker.internal:9092

environment:
    KAFKA_REST_HOST_NAME: rest-proxy
    KAFKA_REST_BOOTSTRAP_SERVERS: 'host.docker.internal:9092'
    KAFKA_REST_LISTENERS: '0.0.0.0:8082'
    KAFKA_REST_SCHEMA_REGISTRY_URL: 'schema-registry:8081'`

OneCricketeer avatar Sep 25 '19 12:09 OneCricketeer