-
Notifications
You must be signed in to change notification settings - Fork 41.2k
RedisReactiveHealthIndicator should provide cluster details in cluster mode #21514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@mp911de What's the equivalent of |
Redis Cluster commands ( |
Thanks, @mp911de. Will that sneak into a Neumann SR or be a new feature in Ockham? If it's the latter, is there anything that we can do in the meantime? |
I need to discuss this with the team. Introducing new API in service releases is always subject to cause a certain degree of confusion. There's currently no workaround. |
I've just hit this issue since upgrading to 2.3.0.RELEASE and have had to temporarily disable the Redis health endpoint, which isn't ideal ( As a workaround until the change is implemented in spring-data-redis, would falling back to the non-reactive RedisHealthIndicator work? Something like:
Appreciate any info you can provide - thanks! |
With thanks to @mp911de and the Data team, they've agreed to add the missing cluster-related APIs in a Spring Data Neumann service release. I believe it's currently slated for inclusion in Neumann-SR1 so, all being well, we should be able to fix this in Boot 2.3.1. |
Waiting for Boot version 2.3.1, my workaround is:
private Health up(Health.Builder builder, Properties info, ReactiveRedisConnection connection) {
if (connection instanceof ReactiveRedisClusterConnection) {
List<Map<String, String>> details = getDetails(info);
if (details.isEmpty()) {
return builder.outOfService()
.build();
} else {
return builder.up()
.withDetail("nodes", details)
.build();
}
} else {
return builder.up()
.withDetail("version", info.getProperty("redis_version"))
.build();
}
}
private List<Map<String, String>> getDetails(Properties info) {
return info.keySet().stream()
.map(String.class::cast)
.map(k -> k.substring(0, k.lastIndexOf(".")))
.distinct()
.sorted()
.map(node -> Map.of(
"node", node,
"redis_version", info.getProperty(node + ".redis_version"),
"role", info.getProperty(node + ".role"),
"uptime_in_days", info.getProperty(node + ".uptime_in_days")
)
)
.collect(Collectors.toList());
} Now my health check is UP. |
We've experienced this same thing going from |
@christopher-nash As far as I can tell, nothing has changed in this area between 2.2.7 and 2.2.8. If something was working for you in 2.2.7 and stopped working in 2.2.8, I don't think a fix for this issue will help. If you can reproduce the problem that you saw, please open a new issue with a minimal sample that works with 2.2.7 and fails with 2.2.8. |
This is no longer blocked as the changes have been merged into Spring Data Neumann and Ockham (2020.0.0). |
@wilkinsona It looks like the properties returned in the cluster info in 2.2.8 are prefixed with the cluster node IP and port (e.g. In 2.2.7.RELEASE, the properties do not have the ip and port prefix. |
I can't explain that. The only Redis-related change in 2.2.8 was an upgrade to Spring Data Moore-SR8. As I said above, if you can reproduce the problem that you saw, please open a new issue with a minimal sample that works with 2.2.7 and fails with 2.2.8. |
Spring Data Redis returns in version 2.2.8 a different connection type which reports Redis stats prefixed with host and port. See #22061 for further reference. |
After some discussion, we've decided that we should not change the health response in a Spring Boot 2.3 patch release, but only change it in the 2.4 release. Boot 2.3 and earlier will continue to provide the |
RedisReactiveHealthIndicator health is down with cluster mode.
Check different property if
ReactiveRedisClusterConnection
The text was updated successfully, but these errors were encountered: