this is kafka docker-compose:
version: '2'
services:
zookeeper:
image: "confluentinc/cp-zookeeper:5.2.1"
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
kafka0:
image: "confluentinc/cp-enterprise-kafka:5.2.1"
ports:
- '9092:9092'
- '27017:27017'
depends_on:
- zookeeper
environment:
KAFKA_BROKER_ID: 0
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_LISTENERS: LISTENER_BOB://kafka0:29092,LISTENER_FRED://kafka0:9092,LISTENER_ALICE://kafka0:27017
KAFKA_ADVERTISED_LISTENERS: LISTENER_BOB://kafka0:29092,LISTENER_FRED://localhost:9092,LISTENER_ALICE://10.255.250.160:27017
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_BOB:PLAINTEXT,LISTENER_FRED:PLAINTEXT,LISTENER_ALICE:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_BOB
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 100
kafkacat:
image: confluentinc/cp-kafkacat
command: sleep infinity
here is the bootstrap-server configuration of the springboot application:
spring:
kafka:
bootstrap-servers: 'http://10.255.250.160:27017'
this is the error when i deploy the springboot application:
emap-sync | 2022-07-04 10:10:38.842 INFO 1 --- [ntainer#1-0-C-1] org.apache.kafka.clients.NetworkClient : [Consumer clientId=consumer-78b615fa-7c98-4ea9-b73e-6472e88ebe0a-3, groupId=78b615fa-7c98-4ea9-b73e-6472e88ebe0a] Node -1 disconnected.
emap-sync | 2022-07-04 10:10:38.842 WARN 1 --- [ntainer#1-0-C-1] org.apache.kafka.clients.NetworkClient : [Consumer clientId=consumer-78b615fa-7c98-4ea9-b73e-6472e88ebe0a-3, groupId=78b615fa-7c98-4ea9-b73e-6472e88ebe0a] Connection to node -1 (/10.255.250.160:27017) could not be established. Broker may not be available.
emap-sync | 2022-07-04 10:10:38.842 WARN 1 --- [ntainer#1-0-C-1] org.apache.kafka.clients.NetworkClient : [Consumer clientId=consumer-78b615fa-7c98-4ea9-b73e-6472e88ebe0a-3, groupId=78b615fa-7c98-4ea9-b73e-6472e88ebe0a] Bootstrap broker 10.255.250.160:27017 (id: -1 rack: null) disconnected