Skip to content
\n

Are you using any custom parameters or values?
\nI'm sure about every parameter because without auth, script works as expected, the only parameter I cannot trust is password in sentinel_kwargs. I'm also sure that problem is on dogpile.cache because from the same client it works with redis-cli or with a python script like this:

\n
import redis\n\n# Create a Redis Sentinel connection\nsentinel = redis.Redis(\n    host='redis-cluster',\n    port=26379,\n    password='mypassword',\n    decode_responses=True\n)\n\n# Get the replicas (slaves) of the master\nreplicas = sentinel.sentinel_slaves('mymaster')\n\n# Iterate through replicas and print their IP and port\nfor replica in replicas:\n    replica_host = replica['ip']\n    replica_port = replica['port']\n    print(f\"Replica: {replica_host}:{replica_port}\")\n
\n

What is the expected behavior?
\nsame output obtained when auth is disabled:
\n5.0.1
\nData found in cache: <dogpile.cache.api.NoValue object>
\nFinal result: <dogpile.cache.api.NoValue object>

\n

What do you see instead?
\nredis.sentinel.SlaveNotFoundError: No slave found for 'mymaster

\n

Additional information
\nRedis cluster is deployed through bitnami helm chart.
\nI've tried different version of dogpile.cache (1.1.8 and 1.1.0), same result.

\n

I've tried to add decode_responses parameter, same result.
\nNetwork and name resolution are ok. It works without auth and with auth enable but without dogpile.cache (like redis-cli and redis-py).

","upvoteCount":1,"answerCount":2,"acceptedAnswer":{"@type":"Answer","text":"

fixed adding also connection kwargs. sentinel password is used to connect to sentinel but to connect to the master node connection kwargs has to be set. If user is default, username field can be omitted.

\n

cache_region = dogpile.cache.make_region().configure(
\n'dogpile.cache.redis_sentinel',
\narguments={
\n'sentinels': [
\n['redis-cluster', 26379],
\n],
\n'sentinel_kwargs': {
\n'password': 'mypassword',
\n}
\n'connection_kwargs': {
\n'password': 'mypassword',
\n}

\n}
\n)

","upvoteCount":1,"url":"https://github.com/sqlalchemy/dogpile.cache/discussions/249#discussioncomment-7929265"}}}

redis.sentinel.SlaveNotFoundError: No slave found for 'mymaster' #249

Discussion options

You must be logged in to vote

fixed adding also connection kwargs. sentinel password is used to connect to sentinel but to connect to the master node connection kwargs has to be set. If user is default, username field can be omitted.

cache_region = dogpile.cache.make_region().configure(
'dogpile.cache.redis_sentinel',
arguments={
'sentinels': [
['redis-cluster', 26379],
],
'sentinel_kwargs': {
'password': 'mypassword',
}
'connection_kwargs': {
'password': 'mypassword',
}

}
)

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@alelomonaco
Comment options

@zzzeek
Comment options

@zzzeek
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by alelomonaco
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #248 on December 20, 2023 15:36.