mirror of
https://github.com/marcel-dempers/docker-development-youtube-series.git
synced 2025-06-06 17:01:30 +00:00
Merge pull request #53 from schmiddim/master
Create FDQN for Redis dynamicly
This commit is contained in:
commit
5c86259aff
@ -22,6 +22,7 @@ spec:
|
||||
cp /tmp/redis/redis.conf /etc/redis/redis.conf
|
||||
|
||||
echo "finding master..."
|
||||
MASTER_FDQN=`hostname -f | sed -e 's/redis-[0-9]\./redis-0./'`
|
||||
if [ "$(redis-cli -h sentinel -p 5000 ping)" != "PONG" ]; then
|
||||
echo "master not found, defaulting to redis-0"
|
||||
|
||||
@ -29,7 +30,7 @@ spec:
|
||||
echo "this is redis-0, not updating config..."
|
||||
else
|
||||
echo "updating redis.conf..."
|
||||
echo "slaveof redis-0.redis.redis.svc.cluster.local 6379" >> /etc/redis/redis.conf
|
||||
echo "slaveof $MASTER_FDQN 6379" >> /etc/redis/redis.conf
|
||||
fi
|
||||
else
|
||||
echo "sentinel found, finding master"
|
||||
@ -82,4 +83,4 @@ spec:
|
||||
targetPort: 6379
|
||||
name: redis
|
||||
selector:
|
||||
app: redis
|
||||
app: redis
|
||||
|
Loading…
x
Reference in New Issue
Block a user