Skip to content

Commit

Permalink
Merge pull request #144 from anshubo-yun/cluster6.2.5-1.0.2
Browse files Browse the repository at this point in the history
Cluster6.2.5 1.0.2
  • Loading branch information
anshubo-yun authored Sep 14, 2022
2 parents 0ba6509 + f63ef0d commit 0b1e89b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,22 @@ REDIS_NODES="$(echo "
{{- getv (printf "/hosts/master-replica/%s/ip" .) }}
{{- end }}
" | xargs -n1 | sort -V | xargs)"
CHANGE_VXNET_ENV_EOF

UPDATE_CHANGE_VXNET="$(echo "
{{- range ls "/hosts/master" }}
{{ getv (printf "/hosts/master/%s/gid" .) }}/
{{- getv (printf "/hosts/master/%s/sid" .) }}\
/master/
{{- getv (printf "/hosts/master/%s/instance_id" .) }}/
{{- getv (printf "/hosts/master/%s/ip" .) }}
{{- end }}
{{- range ls "/hosts/master-replica" }}
{{ getv (printf "/hosts/master-replica/%s/gid" .) }}/
{{- getv (printf "/hosts/master-replica/%s/sid" .) }}\
/slave/
{{- getv (printf "/hosts/master-replica/%s/instance_id" .) }}/
{{- getv (printf "/hosts/master-replica/%s/ip" .) }}
{{- end }}
" | xargs -n1 | sort -V | xargs)"

CHANGE_VXNET_ENV_EOF
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ getLoadStatus() {
start() {
isNodeInitialized || execute initNode
if [[ -n "$JOINING_REDIS_NODES" && "$ENABLE_ACL" == "yes" ]] ; then
sudo -u redis touch $ACL_CLEAR
local ACL_CMD node_ip=$(echo ${REDIS_NODES%% *} | cut -d "/" -f5)
ACL_CMD="$(getRuntimeNameOfCmd --node-id "$(echo ${REDIS_NODES%% *} | cut -d "/" -f4)" ACL)"
runRedisCmd -h $node_ip $ACL_CMD LIST > $RUNTIME_ACL_FILE
Expand Down Expand Up @@ -484,15 +485,16 @@ getRuntimeNameOfCmd() {


swapIpAndName() {
local fields replaceCmd port=$REDIS_PLAIN_PORT
local fields replaceCmd port=$REDIS_PLAIN_PORT nodes=$REDIS_NODES
[ "$REDIS_TLS_CLUSTER" == "yes" ] && port=$REDIS_TLS_PORT
sudo -u redis touch $NODE_CONF_FILE && rotate $NODE_CONF_FILE
if [ -n "$1" ];then
fields='{print "s/ "$4":\\([0-9]\\+\\)@/ "$5":\1@/g"}'
nodes="$UPDATE_CHANGE_VXNET $nodes"
fields='{print "s/ "$4":\\([0-9]\\+\\)@/ "$5":\\1@/g"}'
else
fields='{gsub("\\.", "\\.", $5);{print "s/ "$5":\\([0-9]\\+\\)@/ "$4":\\1@/g"}}'
fi
replaceCmd="$(echo "$REDIS_NODES" | xargs -n1 | awk -F/ "$fields" | paste -sd';');s/:[0-9]\\+@[0-9]\\+ /:$port@$(($port+10000)) /g"
replaceCmd="$(echo "$nodes" | xargs -n1 | awk -F/ "$fields" | paste -sd';');s/:[0-9]\\+@[0-9]\\+ /:$port@$(($port+10000)) /g"
sed -i "$replaceCmd" $NODE_CONF_FILE
}

Expand Down
2 changes: 1 addition & 1 deletion app-cluster/cluster.json.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"prefer_type": "lxc",
"zone": "pek3",
"sriov_nic": true,
"image": "img-3iyyqck5"
"image": "img-r3sguguo"
},
"instance_class": {{cluster.master.instance_class}},
"count": {{cluster.master.count}},
Expand Down

0 comments on commit 0b1e89b

Please sign in to comment.