-
Notifications
You must be signed in to change notification settings - Fork 47
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
RedisSentinelBackend doesn't work with "db" number other than 0 #201
Comments
hi there - unfortunately I didn't write this backend and I know very little about it. dogpile doesn't emit those statements so perhaps this issue is actually in the redis.sentinel library? i dont know anything about how Celery interacts with redis. the backend here is quite simple so feel free to send a PR if you know what it's not doing correctly: https://github.com/sqlalchemy/dogpile.cache/blob/master/dogpile/cache/backends/redis.py#L273 |
CC @sbrunner , the creator of this backend |
@zzzeek Thanks a lot for the quick reply. In this case I will definitely look deeper into this issue next week and at the backend implementation you shared. Wish you a great weekend! |
Looking at the code, I THINK you may be able to do a workaround by sending in a fully qualified |
Effectively the db should always be 0, he is used to internal communication. |
Thanks @sbrunner , this works nicely! I've tried that before but initially it didn't work due to how other library ( One thing I would suggest is to extend the documentation for the sentinel backend to mention that Thanks again everybody, I think now I will be able to work around this issue somehow. |
Hello,
we are trying to setup
RedisSentinelBackend
with a non-defaultdb
parameter to specify the database of the Redis server where the cache keys should be stored.However when specifying
db
parameter other than0
, following error is raised by the Redis client:Here is our configuration in a simple local setup (we use YAML format, however it shouldn't really matter here):
Of course everything works fine when parameter
db
is removed or set to0
.I presume what is happening is that Redis client is told to use command
SELECT 2
when working with a Sentinel node, while this command is not known by Sentinel.I can reproduce the issue in
redis-cli
when connected to a Sentinel node:This seems to be an issue in
RedisSentinelBackend
ofdogpile.cache
, because when using e.g. Celery, we are able to specify the db numbers with Sentinel connection strings and keys are then properly created in the db of our choice.I was also wondering if there could be some workaround for this issue, e.g. using
connection_kwargs
parameter? I tried passing thedb
argument to it, however it did not work.Any help is greatly appreciated, because in our current setup we can't store the cache keys in db
0
of Redis, which currently blocks us from switching to Redis Sentinel setup.The text was updated successfully, but these errors were encountered: