Skip to content

Instantly share code, notes, and snippets.

@waja
waja / redis-sentinel-switch-state.sh
Last active April 30, 2024 15:51
Shell script to migrate a VIP to the actual redis master when managing them with redis-sentinel
#!/bin/sh
_DEBUG="on"
DEBUGFILE=/tmp/sentinel_failover.log
VIP='10.125.125.30'
MASTERIP=${6}
MASK='24'
IFACE='eth0'
MYIP=$(ip -4 -o addr show dev ${IFACE}| grep -v secondary| awk '{split($4,a,"/");print a[1]}')
DEBUG () {