Redis-Cluster: Ensure Proper Host Resolution (#14567)
Ensure that cluster setup scripts support proper DNS resolution of Redis nodes running on nonstandard ports. Signed-off-by: James Lucas <jaymell@users.noreply.github.com> Signed-off-by: James Lucas <jaymell@users.noreply.github.com>
This commit is contained in:
parent
d13f1d92c8
commit
5902dab67e
|
|
@ -201,7 +201,8 @@ redis_cluster_update_ips() {
|
|||
if [[ ! -f "${REDIS_DATA_DIR}/nodes.sh" ]]; then
|
||||
# It is the first initialization so store the nodes
|
||||
for node in "${nodes[@]}"; do
|
||||
ip=$(wait_for_dns_lookup "$node" "$REDIS_DNS_RETRIES" 5)
|
||||
read -r -a host_and_port <<< "$(to_host_and_port "$node")"
|
||||
ip=$(wait_for_dns_lookup "${host_and_port[0]}" "$REDIS_DNS_RETRIES" 5)
|
||||
host_2_ip_array["$node"]="$ip"
|
||||
done
|
||||
echo "Storing map with hostnames and IPs"
|
||||
|
|
@ -211,7 +212,8 @@ redis_cluster_update_ips() {
|
|||
. "${REDIS_DATA_DIR}/nodes.sh"
|
||||
# Update the IPs in the nodes.conf
|
||||
for node in "${nodes[@]}"; do
|
||||
newIP=$(wait_for_dns_lookup "$node" "$REDIS_DNS_RETRIES" 5)
|
||||
read -r -a host_and_port <<< "$(to_host_and_port "$node")"
|
||||
newIP=$(wait_for_dns_lookup "${host_and_port[0]}" "$REDIS_DNS_RETRIES" 5)
|
||||
# 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}"
|
||||
|
|
|
|||
|
|
@ -201,7 +201,8 @@ redis_cluster_update_ips() {
|
|||
if [[ ! -f "${REDIS_DATA_DIR}/nodes.sh" ]]; then
|
||||
# It is the first initialization so store the nodes
|
||||
for node in "${nodes[@]}"; do
|
||||
ip=$(wait_for_dns_lookup "$node" "$REDIS_DNS_RETRIES" 5)
|
||||
read -r -a host_and_port <<< "$(to_host_and_port "$node")"
|
||||
ip=$(wait_for_dns_lookup "${host_and_port[0]}" "$REDIS_DNS_RETRIES" 5)
|
||||
host_2_ip_array["$node"]="$ip"
|
||||
done
|
||||
echo "Storing map with hostnames and IPs"
|
||||
|
|
@ -211,7 +212,8 @@ redis_cluster_update_ips() {
|
|||
. "${REDIS_DATA_DIR}/nodes.sh"
|
||||
# Update the IPs in the nodes.conf
|
||||
for node in "${nodes[@]}"; do
|
||||
newIP=$(wait_for_dns_lookup "$node" "$REDIS_DNS_RETRIES" 5)
|
||||
read -r -a host_and_port <<< "$(to_host_and_port "$node")"
|
||||
newIP=$(wait_for_dns_lookup "${host_and_port[0]}" "$REDIS_DNS_RETRIES" 5)
|
||||
# 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}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue