I am using the flask-caching library to use caching in my flask app. I am following the docs here: https://flask-caching.readthedocs.io/en/latest/#redisclustercache
When trying the connection on a cluster-enabled-mode cluster locally it works, however the app is stuck like this:
When I try to connect it to a hosted cluster in elasticache (disabled-cluster-mode) - I am using --tls auth.
Here is how the config looks like:
cache.init_app(
app,
config={
"CACHE_TYPE": "RedisClusterCache",
"CACHE_REDIS_PASSWORD": config.REDIS_PASSWORD,
"CACHE_REDIS_CLUSTER": "host:port", # aws-hosted cluster
"CACHE_REDIS_DB": 0, # use the db=0
"BUILD_TlS": "yes",
"CACHE_OPTIONS": { # Even tried passing the password as extra option
"-a":config.REDIS_PASSWORD,
}
},
)
For cluster mode disabled, you want to set
CACHE_TYPE
toRedisCache
instead ofRedisClusterCache
.When you set
RedisClusterCache
the client attempts to discover the nodes in the cluster and it fails as theCLUSTER NODES
command is not available. You should see an error similar toCluster mode is not enabled on this node
.