Skip to content

Commit

Permalink
Uses the kafka image as Zookeeper service...
Browse files Browse the repository at this point in the history
to reduce image download times and use a supported version.
Initial config is from https://zookeeper.apache.org/doc/r3.4.10/zookeeperAdmin.html#sc_zkMulitServerSetup
and the fixes for stateful set are from https://github.com/solsson/zookeeper-docker
  • Loading branch information
solsson committed Jun 25, 2017
1 parent 4297271 commit ccb9e5d
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 10 deletions.
24 changes: 24 additions & 0 deletions zookeeper/10zookeeper-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
kind: ConfigMap
metadata:
name: zookeeper-config
namespace: kafka
apiVersion: v1
data:
zookeeper.properties: |-
tickTime=2000
dataDir=/var/lib/zookeeper/data
dataLogDir=/var/lib/zookeeper/log
clientPort=2181
initLimit=5
syncLimit=2
server.1=zoo-0.zoo:2888:3888:participant
server.2=zoo-1.zoo:2888:3888:participant
server.3=zoo-2.zoo:2888:3888:participant
server.4=zoo-3.zoo:2888:3888:participant
server.5=zoo-4.zoo:2888:3888:participant
log4j.properties: |-
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c)%n
27 changes: 17 additions & 10 deletions zookeeper/50zoo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@ spec:
terminationGracePeriodSeconds: 10
containers:
- name: zookeeper
image: solsson/zookeeper-statefulset:3.4.10@sha256:0ad93c98d5165b4eb747c4b0dd04a7a448a5c4b4cbcaa4bffc15018b76b81bb5
env:
- name: ZOO_SERVERS
value: server.1=zoo-0.zoo:2888:3888:participant server.2=zoo-1.zoo:2888:3888:participant server.3=zoo-2.zoo:2888:3888:participant server.4=zoo-3.zoo:2888:3888:participant server.5=zoo-4.zoo:2888:3888:participant
image: solsson/kafka:0.11.0.0-rc2@sha256:c1316e0131f4ec83bc645ca2141e4fda94e0d28f4fb5f836e15e37a5e054bdf1
command:
- sh
- -c
- >
set -e;
export ZOOKEEPER_SERVER_ID=$((${HOSTNAME##*-} + 1));
echo "${ZOOKEEPER_SERVER_ID:-1}" | tee /var/lib/zookeeper/data/myid;
sed -i "s/server\.$ZOOKEEPER_SERVER_ID\=[a-z0-9.-]*/server.$ZOOKEEPER_SERVER_ID=0.0.0.0/" config/zookeeper.properties;
cat config/zookeeper.properties;
./bin/zookeeper-server-start.sh config/zookeeper.properties
ports:
- containerPort: 2181
name: client
Expand All @@ -26,13 +33,13 @@ spec:
- containerPort: 3888
name: leader-election
volumeMounts:
- name: config
mountPath: /usr/local/kafka/config
- name: datadir
mountPath: /data
# There's defaults in this folder, such as logging config
#- name: conf
# mountPath: /conf
mountPath: /var/lib/zookeeper/data
volumes:
#- name: conf
# emptyDir: {}
- name: config
configMap:
name: zookeeper-config
- name: datadir
emptyDir: {}

0 comments on commit ccb9e5d

Please sign in to comment.