繁体   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