运行状况检查Redis服务器

时间:2020-03-05 07:11:16

标签: java http redis jedis handshake

我尝试使用以下代码对Redis Server进行运行状况检查:

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

注意:在我的配置文件中,我已经设置了必要的环境变量。

0 个答案:

没有答案