[英]Flask-Caching not connecting to redis cluster in disabled cluster mode (aws hosted)
我正在使用燒瓶緩存庫在我的 flask 應用程序中使用緩存。 我在這里關注文檔: https://flask-caching.readthedocs.io/en/latest/#redisclustercache
在本地嘗試在啟用集群模式的集群上進行連接時,它可以正常工作,但是該應用程序卡住了,如下所示:
當我嘗試將它連接到 elasticache(禁用集群模式)中的托管集群時 - 我正在使用 --tls auth。
這是配置的樣子:
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,
}
},
)
對於禁用的集群模式,您希望將CACHE_TYPE
設置為RedisCache
而不是RedisClusterCache
。
當您設置RedisClusterCache
時,客戶端會嘗試發現集群中的節點,但由於CLUSTER NODES
命令不可用而失敗。 您應該會看到類似於Cluster mode is not enabled on this node
的錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.