Having issues with Redis Clustering on Azure Managed Redis

Brett Gilmer 0 Reputation points
2025-11-06T20:49:58.2666667+00:00

This question is actually about "Azure Managed Redis" but there was not a child tag for that.

I have a "Azure Managed Redis" instance and a container within container apps that access it.

I am using a pretty standard redis connection

self.redis = redis.Redis(
    host='<redacted>.eastus.redis.azure.net',
    port=10000,
    password=access_key,
    ssl=True
)

where the access key is from "Authentication-access keys" and the hostname is from "Overview->Endpoint" which is publicly accessible (at the moment, this seems to happen whether is accessible or not).

It connects and works sometimes, but eventually I start getting

2025-11-06T20:25:03.1960930Z stdout F redis.exceptions.MovedError: 13842 10.0.0.4:8500

Further, I cannot connect to this public endpoint with RedisInsight, as it gives me "Failed to refresh slots cache." unless I check "Force standalone connection" in which case it sometimes works and othertimes shows an empty cache.

I understand this all comes down to clustering, but I am getting conflicting information on what to do about it, and nothing is working for me.

Thanks

Azure Cache for Redis
Azure Cache for Redis
An Azure service that provides access to a secure, dedicated Redis cache, managed by Microsoft.
{count} votes

2 answers

Sort by: Most helpful
  1. Manoj Kumar Boyini 1,330 Reputation points Microsoft External Staff Moderator
    2025-11-09T12:13:26.14+00:00

    Hi Brett Gilmer,

    The issue you are seeing is caused by how Azure Managed Redis uses the OSS Cluster policy. In this mode your Redis client and RedisInsight must be able to reach each shard node directly not just the main endpoint on port 10000.

    When Redis sends a MOVED response it tries to redirect your client to the correct shard (for example, on ports 8500–8599). If those shard hostnames or ports can’t be reached or resolved, the connection fails which is why RedisInsight only works in “Force standalone” mode and sometimes shows empty data.

    To fix this:

    1. Make sure your app and RedisInsight are running inside the same VNet or a peered VNet as your Redis cache.
    2. Confirm that your Private DNS zone (privatelink.redis.azure.net) includes all shard hostnames such as <clustername>-0001.eastus.redis.azure.net, <clustername>-0002.eastus.redis.azure.net, etc. This allows each shard to resolve correctly to its private IP.
    3. Ensure outbound access is open for ports 10000 and 8500–8599 in your network settings.

    If managing DNS or VNet setup is difficult, the simpler option is to recreate the cache using the Enterprise (proxy) policy, which uses a single endpoint on port 10000 and doesn’t require direct shard connectivity.

    Helpful References
    https://learn.microsoft.com/en-us/azure/redis/architecture#clustering
    https://learn.microsoft.com/en-us/azure/azure-cache-for-redis/cache-private-link

    Hope this helps. Do let us know if you have any further queries.

    1 person found this answer helpful.
    0 comments No comments

  2. Q&A Assist
    2025-11-06T20:50:21.2233333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    It seems you are encountering issues with Redis clustering on your Azure Managed Redis instance. The redis.exceptions.MovedError indicates that your Redis client is trying to access a key that is not located on the current node, which is common in clustered setups. Here are some steps and considerations to help you troubleshoot and resolve the issue:

    1. Ensure Proper Clustering Configuration: Since Azure Managed Redis instances are clustered by default, make sure your Redis client is configured to handle clustering. In your case, the redis-py library should be set up to support clustering. You might need to use the Cluster class from the redis-py-cluster package instead of the standard redis.Redis class.
    2. Use the Correct Connection Parameters: When connecting to a clustered Redis instance, ensure you are using the correct hostname and port. The connection string should not include the port in the hostname. Instead, specify the port separately:
         self.redis = redis.Redis(
             host='<redacted>.eastus.redis.azure.net',
             port=10000,
             password=access_key,
             ssl=True
         )
      
      If you are using a clustered setup, consider switching to a client that supports the Redis Cluster API.
    3. Testing with RedisInsight: If you are having trouble connecting with RedisInsight, ensure that you are not using the "Force standalone connection" option unless absolutely necessary. If you continue to see issues, check your network settings and ensure that the necessary ports are open and accessible.
    4. Check for Client Library Compatibility: Ensure that the version of the Redis client library you are using is compatible with the Redis Cluster API. If you are using an older version, consider upgrading to the latest version of the library.
    5. Review Azure Managed Redis Documentation: For more detailed guidance on using Azure Managed Redis and its clustering capabilities, refer to the official documentation. This can provide insights into best practices and configuration options.

    By following these steps, you should be able to better manage your connection to the Azure Managed Redis instance and handle clustering more effectively.


    References:


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.