From 6b734d72df8dbf1c96e22d2d2000640abca684bb Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Sat, 1 Dec 2018 20:25:33 +0100 Subject: [PATCH 1/3] Mounts the parent of "datadir" AND "snapdir" Fixes #89, "logs" which are actually data would end up outside the mount. Zookeeper's startup logs are more clear than the property file entries: INFO Created server with tickTime 2000 minSessionTimeout 4000 maxSessionTimeout 40000 datadir /var/lib/zookeeper/log/version-2 snapdir /var/lib/zookeeper/data/version-2 --- zookeeper/50pzoo.yml | 2 +- zookeeper/51zoo.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zookeeper/50pzoo.yml b/zookeeper/50pzoo.yml index 68e1dbdd..23a01a42 100644 --- a/zookeeper/50pzoo.yml +++ b/zookeeper/50pzoo.yml @@ -65,7 +65,7 @@ spec: - name: config mountPath: /etc/kafka - name: data - mountPath: /var/lib/zookeeper/data + mountPath: /var/lib/zookeeper volumes: - name: configmap configMap: diff --git a/zookeeper/51zoo.yml b/zookeeper/51zoo.yml index 42c12128..42b68cf9 100644 --- a/zookeeper/51zoo.yml +++ b/zookeeper/51zoo.yml @@ -68,7 +68,7 @@ spec: - name: config mountPath: /etc/kafka - name: data - mountPath: /var/lib/zookeeper/data + mountPath: /var/lib/zookeeper volumes: - name: configmap configMap: From b936c849a1e64020068efd3a1297df3d262c2906 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Sat, 1 Dec 2018 21:31:47 +0100 Subject: [PATCH 2/3] The init container must have the same mount path --- zookeeper/50pzoo.yml | 2 +- zookeeper/51zoo.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zookeeper/50pzoo.yml b/zookeeper/50pzoo.yml index 23a01a42..4e897ec9 100644 --- a/zookeeper/50pzoo.yml +++ b/zookeeper/50pzoo.yml @@ -30,7 +30,7 @@ spec: - name: config mountPath: /etc/kafka - name: data - mountPath: /var/lib/zookeeper/data + mountPath: /var/lib/zookeeper containers: - name: zookeeper image: solsson/kafka:1.0.2@sha256:7fdb326994bcde133c777d888d06863b7c1a0e80f043582816715d76643ab789 diff --git a/zookeeper/51zoo.yml b/zookeeper/51zoo.yml index 42b68cf9..bc0bf12b 100644 --- a/zookeeper/51zoo.yml +++ b/zookeeper/51zoo.yml @@ -33,7 +33,7 @@ spec: - name: config mountPath: /etc/kafka - name: data - mountPath: /var/lib/zookeeper/data + mountPath: /var/lib/zookeeper containers: - name: zookeeper image: solsson/kafka:1.0.2@sha256:7fdb326994bcde133c777d888d06863b7c1a0e80f043582816715d76643ab789 From e55d81794a370a4d4acfe960cfe53f176507c8ff Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Sat, 1 Dec 2018 21:39:37 +0100 Subject: [PATCH 3/3] Fixes start from empty volume --- zookeeper/10zookeeper-config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/zookeeper/10zookeeper-config.yml b/zookeeper/10zookeeper-config.yml index 06943914..cf36942d 100644 --- a/zookeeper/10zookeeper-config.yml +++ b/zookeeper/10zookeeper-config.yml @@ -8,6 +8,7 @@ data: #!/bin/bash set -x + [ -d /var/lib/zookeeper/data ] || mkdir /var/lib/zookeeper/data [ -z "$ID_OFFSET" ] && ID_OFFSET=1 export ZOOKEEPER_SERVER_ID=$((${HOSTNAME##*-} + $ID_OFFSET)) echo "${ZOOKEEPER_SERVER_ID:-1}" | tee /var/lib/zookeeper/data/myid