redis: add configuration parameter to prefix all keys used with a custom string
See original GitHub issueI use kombu (via celery) with a shared redis instance. The administrators of that instance require me to prefix all the keys I use in the redis server with a custom string. While Celery provides ways to prefix queue names, it seems to me that there is currently no way in Kombu (and hence Celery) to prefix all the redis keys used.
My understanding is that the keys used for channels are defined by keyprefix_queue = '_kombu.binding.%s'
, which not easily modifiable from Celery (via BROKER_TRANSPORT_OPTIONS
). Would it make sense to add a configuration parameter for that? If that sounds like the correct approach, I can try to provide a PR for that.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:13
- Comments:11 (9 by maintainers)
Top Results From Across the Web
Custom prefix for redis keys with Celery - Stack Overflow
How can I configure Celery to prefix all the keys it uses with a custom string? The docs mention ways to add prefixes...
Read more >Redis-specific parameters - Amazon ElastiCache for Redis
If you do not specify a parameter group for your Redis cluster, then a default parameter group appropriate to your engine version will...
Read more >Configuration | StackExchange.Redis
Because there are lots of different ways to configure redis, StackExchange. ... tiebreaker={string}, TieBreaker, __Booksleeve_TieBreak, Key to use for ...
Read more >RedisCacheConfiguration (Spring Data Redis 3.0.0 API)
Add a Converter for extracting the String representation of a cache key if no suitable Object.toString() method is present. ... Use the given...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@georgepsarakis yes exactly - what I would like to do is add another custom prefix in front of that. For instance, if both Mary and John use the same redis database, they could want to make sure that all the keys they use are prefixed with different strings. So they would want to use
mary._kombu.binding.<QUEUE_NAME>
andjohn._kombu.binding.<QUEUE_NAME>
respectively.In other words, it would be useful if the
_kombu.binding.%s
pattern could be altered via thebroker_transport_options
configuration setting.This quite common practice: for instance, when using Redis with Django for caching, you can specify such a prefix with
KEY_PREFIX
:This is not solved, my PR did not make it. Feel free to have a go at it!