File tree Expand file tree Collapse file tree
addons/elasticsearch/dataprotection Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export PATH=$PATH:/usr/share/elasticsearch/bin
99cat /etc/datasafed/datasafed.conf
1010toolConfig=/etc/datasafed/datasafed.conf
1111REPOSITORY=kb-backup
12- ES_ENDPOINT=http://${DP_DB_HOST} :9200
12+ ES_ENDPOINT=http://${DP_DB_HOST} . ${KB_NAMESPACE} .svc.cluster.local :9200
1313
1414# if the script exits with a non-zero exit code, touch a file to indicate that the backup failed,
1515# the sync progress container will check this file and exit if it exists
@@ -28,7 +28,7 @@ trap handle_exit EXIT
2828
2929function getToolConfigValue() {
3030 local var=$1
31- cat $toolConfig | grep " $var " | awk ' {print $NF}'
31+ cat $toolConfig | grep " $var [[:space:]]*= " | awk ' {print $NF}'
3232}
3333
3434s3_endpoint=$( getToolConfigValue endpoint)
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ set -o errexit
55
66cat /etc/datasafed/datasafed.conf
77toolConfig=/etc/datasafed/datasafed.conf
8- ES_ENDPOINT=http://${DP_DB_HOST} :9200
8+ ES_ENDPOINT=http://${DP_DB_HOST} . ${KB_NAMESPACE} .svc.cluster.local :9200
99REPOSITORY=kb-restore
1010
1111# if the script exits with a non-zero exit code, touch a file to indicate that the backup failed,
@@ -22,7 +22,7 @@ trap handle_exit EXIT
2222
2323function getToolConfigValue() {
2424 local var=$1
25- cat $toolConfig | grep " $var " | awk ' {print $NF}'
25+ cat $toolConfig | grep " $var [[:space:]]*= " | awk ' {print $NF}'
2626}
2727
2828s3_endpoint=$( getToolConfigValue endpoint)
@@ -213,6 +213,20 @@ curl -f -s -X POST "${ES_ENDPOINT}/_snapshot/${REPOSITORY}/${backup_name}/_resto
213213}
214214'
215215
216+ # Wait for the cluster health to become green after restore
217+ wait_interval=10 # Check every 10 seconds
218+
219+ while true ; do
220+ # Query cluster health status
221+ health_status=$( curl -s " ${ES_ENDPOINT} /_cluster/health" | grep -o ' "status":"[^\"]*"' | awk -F: ' {print $2}' | tr -d ' "' )
222+ echo " Current cluster health status: $health_status "
223+ if [[ " $health_status " == " green" ]]; then
224+ echo " Cluster health is green, restore is complete."
225+ break
226+ fi
227+ sleep $wait_interval
228+ done
229+
216230enable_indexing_and_geoip true
217231
218232switch_ilm start
You can’t perform that action at this time.
0 commit comments