use redis-py-cluster unable to connect to redis cluster in python 2.7

161 Views Asked by At

I follow the official documents: https://redis-py-cluster.readthedocs.io/en/master/ The example given is writing code to connect to my Redis cluster, but an error was reported: RedisCluster. exceptions. RedisClusterException: ERROR sending 'config get cluster require full coverage' command to Redis server: {'host ': u'196.2.xx. xx', 'server_ Type ':' slave ',' port ': 8xxxL,' name ':' 196.2.xxx. xx: 8xxx ', the strangest thing is that this IP address is not present in my code

# -*- coding: utf-8 -*-
from rediscluster import RedisCluster
startup_nodes = [
    {"host": "host1", "port": "port1"},
    {"host": "host2", "port": "port2"},
    ...
]
# 构建StrictRedisCluster对象
src = RedisCluster(startup_nodes=startup_nodes, decode_responses=True)
# 获取键为name
name = src.get('20231024')
src.close()
print(name)
0

There are 0 best solutions below