fup
This commit is contained in:
@ -15,7 +15,8 @@ vcli-sentinel() {
|
||||
getFailOverStatus() {
|
||||
# Check if the failover is finished
|
||||
local failoverStatus
|
||||
primaryInfo=$(vcli-sentinel get-primary-addr-by-name "mymaster")
|
||||
sentinelMasterName="${VALKEY_MASTER_NAME:-"mymaster"}"
|
||||
primaryInfo=$(vcli-sentinel get-primary-addr-by-name "${sentinelMasterName}")
|
||||
primaryHost=$(echo ${primaryInfo} | awk -F ' ' '{print $1}')
|
||||
currentHost=$(hostname -f)
|
||||
if [[ "${primaryHost}" != "${currentHost}" ]]; then
|
||||
@ -44,12 +45,13 @@ isPrimary() {
|
||||
}
|
||||
|
||||
if isPrimary && ! getFailOverStatus; then
|
||||
sentinelMasterName="${VALKEY_MASTER_NAME}"
|
||||
echo "I'm the primary and you are stopping me, pausing client connections"
|
||||
#Pausing write connections to avoid data loss"
|
||||
vcli CLIENT PAUSE "22000" WRITE
|
||||
|
||||
echo "Starting failover"
|
||||
vcli-sentinel failover "mymaster"
|
||||
vcli-sentinel failover "${sentinelMasterName}"
|
||||
echo "Waiting for sentinel to complete failover for up to 120s"
|
||||
tmout=120
|
||||
while true ; do
|
||||
|
Reference in New Issue
Block a user