Skip to content

Commit

Permalink
Docker image for Apache Kafka 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
matnar committed May 28, 2018
0 parents commit 656c26d
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
*.tgz
22 changes: 22 additions & 0 deletions Dockerfile
@@ -0,0 +1,22 @@
# Create a simple Storm Client
#
# docker build -t matnar/kafka .

FROM anapsix/alpine-java:8
LABEL maintainer="matnar"

USER root

# COPY kafka_2.11-1.1.0.tgz /kafka_2.11-1.1.0.tgz
# RUN cd / && tar -zxf kafka_2.11-1.1.0.tgz && mv kafka_2.11-1.1.0 kafka && rm kafka_2.11-1.1.0.tgz
RUN cd / && wget http://apache.panu.it/kafka/1.1.0/kafka_2.11-1.1.0.tgz && tar -zxf kafka_2.11-1.1.0.tgz && mv kafka_2.11-1.1.0 kafka && rm kafka_2.11-1.1.0.tgz

COPY config/server.properties /kafka/config/server.properties
COPY config/update-config.sh /update-config.sh
# RUN sh /update-config.sh

EXPOSE 9092

ENTRYPOINT ["/bin/bash", "-c"]
CMD ["sh /update-config.sh && /kafka/bin/kafka-server-start.sh /kafka/config/ds.properties"]
# CMD ["/bin/bash"]
3 changes: 3 additions & 0 deletions build.sh
@@ -0,0 +1,3 @@
#!/bin/bash
docker build -t matnar/kafka:latest -t matnar/kafka:1.1.0 .

31 changes: 31 additions & 0 deletions config/server.properties
@@ -0,0 +1,31 @@
num.network.threads=3
num.io.threads=8
socket.send.buffer.bytes=102400
socket.receive.buffer.bytes=102400
socket.request.max.bytes=104857600


log.dirs=/tmp/kafka-logs
num.partitions=1
num.recovery.threads.per.data.dir=1
offsets.topic.replication.factor=1
transaction.state.log.replication.factor=1
transaction.state.log.min.isr=1

log.retention.hours=168
log.segment.bytes=1073741824
log.retention.check.interval.ms=300000

zookeeper.connect=zookeeper:2181
zookeeper.connection.timeout.ms=6000


############################# Group Coordinator Settings #############################

# The following configuration specifies the time, in milliseconds, that the GroupCoordinator will delay the initial consumer rebalance.
# The rebalance will be further delayed by the value of group.initial.rebalance.delay.ms as new members join the group, up to a maximum of max.poll.interval.ms.
# The default value for this is 3 seconds.
# We override this to 0 here as it makes for a better out-of-the-box experience for development and testing.
# However, in production environments the default value of 3 seconds is more suitable as this will help to avoid unnecessary, and potentially expensive, rebalances during application startup.
delete.topic.enable=true
group.initial.rebalance.delay.ms=0
11 changes: 11 additions & 0 deletions config/update-config.sh
@@ -0,0 +1,11 @@
#!/bin/bash
CONFIG_FILE=/kafka/config/server.properties
DS_FILE=/kafka/config/ds.properties

HOST_IP=$(awk 'END{print $1}' /etc/hosts)
CONFIG_LINE=listeners="PLAINTEXT://$HOST_IP:9092"
BROKER_ID_LINE="broker.id=$BROKER_ID"

cp $CONFIG_FILE $DS_FILE
echo $CONFIG_LINE >> $DS_FILE
echo $BROKER_ID_LINE >> $DS_FILE

0 comments on commit 656c26d

Please sign in to comment.