Open cdevacc1 opened 1 year ago
This command without password work. Can someone please explain why?
>>> import redis
>>> redis.sentinel.Sentinel([('sentinel.redis', 5000)]).discover_master('mymaster')
('redis-0.redis.redis.svc.cluster.local', 6379)
My /etc/redis/redis.conf
masterauth "password"
requirepass "password"
My /etc/redis/sentinel.conf
port 5000
sentinel resolve-hostnames yes
sentinel announce-hostnames yes
sentinel monitor mymaster redis-0.redis.redis.svc.cluster.local 6379 2
sentinel auth-pass mymaster password
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 60000
@cdevacc1 Did you ever have any success with this?
This works for me...
root@ubuntu:~# redis-cli -h redis-sentinel-sentinel.redis.svc.cluster.local -p 26379 --no-auth-warning -c SENTINEL MASTERS
1) 1) "name"
2) "myMaster"
3) "ip"
4) "192.168.94.104"
5) "port"
6) "6379"
7) "runid"
...
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
>>> sentinel.discover_master('myMaster')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/test/lib/python3.10/site-packages/redis/sentinel.py", line 301, in discover_master
raise MasterNotFoundError(f"No master found for {service_name!r}{error_info}")
redis.sentinel.MasterNotFoundError: No master found for 'myMaster'
Facing the same issue: https://github.com/redis/redis-py/issues/1388
@filipcima comment not work, Did I miss anything?