Redis 7+ in cluster mode supports a configuration value called cluster-announce-hostname, which adds hostname information to the CLUSTER NODES output. For example:
3b9fb3bd2981548b5deaa3a2967f27cce2af4bf0 10.109.3.113:6379@16379,redis-5.redis.default.svc.cluster.local slave 7da39a3358109a6c840e3ba9679a35d971528563 0 1777227350000 2 connected
69e0e80e5f81eb75fc4818d4e046057384c45a18 10.109.3.140:6379@16379,redis-4.redis.default.svc.cluster.local slave c69c24b04b9b7d0d3c5e9b955076f247ae775ae1 0 1777227351518 1 connected
c69c24b04b9b7d0d3c5e9b955076f247ae775ae1 10.109.3.52:6379@16379,redis-0.redis.default.svc.cluster.local myself,master - 0 0 1 connected 0-5460
e3e961ad340db10941c0d453ff695912945e3e92 10.109.3.193:6379@16379,redis-2.redis.default.svc.cluster.local master - 0 1777227352124 3 connected 10923-16383
4559a7b053bc5d85db6921c548c8cc598c017543 10.109.3.69:6379@16379,redis-3.redis.default.svc.cluster.local slave e3e961ad340db10941c0d453ff695912945e3e92 0 1777227350126 3 connected
7da39a3358109a6c840e3ba9679a35d971528563 10.109.3.242:6379@16379,redis-1.redis.default.svc.cluster.local master - 0 1777227351117 2 connected 5461-10922
The way we parse the output, we assume that everything after the @ is the cluster port, but now there's a fourth component to that which fails with an error like Unhandled exception: Invalid Int32: "16379,redis-0.redis.default.svc.cluster.local" (ArgumentError). We should ideally grab the hostname to use, but at the very least we shouldn't fail to parse.
Redis 7+ in cluster mode supports a configuration value called
cluster-announce-hostname, which adds hostname information to theCLUSTER NODESoutput. For example:The way we parse the output, we assume that everything after the
@is the cluster port, but now there's a fourth component to that which fails with an error likeUnhandled exception: Invalid Int32: "16379,redis-0.redis.default.svc.cluster.local" (ArgumentError). We should ideally grab the hostname to use, but at the very least we shouldn't fail to parse.