File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -427,6 +427,18 @@ def cluster_slots(self, target_nodes=None):
427
427
"""
428
428
return self .execute_command ("CLUSTER SLOTS" , target_nodes = target_nodes )
429
429
430
+ def cluster_links (self , target_node ):
431
+ """
432
+ Each node in a Redis Cluster maintains a pair of long-lived TCP link with each
433
+ peer in the cluster: One for sending outbound messages towards the peer and one
434
+ for receiving inbound messages from the peer.
435
+
436
+ This command outputs information of all such peer links as an array.
437
+
438
+ For more information check https://redis.io/commands/cluster-links
439
+ """
440
+ return self .execute_command ("CLUSTER LINKS" , target_nodes = target_node )
441
+
430
442
def readonly (self , target_nodes = None ):
431
443
"""
432
444
Enables read queries.
Original file line number Diff line number Diff line change @@ -1029,6 +1029,17 @@ def test_cluster_replicas(self, r):
1029
1029
== "r4xfga22229cf3c652b6fca0d09ff69f3e0d4d"
1030
1030
)
1031
1031
1032
+ @skip_if_server_version_lt ("7.0.0" )
1033
+ def test_cluster_links (self , r ):
1034
+ node = r .get_random_node ()
1035
+ res = r .cluster_links (node )
1036
+ links_to = sum (x .count ("to" ) for x in res )
1037
+ links_for = sum (x .count ("from" ) for x in res )
1038
+ assert links_to == links_for
1039
+ print (res )
1040
+ for i in range (0 , len (res ) - 1 , 2 ):
1041
+ assert res [i ][3 ] == res [i + 1 ][3 ]
1042
+
1032
1043
def test_readonly (self ):
1033
1044
r = get_mocked_redis_client (host = default_host , port = default_port )
1034
1045
mock_all_nodes_resp (r , "OK" )
You can’t perform that action at this time.
0 commit comments