question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make Zookeeper usage optional for KafkaContainer

See original GitHub issue

Hi

Starting since Kafka 2.8 Zookeeper is now an optional component because Kafka node can act as an active controller (new “process.roles” property). However I see from the code (configure method in the KafkaContainer class), that zookeeper.connect property is always added via environment variables:

if (externalZookeeperConnect != null) {
            withEnv("KAFKA_ZOOKEEPER_CONNECT", externalZookeeperConnect);
        } else {
            addExposedPort(ZOOKEEPER_PORT);
            withEnv("KAFKA_ZOOKEEPER_CONNECT", "localhost:" + ZOOKEEPER_PORT);
            command += "echo 'clientPort=" + ZOOKEEPER_PORT + "' > zookeeper.properties\n";
            command += "echo 'dataDir=/var/lib/zookeeper/data' >> zookeeper.properties\n";
            command += "echo 'dataLogDir=/var/lib/zookeeper/log' >> zookeeper.properties\n";
            command += "zookeeper-server-start zookeeper.properties &\n";
}

And by default Zookeeper is always started (externalZookeeperConnect is not initialized). Also there’s no API to distinguish between two modes (with and without Zookeeper) which I guess will be useful for the developers.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
danielpetismecommented, Nov 7, 2022

Hi,

A made a Kraft POC. https://github.com/testcontainers/testcontainers-java/pull/6129

Feedbacks are welcome!

2reactions
pkeuginecommented, Oct 21, 2022

thanks for the update @kiview, @ecsimsw and I read the comments as well. We’ll focus on this issue from now on.

Read more comments on GitHub >

github_iconTop Results From Across the Web

My kafka docker container cannot connect to my zookeeper ...
Solving the startup race issue ... Another option is to use --restart=on-failure flag with docker run. This will make sure the container is ......
Read more >
Exploring ZooKeeper-less Kafka - Gunnar Morling
A value can be obtained using the new bin/kafka-storage.sh script; going forward, we'll likely add an option to the Debezium Kafka container ......
Read more >
Running Apache Kafka on Containers - DEV Community ‍ ‍
To get started with Kafka on Docker, we are going to use ... Create a docker-compose.yaml file with one zookeeper and one Kafka...
Read more >
Configuring Strimzi
Optional configuration for Cruise Control, which is used to rebalance the Kafka cluster. Create or update the resource: kubectl apply -f < ...
Read more >
Apache Kafka Reference Guide - Quarkus
In this case the producer will use this method as generator to create an ... final KafkaContainer kafka = new KafkaContainer(); @Override public...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found