github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/deploy/qdrant/scripts/qdrant-restore.sh (about) 1 #!/usr/bin/env bash 2 3 set -e 4 set -o pipefail 5 export PATH="$PATH:$DP_DATASAFED_BIN_PATH" 6 export DATASAFED_BACKEND_BASE_PATH="$DP_BACKUP_BASE_PATH" 7 mkdir -p ${DATA_DIR} 8 res=`find ${DATA_DIR} -type f` 9 if [ ! -z "${res}" ]; then 10 echo "${DATA_DIR} is not empty! Please make sure that the directory is empty before restoring the backup." 11 exit 1 12 fi 13 14 # download snapshot file 15 SNAPSHOT_DIR="${DATA_DIR}/_dp_snapshots" 16 SNAPSHOT_FILE="${DP_BACKUP_NAME}.snapshot" 17 mkdir -p "${SNAPSHOT_DIR}" 18 datasafed pull "${SNAPSHOT_FILE}" "${SNAPSHOT_DIR}/${SNAPSHOT_FILE}" 19 20 # start qdrant restore process 21 /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" & 22 23 # wait until restore finished 24 # note: if we have curl, we can detect it this way 25 # until curl http://localhost:6333/cluster; do sleep 1; done 26 until grep -q "Qdrant HTTP listening on" "${DATA_DIR}/restore.log"; do 27 sleep 1 28 done 29 rm "${DATA_DIR}/restore.log" 30 31 # restore finished, we can kill the restore process now 32 pid=`pidof qdrant` 33 kill -s INT ${pid} 34 wait ${pid} 35 36 # delete snapshot file 37 rm -rf "${SNAPSHOT_DIR}"