Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bitnami/redis] Failed to connect replica when disabling external redis/sentinel access. #16946

Open
alehyarmalovich opened this issue May 29, 2023 · 4 comments · May be fixed by #16947
Open
Assignees
Labels
on-hold Issues or Pull Requests with this label will never be considered stale redis tech-issues The user has a technical issue about an application

Comments

@alehyarmalovich
Copy link
Contributor

alehyarmalovich commented May 29, 2023

Name and Version

bitnami/redis 17.11.3

What architecture are you using?

amd64

What steps will reproduce the bug?

Install helm chart with exposing redis/sentinel outside the cluster and then disable external access.

For a correct migration from external access to internal access, for some time I can’t delete external services with the NodePort type, so that the already recreated internal replica can connect to it, but at the same time, inside the startup scripts in the get_port function, the port is being installed from ENV variable (example: REDIS_MASTER_NODE_0_SERVICE_PORT_REDIS=30311) because external service exist.

Are you using any custom parameters or values?

Enable external access:

architecture: replication
useHostnames: false
sentinel:
  enabled: true
  quorum: 2
  masterSet: master
  downAfterMilliseconds: 2000
  failoverTimeout: 1000
  service:
    type: NodePort
    nodePorts:
      redis: 30310
      sentinel: 30420
useExternalDNS:
  enabled: true
  suffix: example.com
  additionalAnnotations:
    dns-type: external-dns
    endpoints-type: HostIP

Disable external access:

architecture: replication
useHostnames: false
sentinel:
  enabled: true
  quorum: 2
  masterSet: master
  downAfterMilliseconds: 2000
  failoverTimeout: 1000

What is the expected behavior?

After disable external access
Logs:

1:S 26 May 2023 19:11:13.754 * MASTER <-> REPLICA sync started
1:S 26 May 2023 19:11:13.756 # Error condition on socket for SYNC: Connection refused
1:S 26 May 2023 19:11:14.127 * Connecting to MASTER xxx.xxx.xxx.xxx:30311

Conf file:

dir /data
# User-supplied replica configuration:
rename-command FLUSHDB ""
rename-command FLUSHALL ""
# End of replica configuration
replica-announce-port 30311 <externalPort>
replica-announce-ip xxx.xxx.xxx.xxx <nternalIP>

What do you see instead?

instead of:

get_port() {
    hostname="$1"
    type="$2"

    port_var=$(echo "${hostname^^}_SERVICE_PORT_$type" | sed "s/-/_/g")
    port=${!port_var}

    if [[ -z "$port" ]]; then
        case $type in
            "SENTINEL")
                echo {{ .Values.sentinel.containerPorts.sentinel }}
                ;;
            "REDIS")
                echo {{ .Values.master.containerPorts.redis }}
                ;;
        esac
    else
        echo $port
    fi
}

use:

get_port() {
    hostname="$1"
    type="$2"

    port_var=$(echo "${hostname^^}_SERVICE_PORT_$type" | sed "s/-/_/g")
    port=${!port_var}

    if [[ -z "$port" ]] || [[ {{ .Values.sentinel.service.type | quote }} == "ClusterIP" ]]
    then
        case $type in
            "SENTINEL")
                echo {{ .Values.sentinel.containerPorts.sentinel }}
                ;;
            "REDIS")
                echo {{ .Values.master.containerPorts.redis }}
                ;;
        esac
    else
        echo $port
    fi
}

I'll do a PR

Additional information

No response

@carrodher
Copy link
Member

Thanks for creating this issue and the associated PR. The team will review it and provide feedback. Once merged the PR, this issue will be automatically closed.

@github-actions
Copy link

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

@github-actions github-actions bot added the stale 15 days without activity label Jun 14, 2023
@github-actions
Copy link

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

@bitnami-bot bitnami-bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 19, 2023
@alehyarmalovich
Copy link
Contributor Author

Reopen

@github-actions github-actions bot removed the solved label Jul 13, 2023
@carrodher carrodher reopened this Jul 13, 2023
@carrodher carrodher added on-hold Issues or Pull Requests with this label will never be considered stale and removed stale 15 days without activity triage Triage is needed labels Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on-hold Issues or Pull Requests with this label will never be considered stale redis tech-issues The user has a technical issue about an application
Projects
None yet
4 participants