format kafka cluster in entrypoint
This commit is contained in:
parent
62f37353ba
commit
b155bb8bc1
2 changed files with 9 additions and 2 deletions
6
modules/infra-kafka-cluster/src/entrypoint.sh
Normal file
6
modules/infra-kafka-cluster/src/entrypoint.sh
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
./bin/kafka-storage.sh format \
|
||||||
|
--ignore-formatted \
|
||||||
|
--config ./server.properties \
|
||||||
|
--cluster-id "$(cat cluster_id)"
|
||||||
|
|
||||||
|
./bin/kafka-server-start.sh ./server.properties
|
||||||
|
|
@ -32,10 +32,11 @@ VOLUME /tmp/kraft-combined-logs
|
||||||
EXPOSE 9092 9093
|
EXPOSE 9092 9093
|
||||||
|
|
||||||
# Generate a cluster ID (must use this .sh to generate a UUID)
|
# Generate a cluster ID (must use this .sh to generate a UUID)
|
||||||
RUN echo "$(./bin/kafka-storage.sh random-uuid)" > cluster_id \
|
RUN ./bin/kafka-storage.sh random-uuid > cluster_id \
|
||||||
&& echo "Generated a Kafka Cluster ID: $(cat cluster_id)"
|
&& echo "Generated a Kafka Cluster ID: $(cat cluster_id)"
|
||||||
|
|
||||||
COPY ./kafka-server.properties ./server.properties
|
COPY ./kafka-server.properties ./server.properties
|
||||||
|
COPY ./entrypoint.sh ./entrypoint.sh
|
||||||
|
|
||||||
# Format storage directories
|
# Format storage directories
|
||||||
RUN ./bin/kafka-storage.sh format \
|
RUN ./bin/kafka-storage.sh format \
|
||||||
|
|
@ -44,7 +45,7 @@ RUN ./bin/kafka-storage.sh format \
|
||||||
--cluster-id "$(cat cluster_id)"
|
--cluster-id "$(cat cluster_id)"
|
||||||
|
|
||||||
# launch the broker in KRaft mode, which means that it runs without ZooKeeper
|
# launch the broker in KRaft mode, which means that it runs without ZooKeeper
|
||||||
ENTRYPOINT ["./bin/kafka-server-start.sh", "./server.properties"]
|
ENTRYPOINT ["./entrypoint.sh"]
|
||||||
|
|
||||||
|
|
||||||
### Kafka Connect ##
|
### Kafka Connect ##
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue