[bitnami/redis-cluster] Support scenario where IPs are reused (#4990)

* Update librediscluster.sh

Signed-off-by: avcad <58915774+avcad@users.noreply.github.com>

* Update librediscluster.sh

Signed-off-by: avcad <58915774+avcad@users.noreply.github.com>

* Update librediscluster.sh

Signed-off-by: avcad <58915774+avcad@users.noreply.github.com>

* Update librediscluster.sh

Signed-off-by: avcad <58915774+avcad@users.noreply.github.com>

Signed-off-by: avcad <58915774+avcad@users.noreply.github.com>
This commit is contained in:
avcad 2022-09-06 04:05:19 -04:00 committed by GitHub
parent 6593490454
commit be5fc2cb42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -210,11 +210,12 @@ redis_cluster_update_ips() {
# The node can be new if we are updating the cluster, so catch the unbound variable error
if [[ ${host_2_ip_array[$node]+true} ]]; then
echo "Changing old IP ${host_2_ip_array[$node]} by the new one ${newIP}"
nodesFile=$(sed "s/ ${host_2_ip_array[$node]}:/ $newIP:/g" "${REDIS_DATA_DIR}/nodes.conf")
nodesFile=$(sed "s/ ${host_2_ip_array[$node]}:/ $newIP<NEWIP>:/g" "${REDIS_DATA_DIR}/nodes.conf")
echo "$nodesFile" >"${REDIS_DATA_DIR}/nodes.conf"
fi
host_2_ip_array["$node"]="$newIP"
done
replace_in_file "${REDIS_DATA_DIR}/nodes.conf" "<NEWIP>:" ":" false
declare -p host_2_ip_array >"${REDIS_DATA_DIR}/nodes.sh"
fi
}

View File

@ -210,11 +210,12 @@ redis_cluster_update_ips() {
# The node can be new if we are updating the cluster, so catch the unbound variable error
if [[ ${host_2_ip_array[$node]+true} ]]; then
echo "Changing old IP ${host_2_ip_array[$node]} by the new one ${newIP}"
nodesFile=$(sed "s/ ${host_2_ip_array[$node]}:/ $newIP:/g" "${REDIS_DATA_DIR}/nodes.conf")
nodesFile=$(sed "s/ ${host_2_ip_array[$node]}:/ $newIP<NEWIP>:/g" "${REDIS_DATA_DIR}/nodes.conf")
echo "$nodesFile" >"${REDIS_DATA_DIR}/nodes.conf"
fi
host_2_ip_array["$node"]="$newIP"
done
replace_in_file "${REDIS_DATA_DIR}/nodes.conf" "<NEWIP>:" ":" false
declare -p host_2_ip_array >"${REDIS_DATA_DIR}/nodes.sh"
fi
}