-
Notifications
You must be signed in to change notification settings - Fork 103
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
No Support for Sentinels #64
Comments
@vipinvkmenon Can you give an example of the messages or exceptions given when the application fails to start? An example of the This is likely caused by the fact that Spring Cloud Connectors (which Java buildpack's auto-reconfiguration uses) does not currently support Redis sentinels. See spring-cloud/spring-cloud-connectors#185. |
I’d agree that this is the root cause. |
@vipinvkmenon For a "simple" connection to your HA redis service, the following configuration should do the job: @EnableConfigurationProperties(RedisConnectionCloudProperties.class)
public static class RedisConnectionCloudConfiguration extends AbstractCloudConfig {
@Bean
public RedisConnectionFactory redisConnectionFactory(RedisConnectionCloudProperties properties) {
RedisConnectionFactory connectionFactory = connectionFactory().redisConnectionFactory(properties.getServiceId());
if(connectionFactory instanceof JedisConnectionFactory) {
JedisPoolConfig poolConfig = new JedisPoolConfig();
if(properties.getConnections() != null) {
poolConfig.setMaxTotal(properties.getConnections());
poolConfig.setMaxIdle(properties.getConnections());
}
poolConfig.setTestOnBorrow(true); // validate and drop closed connections
((JedisConnectionFactory)connectionFactory).setPoolConfig(poolConfig);
}
return connectionFactory;
}
}
@Validated @ConfigurationProperties(prefix = "yourapp.redis")
public static class RedisConnectionCloudProperties {
@NotNull private String serviceId;
private Integer connections;
public String getServiceId() { return serviceId; }
public void setServiceId(String serviceId) { this.serviceId = serviceId; }
public Integer getConnections() { return connections; }
public void setConnections(Integer connections) { this.connections = connections; }
} Nevertheless, it would be very helpful if you could add an example of your VCAP_SERVICES environment variable to spring-cloud/spring-cloud-connectors#185. |
Since there’s been no response on this issue from the original in a couple of weeks, I’m going to close it. If you’d like to see it re-opened, please comment on the issue and I’ll reopen it. |
When I deploy a Spring Application on CF. the java buildpack tries to reconfigure spring to work with its 'cloud' profile.
https://github.com/cloudfoundry/java-buildpack-auto-reconfiguration
As a result, the application picks up this configuration/profile.Due to this, the application fails when a Redis Multinode/HA instance is used.
I feel this is something to do with the way the HA/ Multinode Redis Service is deployed/ provided.
Our fix for the timebeing was to disable autoconfiguration through the manifest file.
JBP_CONFIG_SPRING_AUTO_RECONFIGURATION: '{enabled: false}'
Does Spring cloud not support Sentinels. Or is this due to some other issue?
The text was updated successfully, but these errors were encountered: