Skip to content
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

Redis Cluster Support #5896

Closed
zackman0010 opened this issue Aug 31, 2023 · 2 comments
Closed

Redis Cluster Support #5896

zackman0010 opened this issue Aug 31, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@zackman0010
Copy link

zackman0010 commented Aug 31, 2023

Describe the bug

When using Redis Cluster as a cache, the following log lines are frequently printed at a WARN level:

ts=2023-08-31T18:45:27.769115044Z caller=redis_client.go:242 level=warn name=metadata-cache msg="failed to mget items from redis" err="CROSSSLOT Keys in request don't hash to the same slot" items=0
ts=2023-08-31T18:47:01.966078844Z caller=redis_client.go:242 level=warn name=chunks-cache msg="failed to mget items from redis" err="CROSSSLOT Keys in request don't hash to the same slot" items=0
ts=2023-08-31T18:47:02.823316454Z caller=redis_client.go:242 level=warn name=index-cache msg="failed to mget items from redis" err="CROSSSLOT Keys in request don't hash to the same slot" items=0

To Reproduce

Steps to reproduce the behavior:

  1. Configure Mimir to point to a Redis Cluster cache backend
  2. Start Mimir version 2.9.0 (branch: release-2.9, revision: 761114d8b)

Expected behavior

No errors in the logs, functioning Redis cache

Environment

  • Infrastructure: bare-metal
  • Deployment tool: manual

Additional Context

This error is due to the way Redis Cluster hashes the keys. It can only do multi-key operations if all keys result in the same hash. Redis supports the concept of "Hash Keys", where it will only hash a subset of the key surrounded by {}. Any keys that will be used in a multi-key query should utilize the same hash key so they're guaranteed to fall in the same hash slot.
Example: key1 and key2 will hash to different slots, but {hashkey}.key1 and {hashkey}.key2 are guaranteed to hash to the same slot.

Alternatively, I saw that both Loki and Tempo have an isCluster check to only use multi-key operations if not operating in Cluster mode. This check is not present in Mimir.

@dimitarvdimitrov
Copy link
Contributor

Mimir is using dskit for its redis client. I opened a dskit issue to track this grafana/dskit#373

@56quarters
Copy link
Contributor

Redis support is deprecated now and being removed in the next major release (no ETA): #9453

@56quarters 56quarters closed this as not planned Won't fix, can't repro, duplicate, stale Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants