Authored by Xu

monitor.redis.yohoops.org 域名链接redis时连接会超时,改用ip

package com.monitor.other.maliciousip.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import redis.clients.jedis.Jedis;
... ... @@ -13,6 +15,10 @@ import redis.clients.jedis.JedisPoolConfig;
*/
@Service
public class RedisReadUtil {
/**
* 日志接口
*/
private Logger logger = LoggerFactory.getLogger(getClass());
/**
* Redis string,里面放ip、ops、百分比
... ... @@ -80,9 +86,14 @@ public class RedisReadUtil {
* @return
*/
public String getIps() {
Jedis jedis = getJedis();
String value = jedis.get(String.format(MALICIOUS_IP, TIME_DIMENSION_MINUTE_KEY));
returnResource(jedis);
String value = null;
try{
Jedis jedis = getJedis();
value = jedis.get(String.format(MALICIOUS_IP, TIME_DIMENSION_MINUTE_KEY));
returnResource(jedis);
}catch(Exception e){
logger.error(" - RedisReadUtil - getIps - error", e);
}
return value;
}
... ... @@ -92,9 +103,14 @@ public class RedisReadUtil {
* @return
*/
public String getIpsBL() {
Jedis jedis = getJedis();
String value = jedis.get(String.format(MALICIOUS_IP_BL, TIME_DIMENSION_MINUTE_KEY));
returnResource(jedis);
String value = null;
try{
Jedis jedis = getJedis();
value = jedis.get(String.format(MALICIOUS_IP_BL, TIME_DIMENSION_MINUTE_KEY));
returnResource(jedis);
}catch(Exception e){
logger.error(" - RedisReadUtil - getIpsBL - error", e);
}
return value;
}
... ... @@ -104,9 +120,14 @@ public class RedisReadUtil {
* @return
*/
public String getIpsCS() {
Jedis jedis = getJedis();
String value = jedis.get(String.format(MALICIOUS_IP_BL, TIME_DIMENSION_MINUTE_KEY));
returnResource(jedis);
String value = null;
try{
Jedis jedis = getJedis();
value = jedis.get(String.format(MALICIOUS_IP_BL, TIME_DIMENSION_MINUTE_KEY));
returnResource(jedis);
}catch(Exception e){
logger.error(" - RedisReadUtil - getIpsBL - error", e);
}
return value;
}
... ... @@ -117,9 +138,14 @@ public class RedisReadUtil {
* @return
*/
public String getDetail(String ip){
Jedis jedis = getJedis();
String value = jedis.get(String.format(MALICIOUS_IP_DETAIL,TIME_DIMENSION_MINUTE_KEY,ip));
returnResource(jedis);
String value = null;
try{
Jedis jedis = getJedis();
value = jedis.get(String.format(MALICIOUS_IP_DETAIL,TIME_DIMENSION_MINUTE_KEY,ip));
returnResource(jedis);
}catch(Exception e){
logger.error(" - RedisReadUtil - getIpsBL - error", e);
}
return value;
}
}
\ No newline at end of file
... ...
... ... @@ -19,7 +19,7 @@ zkAddress=172.31.50.139:2181
search.aws.url=http://internal-search-1492740248.cn-north-1.elb.amazonaws.com.cn/
search.qq.url=http://10.66.4.30/
malicious.ip.redis.host=monitor.redis.yohoops.org
malicious.ip.redis.host=172.31.31.170
malicious.ip.redis.port=6379
malicious.ip.write.qq.host1=10.66.0.3
... ...