Skip to content

sentinel_get_master_addr_by_name() returns boolean instead of (host, port) pair #3139

Closed
@nathan-bowman

Description

@nathan-bowman

Version: v5.0.1

Platform: Ubuntu 22.04 / Python 3.10.12

Description:

Reference: https://redis-py.readthedocs.io/en/latest/_modules/redis/commands/sentinel.html#SentinelCommands.sentinel_get_master_addr_by_name

sentinel_get_master_addr_by_name() should return a (host, port) pair

This works for me...

root@ubuntu:~# redis-cli -h redis-sentinel-sentinel.redis.svc.cluster.local -p 26379 --no-auth-warning -c SENTINEL GET-MASTER-ADDR-BY-NAME myMaster
1) "192.168.74.178"
2) "6379"

This works for me...

root@ubuntu:~# cat sentinel.go
package main

import (
        "github.com/redis/go-redis/v9"
        "context"
        "fmt"
)

func main() {
  sentinel := redis.NewSentinelClient(&redis.Options{
          Addr: "redis-sentinel-sentinel-headless.redis.svc.cluster.local:26379",
          Username: "default",
          Password: "asdf"},
  )

  ctx := context.TODO()

  fmt.Print( sentinel.GetMasterAddrByName(ctx, "myMaster").Result() )

}
root@ubuntu:~# go run sentinel.go
[192.168.94.104 6379]

This does NOT...

root@ubuntu:~# python3
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import redis
>>> sentinel = redis.sentinel.Sentinel([('redis-sentinel-sentinel-headless.redis.svc.cluster.local', 26379)], socket_timeout=0.5, password='asdf', sentinel_kwargs={'password': 'asdf'})
>>> sentinel.sentinel_get_master_addr_by_name('myMaster')
True

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions