Skip to content

Commit

Permalink
fix: zookeeper backup size incorrect (#1279)
Browse files Browse the repository at this point in the history
(cherry picked from commit b6e5f04)
  • Loading branch information
kubeJocker committed Jan 3, 2025
1 parent c47ed7a commit 0c0399d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion addons/zookeeper/dataprotection/backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
set -e
set -o pipefail
export PATH="$PATH:$DP_DATASAFED_BIN_PATH"
export DATASAFED_BACKEND_BASE_PATH="$DP_BACKUP_BASE_PATH"

# if the script exits with a non-zero exit code, touch a file to indicate that the backup failed,
# the sync progress container will check this file and exit if it exists
function handle_exit() {
Expand All @@ -15,7 +17,7 @@ function handle_exit() {
trap handle_exit EXIT

java -cp /zoocreeper.jar com.boundary.zoocreeper.Backup \
-z ${DP_DB_HOST}:${MY_ZOOKEEPER_ZOOKEEPER_SERVICE_PORT_CLIENT} --compress | \
-z ${DP_DB_HOST}:${ZK_CLIENT_PORT} --compress | \
datasafed push -z zstd-fastest - "${DP_BACKUP_NAME}.backup.json"

TOTAL_SIZE=$(datasafed stat / | grep TotalSize | awk '{print $2}')
Expand Down
2 changes: 1 addition & 1 deletion addons/zookeeper/dataprotection/restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ datasafed pull -d zstd-fastest "${backupFileName}" ${TMP_DIR}/backup.json
touch ${ZOOKEEPER_DATA_DIR}/.restore_new_cluster

java -cp /zoocreeper.jar com.boundary.zoocreeper.Restore \
-z ${KB_CLUSTER_COMP_NAME}:${DP_DB_PORT} -f ${TMP_DIR}/backup.json \
-z ${DP_DB_HOST}:${ZK_CLIENT_PORT} -f ${TMP_DIR}/backup.json \
--overwrite-existing --compress --exclude /zookeeper/config*

rm -rf ${TMP_DIR}
Expand Down
3 changes: 3 additions & 0 deletions addons/zookeeper/templates/backupactionset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ metadata:
{{- include "zookeeper.labels" . | nindent 4 }}
spec:
backupType: Full
env:
- name: ZK_CLIENT_PORT
value: "2181"
backup:
backupData:
image: {{ .Values.images.zoocreeper.registry | default (.Values.images.registry | default "docker.io") }}/{{ .Values.images.zoocreeper.repository }}:{{ .Values.images.zoocreeper.tag }}
Expand Down

0 comments on commit 0c0399d

Please sign in to comment.