Discussion about this post

User's avatar
Dinesh Kumar Bhongiri's avatar

I had to make 2 changes:

1. Update the healthcheck endpoints for all 3 brokers to "kafka-3:19092" instead of "localhost:19092". Reason: Inside a Docker container, localhost resolves to 127.0.0.1, which doesn't route to the broker's actual listener port. By using the container's hostname on the Docker network (kafka-1, kafka-2, kafka-3), the healthcheck can properly connect and verify the broker is ready. This fixed the "unhealthy" status that was blocking startup.

2. Added & wait in verify-cluster.sh. Reason: The pipe to head -1 was causing the loop to hang after the first broker. By backgrounding the command and waiting for completion, each broker's check completes properly before moving to the next one. This fixed the script hanging mid-execution.

After making above changes, I was able to successfully run the Docker cluster along with 3 brokers on my machine.

1 more comment...

No posts

Ready for more?