title: Spring Boot actuator: Why is the Health status of Redis cluster not correct?
body: <p>I have a spring boot project with redis cluster configuration using Jedis. The config files are as follows:</p>
  
  <p>application.yml file:</p>
  
  <p><a href="https://i.stack.imgur.com/7nblq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7nblq.png" alt="enter image description here"></a></p>
  
  <p>RedisClusterConfig.java file:</p>
  
  <pre><code>@Configuration
  </code></pre>
  
  <p>public class RedisClusterConfig {</p>
  
  <pre><code>private final Logger logger = LoggerFactory.getLogger(this.getClass());
  
  @Value("${redis.cluster.host1}") private String HOST1;
  @Value("${redis.cluster.port1}") private Integer PORT1;
  
  @Value("${redis.cluster.host2}") private String HOST2;
  @Value("${redis.cluster.port2}") private Integer PORT2;
  
  @Value("${redis.cluster.host3}") private String HOST3;
  @Value("${redis.cluster.port3}") private Integer PORT3;
  
  @Value("${redis.cluster.host4}") private String HOST4;
  @Value("${redis.cluster.port4}") private Integer PORT4;
  
  @Value("${redis.cluster.host5}") private String HOST5;
  @Value("${redis.cluster.port5}") private Integer PORT5;
  
  @Value("${redis.cluster.host6}") private String HOST6;
  @Value("${redis.cluster.port6}") private Integer PORT6;
  
  @Bean
  public JedisCluster jedisCluster() {
      Set&lt;HostAndPort&gt; jedisClusterNodes = new HashSet&lt;HostAndPort&gt;();
      //Jedis Cluster will attempt to discover cluster nodes automatically
      jedisClusterNodes.add(new HostAndPort(HOST1, PORT1));
      jedisClusterNodes.add(new HostAndPort(HOST2, PORT2));
      jedisClusterNodes.add(new HostAndPort(HOST3, PORT3));
  
      if(StringUtils.isNotBlank(HOST4)){
          jedisClusterNodes.add(new HostAndPort(HOST4, PORT4));
      }else{
          logger.warn("jedis cluster HOST4 not configured.");
      }
  
      if(StringUtils.isNotBlank(HOST5)){
          jedisClusterNodes.add(new HostAndPort(HOST5, PORT5));
      }else{
          logger.warn("jedis cluster HOST5 not configured.");
      }
  
      if(StringUtils.isNotBlank(HOST6)){
          jedisClusterNodes.add(new HostAndPort(HOST6, PORT6));
      }else{
          logger.warn("jedis cluster HOST6 not configured.");
      }
      JedisCluster jc = new JedisCluster(jedisClusterNodes, new JedisPoolConfig());
      return jc;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>With this config, everything works fine. I can write/read data to/from the redis cluster. But when I access <a href="http://localhost:64001/health" rel="nofollow noreferrer">http://localhost:64001/health</a> to get the actuator health status, it returns the result as follows:</p>
  
  <p>{"status":"DOWN","diskSpace":{"status":"UP","total":120031539200,"free":33381117952,"threshold":10485760},"redis":{"status":"DOWN","error":"org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool"},"mongo":{"status":"UP","version":"3.2.3"},"db":{"status":"UP","dataSource1":{"status":"UP","database":"MySQL","hello":1},"dataSource2":{"status":"UP","database":"MySQL","hello":1},"dataSource3":{"status":"UP","database":"MySQL","hello":1}}}</p>
  
  <p>We can see the error hints about Jedis.</p>
  
  <p>BTW, the related dependencies in pom.xml:</p>
  
  <pre><code>&lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;1.4.0.RELEASE&lt;/version&gt;
  &lt;/parent&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-redis&lt;/artifactId&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>Is there any thing I may miss to get the /health status back to "UP"? Thanks!</p>
  
  <p>More info:
  I traced the startup and found that the RedisHealthIndicator passed a wrong factory with host=localhost and port=6379, which should be the configured cluster hosts and ports?</p>
  
  <pre><code>public RedisHealthIndicator(RedisConnectionFactory connectionFactory) {
      Assert.notNull(connectionFactory, "ConnectionFactory must not be null");
      this.redisConnectionFactory = connectionFactory;
  }
  </code></pre>