我尝试过使用以下代码对redis服务器进行健康检查:
Jedis jedis = null;
try {
jedis = new Jedis(System.getenv(REDIS_END_POINT), Integer.parseInt(System.getenv(REDIS_PORT)),true);
System.out.println(jedis);
if (jedis.ping().equalsIgnoreCase(PONG)) {
responseFlag = true;
LOGGER.info("Redis Connection established");
} else {
responseFlag = false;
LOGGER.error("The HealthCheck for this service returned: " + jedis.ping());
}
} catch (Exception exception) {
responseFlag = false;
LOGGER.error("Exception occurred " + exception.getMessage());
}
此响应标志值是方法的返回值。但是,当我尝试在main方法中测试代码时,它抛出异常 javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
.
注意:在我的配置文件中,我设置了必要的环境变量。
暂无答案!
目前还没有任何答案,快来回答吧!