diff --git a/redis/3-highly-available/README.md b/redis/3-highly-available/README.md index b8995610..1e7d2bfd 100644 --- a/redis/3-highly-available/README.md +++ b/redis/3-highly-available/README.md @@ -74,9 +74,7 @@ tasks: cpu: 250m memory: 500Mi command: - - /bin/bash - - -c - - 'container run_master_and_sentinel' + - container run_master_and_sentinel environment_variables: REDIS_SENTINEL_SERVICE_HOST: '' deployment_strategy: @@ -181,5 +179,5 @@ tasks: image: image: quay.io/continuouspipe/redis3-highly-available:stable commands: - - /bin/bash -c 'container master_failover_and_sentinel_cleanup' + - container master_failover_and_sentinel_cleanup ``` diff --git a/redis/3-highly-available/usr/local/share/redis_functions.sh b/redis/3-highly-available/usr/local/share/redis_functions.sh index 5e2794a8..3cf4849a 100644 --- a/redis/3-highly-available/usr/local/share/redis_functions.sh +++ b/redis/3-highly-available/usr/local/share/redis_functions.sh @@ -2,7 +2,7 @@ function sentinel_command() { - redis-cli -h redis-sentinel -p 26379 --csv SENTINEL + redis-cli -h redis-sentinel -p 26379 --csv SENTINEL "$@" } function get_existing_master() @@ -49,7 +49,12 @@ function sentinel_cleanup() echo "> Waiting for the sentinel to receive data from the other sentinels" sleep 11s echo "> Resetting sentinel data for $sentinel" - redis-cli -h "$sentinel" -p 26379 SENTINEL RESET mymaster + + if test_remote_ports "$sentinel:26379"; then + redis-cli -h "$sentinel" -p 26379 SENTINEL RESET mymaster + else + echo "> Sentinel $sentinel doesn't appear to be active any more" + fi done }