Skip to content

Commit

Permalink
Add log for setUpVip (#83)
Browse files Browse the repository at this point in the history
* Add log for setUpVip

* update for comments
  • Loading branch information
MrYourM authored and hlwanghl committed Jan 22, 2020
1 parent 268b59f commit 6a17f7f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,19 @@ checkVip() {
setUpVip() {
local masterIp; masterIp="${1:-$(findMasterIp)}"
local myIps; myIps="$(hostname -I)"
log --debug "setting up vip: [master=$masterIp me=$myIps] ..."
log "setting up vip: [master=$masterIp me=$myIps Vip=$REDIS_VIP] ..."
if [ "$MY_IP" == "$masterIp" ]; then
[[ " $myIps " == *" $REDIS_VIP "* ]] || bindVip
[[ " $myIps " == *" $REDIS_VIP "* ]] || {
log "This is the master node, though VIP is unbound. Binding VIP ..."
bindVip
}
else
[[ " $myIps " != *" $REDIS_VIP "* ]] || unbindVip
[[ " $myIps " != *" $REDIS_VIP "* ]] || {
log "This is not the master node, though VIP is still bound. Unbinding VIP ..."
unbindVip
}
fi
log "setUpVip successful"
}

bindVip() {
Expand Down Expand Up @@ -396,6 +403,7 @@ check(){
}
[[ "${REVIVE_ENABLED:-"true"}" == "true" ]] || return 0
_check
checkVip
}

getRedisRoles(){
Expand Down
2 changes: 1 addition & 1 deletion app-standalone/cluster.json.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"container": {
"type": "lxc",
"zone": "pek3a",
"image": "img-wi6n5w1h"
"image": "img-v6qv1l0c"
},
"instance_class": {{cluster.node.instance_class}},
"count": {{cluster.node.count}},
Expand Down

0 comments on commit 6a17f7f

Please sign in to comment.