Skip to content

Conversation

@aboganas
Copy link

Class StrictRedisCluster was renamed to RedisCluster. All usages of this class must be updated.

Class StrictRedisCluster was renamed to RedisCluster. All usages of this class must be updated.
Copy link

@daedamee daedamee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's Right. in redis 3.5.0, we have to use RedisCluster instead of StrictRedisCluster.
I modifid this and solved import error issues.
please pull this request.

@hugoprudente
Copy link

Hi is there any update on this PR?

@daedamee thanks for the update! I'm running it locally here to solve my issue.

@hugoprudente
Copy link

hugoprudente commented May 15, 2020

I have tested more the PR made by @daedamee, and as I use password redis, I got to a new issue.

Due to the change from StrictRedisCluster to RedisCluster and preservation of password=None on the __init__ it causes the value used by the CACHE_OPTIONS that is carried by the kargs to be lost.

Old

            self._client = StrictRedisCluster(host=host,
                                              port=port,
                                              password=password,
                                              **kwargs)

New

            self._client = RedisCluster(startup_nodes=startup_nodes,
                                              **kwargs)

init

    def __init__(self, host='localhost', port=6379, password=None,
                 default_timeout=300, key_prefix=None,startup_nodes=[{"host": "127.0.0.1", "port": "6379"}], **kwargs):

log

Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.6/site-packages/rediscluster/nodemanager.py", line 161, in initialize
    cluster_slots = r.execute_command("cluster", "slots")
  File "/home/ubuntu/.local/lib/python3.6/site-packages/redis/client.py", line 756, in execute_command
    return self.parse_response(connection, command_name, **options)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/redis/client.py", line 769, in parse_response
    response = connection.read_response()
  File "/home/ubuntu/.local/lib/python3.6/site-packages/redis/connection.py", line 638, in read_response
    raise response
redis.exceptions.ResponseError: NOAUTH Authentication required.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "serve.py", line 11, in <module>
    app = create_app()
  File "/home/ubuntu/environment/CaptureTheFlagService/CTFd/__init__.py", line 212, in create_app
    cache.init_app(app)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/flask_caching/__init__.py", line 198, in init_app
    self._set_cache(app, config)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/flask_caching/__init__.py", line 224, in _set_cache
    cache_options)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/flask_cache_redis_cluster/__init__.py", line 21, in rediscluster
    return RedisClusterCache(*args, **kwargs)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/flask_cache_redis_cluster/__init__.py", line 50, in __init__
    **kwargs)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/rediscluster/client.py", line 216, in __init__
    **kwargs
  File "/home/ubuntu/.local/lib/python3.6/site-packages/rediscluster/connection.py", line 146, in __init__
    self.nodes.initialize()
  File "/home/ubuntu/.local/lib/python3.6/site-packages/rediscluster/nodemanager.py", line 171, in initialize
    raise RedisClusterException("ERROR sending 'cluster slots' command to redis server: {0}".format(node))

As quick fix I have cleaned the init to match to the new RedisCluster method, is there any good recommendation, or ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants