Skip to content

Commit

Permalink
feat: add kafka script
Browse files Browse the repository at this point in the history
  • Loading branch information
Angular2Guy committed Aug 16, 2024
1 parent fc02e1a commit 80b44ca
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/src/main/resources/application-kafka.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
kafka.server.name=${KAFKA_SERVER_NAME:kafkaapp}
spring.kafka.bootstrap-servers=192.168.49.2:9092
kafka.server.name=${KAFKA_SERVER_NAME:localhost}
spring.kafka.bootstrap-servers=localhost:9092
spring.kafka.producer.compression-type=gzip
spring.kafka.producer.transaction-id-prefix: tx-
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
Expand Down
18 changes: 18 additions & 0 deletions runKafka.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh
# network config for KRaft
docker network create app-tier --driver bridge
# Kafka with KRaft
docker run -d \
-p 9092:9092 \
--name kafka-server \
--hostname kafka-server \
--network app-tier \
-e KAFKA_CFG_NODE_ID=0 \
-e KAFKA_CFG_PROCESS_ROLES=controller,broker \
-e KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 \
-e KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT \
-e KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka-server:9093 \
-e KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER \
bitnami/kafka:latest
# Start Kafka with KRaft
docker start kafka-server

0 comments on commit 80b44ca

Please sign in to comment.