Я настроил кластер redis () на сервере.Когда я попытался подключиться, проблема показала, как показано ниже:
Traceback (most recent call last):
File "test.py", line 5, in <module>
rc = StrictRedisCluster(startup_nodes=startup_nodes, decode_responses=True)
File "C:\Python\Python27\lib\site-packages\rediscluster\client.py", line 159, in __init__
**kwargs
File "C:\Python\Python27\lib\site-packages\rediscluster\connection.py", line 83, in __init__
self.nodes.initialize()
File "C:\Python\Python27\lib\site-packages\rediscluster\nodemanager.py", line 179, in initialize
raise RedisClusterException("ERROR sending 'cluster slots' command to redis server: {0}".format(node))
rediscluster.exceptions.RedisClusterException: ERROR sending 'cluster slots' command to redis server: {'host': myip, 'port': '9001'}
мой код python:
from rediscluster import StrictRedisCluster
startup_nodes = [{"host":myip,"port":"9001"}]
rc = StrictRedisCluster(startup_nodes=startup_nodes, decode_responses=True)
rc.set("foo", "bar")
print(rc.get("foo"))
env: python == 2.7 redis == 4.0.9