-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from matskiv/INTLY-1000
INTLY-1000 - add redis backup component
- Loading branch information
Showing
3 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
function component_dump_data { | ||
dest_file="$1/archives/dump.rdb" | ||
dumb_rdb_path="/var/lib/redis/data/dump.rdb" | ||
|
||
oc projects | ||
redis_pod_name=$(oc get pods -l deploymentConfig=backend-redis -o name -n 3scale | sed -e 's/^pod\///') | ||
copy_output=$(oc cp 3scale/${redis_pod_name}:${dumb_rdb_path} ${dest_file}) | ||
echo ${copy_output} | ||
|
||
# check if rdb file was rewritten during oc cp, and copy it again if it was | ||
if [[ $copy_output == *"file changed as we read it"* ]]; then | ||
sleep 10s #wait until rdb rewrite finished | ||
echo "dumb.rdb has been overwritten during copying, executing 'oc cp' again" | ||
oc cp 3scale/${redis_pod_name}:${dumb_rdb_path} ${dest_file} | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters