As per title,
I am struggling to make the cache working with a redis cluster ( whereas it works perfectly fine with master/slave configuration). I created a simple test file to check the connection and I either got MOVED, or timeout. Surely I got something wrong here:
import asyncio
from redis.asyncio.cluster import RedisCluster
async def test_redis_connection():
try:
# Connect to the Redis cluster
redis = RedisCluster.from_url('redis://localhost:6379', encoding='utf-8', decode_responses=True)
# Test the connection by setting and getting a value
await redis.set('key1', 'bar')
value = await redis.get('key1')
# Print the result
print(f"Connection successful, value: {value}")
# Close the connection
await redis.close()
except Exception as e:
print(f"Connection failed: {e}")
# Run the test
asyncio.run(test_redis_connection())
Silly, mistake found with the redis-cli -c command. The node pool is not reachable unless you portforward all of them. Everything works within a pod in k8s environment.
As per title, I am struggling to make the cache working with a redis cluster ( whereas it works perfectly fine with master/slave configuration). I created a simple test file to check the connection and I either got MOVED, or timeout. Surely I got something wrong here:
In my application I got this bit:
Which hangs, without doing anything.
For context, the cluster is running in my k8s cluster, I have simply port-forwarded the cluster svc to my localhost. There is no password, no ssl.