Skip to content

Commit 6cea5f7

Browse files
authored
[build] Optimize Kafka container to use KRaft instead of relying on ZooKeeper (#5167)
1 parent 75e9da4 commit 6cea5f7

File tree

2 files changed

+15
-25
lines changed

2 files changed

+15
-25
lines changed

paimon-e2e-tests/src/test/java/org/apache/paimon/tests/E2eTestBase.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,9 @@ public void before() throws Exception {
106106
.withStartupTimeout(Duration.ofMinutes(3))
107107
.withLocalCompose(true);
108108
if (withKafka) {
109-
List<String> kafkaServices = Arrays.asList("zookeeper", "kafka");
110-
services.addAll(kafkaServices);
111-
for (String s : kafkaServices) {
112-
environment.withLogConsumer(s + "-1", new Slf4jLogConsumer(LOG));
113-
}
114-
environment.waitingFor(
115-
"kafka-1", buildWaitStrategy(".*Recorded new ZK controller.*", 2));
109+
services.add("kafka");
110+
environment.withLogConsumer("kafka-1", new Slf4jLogConsumer(LOG));
111+
environment.waitingFor("kafka-1", buildWaitStrategy(".*Kafka Server started.*", 1));
116112
}
117113
if (withHive) {
118114
List<String> hiveServices =

paimon-e2e-tests/src/test/resources-filtered/docker-compose.yaml

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,39 +76,33 @@ services:
7676
# Kafka services
7777
# ----------------------------------------
7878

79-
zookeeper:
80-
image: confluentinc/cp-zookeeper:7.8.0
81-
networks:
82-
testnetwork:
83-
aliases:
84-
- zookeeper
85-
environment:
86-
ZOOKEEPER_CLIENT_PORT: 2181
87-
ZOOKEEPER_TICK_TIME: 2000
88-
expose:
89-
- "2181"
90-
9179
kafka:
9280
image: confluentinc/cp-kafka:7.8.0
9381
networks:
9482
testnetwork:
9583
aliases:
9684
- kafka
9785
environment:
98-
KAFKA_BROKER_ID: 1
99-
KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
100-
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_INTERNAL:PLAINTEXT
101-
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_INTERNAL://kafka:29092
86+
KAFKA_NODE_ID: 1
87+
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: 'CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT'
88+
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://kafka:29092,PLAINTEXT_HOST://kafka:9092'
10289
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
90+
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
10391
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
10492
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
93+
KAFKA_JMX_PORT: 9101
94+
KAFKA_JMX_HOSTNAME: localhost
95+
KAFKA_PROCESS_ROLES: 'broker,controller'
96+
KAFKA_CONTROLLER_QUORUM_VOTERS: '1@kafka:29093'
97+
KAFKA_LISTENERS: 'PLAINTEXT://kafka:29092,CONTROLLER://kafka:29093,PLAINTEXT_HOST://0.0.0.0:9092'
98+
KAFKA_INTER_BROKER_LISTENER_NAME: 'PLAINTEXT'
99+
KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER'
105100
KAFKA_TRANSACTION_MAX_TIMEOUT_MS: 7200000
106101
# Disable log deletion to prevent records from being deleted during test run
107102
KAFKA_LOG_RETENTION_MS: -1
103+
CLUSTER_ID: Pkv3OFSRNQcNATKEMDV9Ql
108104
expose:
109105
- "9092"
110-
depends_on:
111-
- zookeeper
112106

113107
# ----------------------------------------
114108
# Hive services, copied and modified from https://github.com/big-data-europe/docker-hive

0 commit comments

Comments
 (0)