Skip to content

Commit

Permalink
fix: fix the restore script for qdrant (#5474)
Browse files Browse the repository at this point in the history
(cherry picked from commit a3b0747)
  • Loading branch information
zjx20 committed Oct 17, 2023
1 parent fb929e2 commit f99ba38
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions deploy/mongodb/templates/actionset-datafile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
prepareData:
image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}
command:
- sh
- bash
- -c
- |
{{- .Files.Get "dataprotection/datafile-restore.sh" | nindent 8 }}
Expand All @@ -52,7 +52,7 @@ spec:
prepareData:
image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}
command:
- sh
- bash
- -c
- "touch ${DATA_DIR}/mongodb.backup; sync"
postReady: []
2 changes: 1 addition & 1 deletion deploy/mongodb/templates/actionset-dump.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}
runOnTargetPodNode: false
command:
- sh
- bash
- -c
- |
{{- .Files.Get "dataprotection/mongodump-restore.sh" | nindent 10 }}
9 changes: 7 additions & 2 deletions deploy/qdrant/scripts/qdrant-restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ mkdir -p "${SNAPSHOT_DIR}"
datasafed pull "${SNAPSHOT_FILE}" "${SNAPSHOT_DIR}/${SNAPSHOT_FILE}"

# start qdrant restore process
qdrant --storage-snapshot "${SNAPSHOT_DIR}/${SNAPSHOT_FILE}" --config-path /qdrant/config/config.yaml --force-snapshot --uri http://localhost:6333 &
/qdrant/qdrant --storage-snapshot "${SNAPSHOT_DIR}/${SNAPSHOT_FILE}" --config-path /qdrant/config/config.yaml --force-snapshot --uri http://localhost:6333 2>&1 | tee "${DATA_DIR}/restore.log" &

# wait until restore finished
until curl http://localhost:6333/cluster; do sleep 1; done
# note: if we have curl, we can detect it this way
# until curl http://localhost:6333/cluster; do sleep 1; done
until grep -q "Qdrant HTTP listening on" "${DATA_DIR}/restore.log"; do
sleep 1
done
rm "${DATA_DIR}/restore.log"

# restore finished, we can kill the restore process now
pid=`pidof qdrant`
Expand Down
7 changes: 4 additions & 3 deletions deploy/qdrant/templates/actionset-datafile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ spec:
preBackup: []
postBackup: []
backupData:
image: apecloud/curl-jq:latest
image: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.tools.repository}}:{{ .Values.images.tools.tag | default "latest" }}
runOnTargetPodNode: false
command:
# no bash available in the image
- sh
- -c
- |
Expand All @@ -26,9 +27,9 @@ spec:
intervalSeconds: 5
restore:
prepareData:
image: apecloud/curl-jq:latest
image: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.repository}}:{{ include "qdrant.version" . | default .Values.images.tag }}
command:
- sh
- bash
- -c
- |
{{- .Files.Get "scripts/qdrant-restore.sh" | nindent 8 }}
Expand Down

0 comments on commit f99ba38

Please sign in to comment.