Created
May 25, 2018 12:31
-
-
Save chernyshev-alex/239357a89bfa6afda46ba0251c03af05 to your computer and use it in GitHub Desktop.
kafka docker-compose with registry and connect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
zookeeper: | |
ports: | |
- "2181:2181" | |
environment: | |
ZOOKEEPER_CLIENT_PORT: 2181 | |
ZOOKEEPER_TICK_TIME: 2000 | |
image: confluentinc/cp-zookeeper:4.1.0 | |
kafka: | |
ports: | |
- '9092:9092' | |
environment: | |
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 | |
#KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092 | |
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://kafka:9092' | |
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true' | |
KAFKA_CREATE_TOPICS: "test:1:1" | |
image: confluentinc/cp-kafka:4.1.0 | |
links: | |
- zookeeper | |
schemaregistry: | |
ports: | |
- 8081:8081 | |
environment: | |
SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: zookeeper:2181 | |
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: PLAINTEXT://kafka:9092 | |
SCHEMA_REGISTRY_HOST_NAME: schemaregistry | |
SCHEMA_REGISTRY_LISTENERS: http://schemaregistry:8081 | |
image: confluentinc/cp-schema-registry:4.1.0 | |
links: | |
- kafka | |
- zookeeper | |
connect: | |
ports: | |
- "8083:8083" | |
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_OFFSET_STORAGE_TOPIC: docker-connect-offsets | |
#CONNECT_STATUS_STORAGE_TOPIC: docker-connect-status | |
#CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR: 1 | |
#CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR: 1 | |
#CONNECT_STATUS_STORAGE_REPLICATION_FACTOR: 1 | |
CONNECT_KEY_CONVERTER: io.confluent.connect.avro.AvroConverter | |
CONNECT_VALUE_CONVERTER: io.confluent.connect.avro.AvroConverter | |
CONNECT_KEY_CONVERTER_SCHEMA_REGISTRY_URL: http://schemaregistry:8081 | |
CONNECT_VALUE_CONVERTER_SCHEMA_REGISTRY_URL: http://schemaregistry: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_LOG4J_ROOT_LOGLEVEL: INFO | |
image: confluentinc/cp-kafka-connect:4.1.0 | |
links: | |
- kafka | |
- zookeeper | |
- schemaregistry | |
depends_on: | |
- zookeeper | |
- kafka | |
- schemaregistry |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
start configuration
docker-compose -f docker-compose-connect.yml up -d
create topic test
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
add a new entry to /etc/hosts
127.0.0.1 kafka
send test data
bin/kafka-console-producer.sh --topic test --broker-list localhost:9092
111111
222222
read test data
bin/kafka-simple-consumer-shell.sh --broker-list localhost:9092 --topic test
111111
222222
stop all kafka services
docker-compose -f docker-compose-connect.yml down