-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Description
Version: Redis-py 4.1.4
Platform: Python 3.9.10 on MacOS BigSur 11.5.2
Description: I have created a RedisCluster client. I want to execute the CLUSTER NODES
command in order to get the node IDs. I have tried using the helper function and the execute_command function directly, but both seem to raise an error.
My code:
rc = redis.cluster.RedisCluster.from_url(f'redis://{user}:{password}@{ip}:{port}/0')
cluster_nodes = rc.get_nodes() # This works and provides the expected output
masters = rc.get_primaries() # This works and provides the expected output
slaves = rc.get_replicas() # This works and provides the expected output
data = rc.cluster_nodes() <-- this fails
# I have also tried data = rc.execute_command('CLUSTER NODES') which resulted in the same issue
There seems to be a problem with how the response callback is parsed (expecting a string and getting an int, maybe?)
The error returned:
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/redis/cluster.py", line 954, in _execute_command
response = redis_node.parse_response(connection, command, **kwargs)
File "/usr/lib/python3.9/site-packages/redis/client.py", line 1198, in parse_response
return self.response_callbacks[command_name](response, **options)
File "/usr/lib/python3.9/site-packages/redis/client.py", line 490, in parse_cluster_nodes
return dict(_parse_node_line(str_if_bytes(node)) for node in response)
File "/usr/lib/python3.9/site-packages/redis/client.py", line 490, in <genexpr>
return dict(_parse_node_line(str_if_bytes(node)) for node in response)
File "/usr/lib/python3.9/site-packages/redis/client.py", line 466, in _parse_node_line
line_items = line.split(" ")
AttributeError: 'int' object has no attribute 'split'
Traceback (most recent call last):
File "//./redis-util.py", line 70, in <module>
display(user, host)
File "//./redis-util.py", line 43, in display
data = rc.cluster_nodes()
File "/usr/lib/python3.9/site-packages/redis/commands/cluster.py", line 313, in cluster_nodes
return self.execute_command("CLUSTER NODES")
File "/usr/lib/python3.9/site-packages/redis/cluster.py", line 909, in execute_command
raise e
File "/usr/lib/python3.9/site-packages/redis/cluster.py", line 899, in execute_command
res[node.name] = self._execute_command(node, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/redis/cluster.py", line 1028, in _execute_command
raise e
File "/usr/lib/python3.9/site-packages/redis/cluster.py", line 954, in _execute_command
response = redis_node.parse_response(connection, command, **kwargs)
File "/usr/lib/python3.9/site-packages/redis/client.py", line 1198, in parse_response
return self.response_callbacks[command_name](response, **options)
File "/usr/lib/python3.9/site-packages/redis/client.py", line 490, in parse_cluster_nodes
return dict(_parse_node_line(str_if_bytes(node)) for node in response)
File "/usr/lib/python3.9/site-packages/redis/client.py", line 490, in <genexpr>
return dict(_parse_node_line(str_if_bytes(node)) for node in response)
File "/usr/lib/python3.9/site-packages/redis/client.py", line 466, in _parse_node_line
line_items = line.split(" ")
AttributeError: 'int' object has no attribute 'split'
Any help would be appreciated!
Metadata
Metadata
Assignees
Labels
No labels