Home>
Running services as well as kafka and zookeeper in docker containers.
I start the service akhq , which is like a panel for viewing topics and kafka messages.
The akhq service displays created topics and kafka messages. this service connects at kafka:9092
But another adapter service can't connect to kafka. Getting error: dial tcp :9092: connect: connection refused
Even though the adapter service also tries to connect to kafka:9092 , (tried both 127.0.0.1:9092 and localhost:9092) From the console of the adapter service, the address kafka:9092 is successfully pinged.
How can I fix it?
I'm attaching docker-compose.yaml
version: '3'
volumes:
zookeeper-data:
driver:local
zookeeper-log:
driver:local
kafka-data:
driver:local
services:
akhq:
image:tchiotludo/akhq
environment:
AKHQ_CONFIGURATION: |
akhq:
security:
default-group: reader
connections:
docker-kafka-server:
properties:
bootstrap.servers: "kafka:9092"
schema-registry:
url: "http://schema-registry:8085"
ports:
-8888:8080
links:
-kafka
-schema-registry
petkeeper:
image:confluentinc/cp-zookeeper
volumes:
-zookeeper-data:/var/lib/zookeeper/data:Z
-zookeeper-log:/var/lib/zookeeper/log:Z
environment:
ZOOKEEPER_CLIENT_PORT: '2181'
ZOOKEEPER_ADMIN_ENABLE_SERVER: 'false'
kafka:
image: confluentinc/cp-kafka
volumes:
-kafka-data:/var/lib/kafka/data:Z
environment:
KAFKA_BROKER_ID: '0'
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
KAFKA_NUM_PARTITIONS: '12'
KAFKA_COMPRESSION_TYPE: 'gzip'
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: '1'
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: '1'
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: '1'
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://kafka:9092'
KAFKA_CONFLUENT_SUPPORT_METRICS_ENABLE: 'false'
KAFKA_JMX_PORT: '9091'
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
KAFKA_AUTHORIZER_CLASS_NAME: 'kafka.security.authorizer.AclAuthorizer'
KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: 'true'
links:
-zookeeper
schema-registry:
image:confluentinc/cp-schema-registry
depends_on:
-kafka
environment:
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: 'PLAINTEXT://kafka:9092'
SCHEMA_REGISTRY_HOST_NAME: 'schema-registry'
SCHEMA_REGISTRY_LISTENERS: 'http://0.0.0.0:8085'
SCHEMA_REGISTRY_LOG4J_ROOT_LOGLEVEL: 'INFO'
adapter: #kafka adapter
build:
context: .
dockerfile: ./adapter.dockerfile
environment:
-GO_ENV=dev
-GOPATH=/go
container_name: kafka-adapter-app
depends_on:
-kafka
Related questions
- linux : Connecting via ssh when building using Jenkins
- [docker/remote/vs code] i want to change the starting point of code execution
- how to access the web server in the docker container from another pc in the lan
- nginx - rails puma does not start with docker-compose up
- problem that standard input is not possible when executing vue create command with docker-compose up
- docker cp command doesn't work
- ruby - i can't start the docker container with an app created with rails
- amazon ec2 - i want to publish an application developed with docker using the public ip of ec2, but [this site cannot be accesse
- ruby - "volumes" described in docker-composeyml