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] Configuring the node as master instead as replica when redis on the same k8s node and exposed outside by HostIP #16925

Open
alehyarmalovich opened this issue May 26, 2023 · 4 comments · May be fixed by #16947
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

Name and Version

bitnami/redis 17.11.3

What architecture are you using?

amd64

What steps will reproduce the bug?

install helm chart with custom parameters

Are you using any custom parameters or values?

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

What is the expected behavior?

12:25:05.19 INFO  ==> about to run the command: timeout 220 redis-cli -h 10.10.10.10 -p 30421 sentinel get-master-addr-by-name master
12:25:05.20 INFO  ==> about to run the command: timeout 220 redis-cli -h 10.10.10.10 -p 30421 sentinel get-master-addr-by-name master
12:25:05.21 INFO  ==> Current master: REDIS_SENTINEL_INFO=(10.10.10.10,30311)
12:25:05.22 INFO  ==> Configuring the node as master
1:C 26 May 2023 12:25:05.263 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 26 May 2023 12:25:05.263 # Redis version=7.0.11, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 26 May 2023 12:25:05.263 # Configuration loaded
1:M 26 May 2023 12:25:05.264 * monotonic clock: POSIX clock_gettime
1:M 26 May 2023 12:25:05.266 * Running mode=standalone, port=6379.
1:M 26 May 2023 12:25:05.266 # Server initialized
1:M 26 May 2023 12:25:05.266 * Ready to accept connections
NAME                    READY   STATUS    RESTARTS   AGE   IP              NODE                           
redis-test-node-0       2/2     Running   0          24h   100.100.100.1   ip-10-10-10-10.ec2.internal
redis-test-node-1       2/2     Running   0          24h   100.100.100.2   ip-10-10-10-10.ec2.internal
redis-test-node-2       2/2     Running   0          24h   100.100.100.3   ip-10-10-10-10.ec2.internal

What do you see instead?

instead of:

        # Fetches current master's host and port
        REDIS_SENTINEL_INFO=($(get_sentinel_master_info))
        info "Current master: REDIS_SENTINEL_INFO=(${REDIS_SENTINEL_INFO[0]},${REDIS_SENTINEL_INFO[1]})"
        REDIS_MASTER_HOST=${REDIS_SENTINEL_INFO[0]}
        REDIS_MASTER_PORT_NUMBER=${REDIS_SENTINEL_INFO[1]}

        if [[ "$REDIS_MASTER_HOST" == "$(get_full_hostname "$HOSTNAME")" ]]; then
            # Case 3: Active sentinel and master it is this node --> MASTER
            info "Configuring the node as master"

use:

        # Fetches current master's host and port
        REDIS_SENTINEL_INFO=($(get_sentinel_master_info))
        info "Current master: REDIS_SENTINEL_INFO=(${REDIS_SENTINEL_INFO[0]},${REDIS_SENTINEL_INFO[1]})"
        REDIS_MASTER_HOST=${REDIS_SENTINEL_INFO[0]}
        REDIS_MASTER_PORT_NUMBER=${REDIS_SENTINEL_INFO[1]}

        if [[ "$REDIS_MASTER_HOST" == "$(get_full_hostname "$HOSTNAME")" ]] && [[ "$REDIS_MASTER_PORT_NUMBER" == "$REDISPORT" ]]; then
            # Case 3: Active sentinel and master it is this node --> MASTER
            info "Configuring the node as master"

I'll do a PR

Additional information

When installing chart with custom parameters above and not setting hard affinity rules, redis nodes than launch at the same k8s node as a master will be configuring as master, because equal values [[ "$REDIS_MASTER_HOST" == "$(get_full_hostname "$HOSTNAME")" ]]

@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 added triage Triage is needed and removed solved labels 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
@github-actions github-actions bot added triage Triage is needed on-hold Issues or Pull Requests with this label will never be considered stale and removed on-hold Issues or Pull Requests with this label will never be considered stale solved 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
5 participants