diff --git a/camellia-redis-proxy/camellia-redis-proxy-bootstrap/src/main/resources/application.yml b/camellia-redis-proxy/camellia-redis-proxy-bootstrap/src/main/resources/application.yml index 4e7aba095..6ceff245f 100644 --- a/camellia-redis-proxy/camellia-redis-proxy-bootstrap/src/main/resources/application.yml +++ b/camellia-redis-proxy/camellia-redis-proxy-bootstrap/src/main/resources/application.yml @@ -18,8 +18,11 @@ camellia-redis-proxy: - monitorPlugin - bigKeyPlugin - hotKeyPlugin -# config: #you can get this config from ProxyDynamicConf.java, priority less than camellia-redis-proxy.properties -# "k": v + ##you can get this config from ProxyDynamicConf.java, priority less than camellia-redis-proxy.properties + ##you can configure dynamic.conf.file.name here to replace camellia-redis-proxy.properties +# config: +# "dynamic.conf.file.name": "xxx.properties" +# "xxx": "yyy" transpond: type: local #local、remote、custom local: diff --git a/camellia-redis-proxy/camellia-redis-proxy-core/src/main/java/com/netease/nim/camellia/redis/proxy/conf/ProxyDynamicConf.java b/camellia-redis-proxy/camellia-redis-proxy-core/src/main/java/com/netease/nim/camellia/redis/proxy/conf/ProxyDynamicConf.java index 54e596776..ac959e595 100644 --- a/camellia-redis-proxy/camellia-redis-proxy-core/src/main/java/com/netease/nim/camellia/redis/proxy/conf/ProxyDynamicConf.java +++ b/camellia-redis-proxy/camellia-redis-proxy-core/src/main/java/com/netease/nim/camellia/redis/proxy/conf/ProxyDynamicConf.java @@ -23,7 +23,7 @@ public class ProxyDynamicConf { private static Map conf = new HashMap<>(); private static final Set callbackSet = new HashSet<>(); - private static final String fileName = "camellia-redis-proxy.properties"; + private static String fileName = "camellia-redis-proxy.properties"; private static final ConcurrentHashMap intCache = new ConcurrentHashMap<>(); private static final ConcurrentHashMap longCache = new ConcurrentHashMap<>(); @@ -44,6 +44,11 @@ public class ProxyDynamicConf { public static void updateInitConf(Map initConf) { if (initConf != null && !initConf.isEmpty()) { ProxyDynamicConf.initConf.putAll(initConf); + String fileName = initConf.get("dynamic.conf.file.name"); + if (fileName != null) { + ProxyDynamicConf.fileName = fileName; + logger.info("ProxyDynamicConf use {} instead of camellia-redis-proxy.properties", fileName); + } reload(); } } diff --git a/camellia-samples/camellia-redis-proxy-samples/src/main/resources/application.yml b/camellia-samples/camellia-redis-proxy-samples/src/main/resources/application.yml index 91cadda5f..aac4cd937 100644 --- a/camellia-samples/camellia-redis-proxy-samples/src/main/resources/application.yml +++ b/camellia-samples/camellia-redis-proxy-samples/src/main/resources/application.yml @@ -18,8 +18,11 @@ camellia-redis-proxy: - monitorPlugin - bigKeyPlugin - hotKeyPlugin - # config: #you can get this config from ProxyDynamicConf.java, priority less than camellia-redis-proxy.properties - # "k": v + ##you can get this config from ProxyDynamicConf.java, priority less than camellia-redis-proxy.properties + ##you can configure dynamic.conf.file.name here to replace camellia-redis-proxy.properties +# config: +# "dynamic.conf.file.name": "xxx.properties" +# "xxx": "yyy" transpond: type: local #local、remote、custom local: diff --git a/update-en.md b/update-en.md index 15ae0ac5e..c72a31a03 100644 --- a/update-en.md +++ b/update-en.md @@ -15,6 +15,7 @@ * camellia-hbase support setting userName、password、tag of aliyun-lindorm in url * camellia-redis-proxy optimize the failover logic of redis-cluster-slaves and redis-sentinel-slaves * camellia-redis-proxy optimize the failover logic of redis-proxies and redis-proxies-discovery +* camellia-redis-proxy support configure dynamic.conf.file.name in application.yml to replace camellia-redis-proxy.properties ### update * camellia-redis-proxy rename core upstream service diff --git a/update-zh.md b/update-zh.md index cccfff843..e547ee24c 100644 --- a/update-zh.md +++ b/update-zh.md @@ -15,6 +15,7 @@ * camellia-hbase支持url中设置userName和password以及aliyun-lindorm的标记 * camellia-redis-proxy优化了redis-cluster-slaves和redis-sentinel-slaves两种resource在有节点宕机下的failover逻辑 * camellia-redis-proxy优化了redis-proxies和redis-proxies-discovery两种resource在有节点宕机下的failover逻辑 +* camellia-redis-proxy支持在application.yml中配置dynamic.conf.file.name来代替camellia-redis-proxy.properties文件 ### 更新 * camellia-redis-proxy相关核心类进行了重命名(upstream部分)