1:修改保存maat配置时在阀门处新增service,action,user_region字段
2:添加阀门属性tapRedisDb 3:为相关字段添加注释
This commit is contained in:
@@ -29,6 +29,7 @@ import redis.clients.jedis.exceptions.JedisConnectionException;
|
||||
@Service()
|
||||
public class ConfigJedisServiceimpl implements ConfigRedisService {
|
||||
private static Logger logger = LoggerFactory.getLogger(ConfigJedisServiceimpl.class);
|
||||
private static final int TAPREDISDB = Configurations.getIntProperty("tapRedisDb", 7);
|
||||
|
||||
public boolean saveUnMaatConfig(Map<Integer, List<Map<String, String>>> configMap) {
|
||||
if (configMap != null && configMap.size() > 0) {
|
||||
@@ -671,23 +672,38 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
||||
valStr = valStr.trim().replace("[", "").replace("]", "");
|
||||
String val = map.get(valStr);
|
||||
if (val != null) {
|
||||
if (TAPREDISDB == redisDBIndex && type != 10 && type != 11
|
||||
&& valStr.toLowerCase().equals("op_time")) {// 域配置并且是op_time时在op_time前面添加如下内容
|
||||
Map<String, String[]> map2 = ServiceAndRDBIndexReal.getMaatToValveMap()
|
||||
.get(service);
|
||||
if (map2 != null && map2.size() > 0) {
|
||||
String[] arr = null;
|
||||
if (type == 12) {// IP类
|
||||
arr = map2.get("ipRegion");
|
||||
} else if (type == 13) {// 数值类
|
||||
arr = map2.get("numRegion");
|
||||
} else if (type == 14) {// 字符串类
|
||||
arr = map2.get("strRegion");
|
||||
} else if (type == 15) {// 增强字符串类
|
||||
arr = map2.get("strStrRegion");
|
||||
} else if (type == 16) {// 文件摘要类
|
||||
arr = map2.get("fileDigestRegion");
|
||||
} else if (type == 17) {// 文件摘要类
|
||||
arr = map2.get("fileLikeRegion");
|
||||
} else if (type == 18) {// 文件摘要类
|
||||
arr = map2.get("ipClientRange");
|
||||
}
|
||||
if (arr != null && arr.length > 0) {
|
||||
for (String str : arr) {
|
||||
valBF.append(map.get(str.toLowerCase()) + "\t");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
valBF.append(val);
|
||||
} else {
|
||||
if (type != 10 && type != 11) {// 域配置
|
||||
if (valStr.toLowerCase().equals("service") || valStr.toLowerCase().equals("action")
|
||||
|| valStr.toLowerCase().equals("user_region")) {// 域配置中只有这三个可以为空
|
||||
// 删除前面的\t
|
||||
} else {// 其他不可以为空
|
||||
throw new RuntimeException(
|
||||
"后台错误:未从map中获取到" + valStr + "的值,无法拼接redisValue,请检查数据是否正确");
|
||||
}
|
||||
} else {// 编译配置或分组配置 所有在maat.xml中配置的属性都不可以为空
|
||||
// if (!valStr.toLowerCase().equals("service")&&!
|
||||
// valStr.toLowerCase().equals("action")
|
||||
// &&!valStr.toLowerCase().equals("user_region") &&type==10) {
|
||||
throw new RuntimeException(
|
||||
"后台错误:未从map中获取到" + valStr + "的值,无法拼接redisValue,请检查数据是否正确");
|
||||
}
|
||||
// 所有在maat.xml中配置的属性都不可以为空
|
||||
throw new RuntimeException("后台错误:未从map中获取到" + valStr + "的值,无法拼接redisValue,请检查数据是否正确");
|
||||
}
|
||||
} else if (valStr.equals(" ")) {
|
||||
valBF.append(" ");
|
||||
@@ -786,7 +802,6 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
||||
keyStr = "EFFECTIVE_RULE";
|
||||
}
|
||||
|
||||
|
||||
keyBF.append(keyStr.trim());
|
||||
} else if (!StringUtils.isEmpty(keyStr)
|
||||
&& keyStr.trim().startsWith("[")) {
|
||||
@@ -818,7 +833,6 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
||||
oldKey = maatKey.replace("EFFECTIVE_RULE", "OBSOLETE_RULE");
|
||||
}
|
||||
|
||||
|
||||
if (JedisUtils.exists(oldKey.toString().toUpperCase(),
|
||||
redisDBIndex)) {
|
||||
transaction.rename(oldKey.toString().toUpperCase(),
|
||||
@@ -840,12 +854,14 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
||||
if (isInvalid) {
|
||||
String zset = maatKey.replace("OBSOLETE_RULE:", "DEL,");
|
||||
transaction.zadd("MAAT_UPDATE_STATUS", maatVersion, zset);
|
||||
logger.info("向{}号redis数据库更新了MAAT_UPDATE_STATUS,内容是{},SCORES是{}",
|
||||
logger.info(
|
||||
"向{}号redis数据库更新了MAAT_UPDATE_STATUS,内容是{},SCORES是{}",
|
||||
redisDBIndex, zset.toUpperCase(), maatVersion);
|
||||
} else {
|
||||
String zset = maatKey.replace("EFFECTIVE_RULE:", "ADD,");
|
||||
transaction.zadd("MAAT_UPDATE_STATUS", maatVersion, zset);
|
||||
logger.info("向{}号redis数据库更新了MAAT_UPDATE_STATUS,内容是{},SCORES是{}",
|
||||
logger.info(
|
||||
"向{}号redis数据库更新了MAAT_UPDATE_STATUS,内容是{},SCORES是{}",
|
||||
redisDBIndex, zset.toUpperCase(), maatVersion);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,11 +247,12 @@ digest.gen.tool.path=maat-redis/digest_gen
|
||||
maxRedisDBIndex=16
|
||||
##存放编译,分组,域配置id关系的redis数据库编号
|
||||
idRelaRedisDBIndex=15
|
||||
##阀门配置在redisdb的序号
|
||||
tapRedisDb=7
|
||||
|
||||
|
||||
|
||||
##实时统计(编译配置)数据表达式
|
||||
redisStatisticsReal=[COMPILE_ID];\t;[SERVICE];\t;[ACTION];\t;[CONT_TYPE];\t;[ATTR_TYPE];\t;[CONT_LABEL];\t;[TASK_ID];\t;[AFFAIR_ID];\t;[DO_BLACKLIST];\t;[DO_LOG];\t;[EFFECTIVE_RANGE];\t;[START_TIME];\t;[END_TIME];\t;[USER_REGION];\t;[IS_VALID];\t;[GROUP_NUM];\t;[FATHER_CFG_ID];\t;[OP_TIME]
|
||||
|
||||
##存储实时统计数据的redisdb
|
||||
redisStatisticsRealDBIndex=14
|
||||
#maat测试程序输出日志的文件目录
|
||||
maatTestLogPath=c:/maat/mmat.log
|
||||
|
||||
Reference in New Issue
Block a user