Skip to content

Commit 4dff1fb

Browse files
authored
Merge pull request #446 from continuouspipe/feature/fix-sentinel-command
Pass on the command to redis-cli
2 parents 281f32b + c04bec9 commit 4dff1fb

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

redis/3-highly-available/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ tasks:
7474
cpu: 250m
7575
memory: 500Mi
7676
command:
77-
- /bin/bash
78-
- -c
79-
- 'container run_master_and_sentinel'
77+
- container run_master_and_sentinel
8078
environment_variables:
8179
REDIS_SENTINEL_SERVICE_HOST: ''
8280
deployment_strategy:
@@ -181,5 +179,5 @@ tasks:
181179
image:
182180
image: quay.io/continuouspipe/redis3-highly-available:stable
183181
commands:
184-
- /bin/bash -c 'container master_failover_and_sentinel_cleanup'
182+
- container master_failover_and_sentinel_cleanup
185183
```

redis/3-highly-available/usr/local/share/redis_functions.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
function sentinel_command()
44
{
5-
redis-cli -h redis-sentinel -p 26379 --csv SENTINEL
5+
redis-cli -h redis-sentinel -p 26379 --csv SENTINEL "$@"
66
}
77

88
function get_existing_master()
@@ -49,7 +49,12 @@ function sentinel_cleanup()
4949
echo "> Waiting for the sentinel to receive data from the other sentinels"
5050
sleep 11s
5151
echo "> Resetting sentinel data for $sentinel"
52-
redis-cli -h "$sentinel" -p 26379 SENTINEL RESET mymaster
52+
53+
if test_remote_ports "$sentinel:26379"; then
54+
redis-cli -h "$sentinel" -p 26379 SENTINEL RESET mymaster
55+
else
56+
echo "> Sentinel $sentinel doesn't appear to be active any more"
57+
fi
5358
done
5459
}
5560

0 commit comments

Comments
 (0)