簡體   English   中英

Flask-Caching 在禁用集群模式下未連接到 redis 集群(aws 托管)

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM