瀏覽代碼

nacos持久化

master
wangjx 3 年之前
父節點
當前提交
4a11ee4147
共有 4 個文件被更改,包括 6 次插入5 次删除
  1. +1
    -1
      Dockerfile
  2. +2
    -1
      sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/nacos/FlowRuleNacosProvider.java
  3. +2
    -2
      sentinel-dashboard/src/main/resources/bootstrap-test.yaml
  4. +1
    -1
      sentinel-dashboard/src/main/resources/bootstrap.yaml

+ 1
- 1
Dockerfile 查看文件

@@ -13,4 +13,4 @@ RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /et
#EXPOSE 8098
#ENTRYPOINT java $JAVA_OPTS -jar /core.jar --spring.profiles.active=$active

ENTRYPOINT java $JAVA_OPTS -Dserver.port=7777 -Dcsp.sentinel.dashboard.server=$IP:7777 -Dproject.name=sentinel-dashboard -Dsentinel.dashboard.auth.username=sentinel -Dsentinel.dashboard.auth.password=sentinel -jar /app.jar --spring.profiles.active=$active
ENTRYPOINT java $JAVA_OPTS -Dserver.port=8098 -Dcsp.sentinel.dashboard.server=$IP:8098 -Dproject.name=sentinel-dashboard -Dsentinel.dashboard.auth.username=telpo -Dsentinel.dashboard.auth.password=telpo#1234 -jar /app.jar --spring.profiles.active=$active

+ 2
- 1
sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/nacos/FlowRuleNacosProvider.java 查看文件

@@ -20,6 +20,7 @@ import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity;
import com.alibaba.csp.sentinel.dashboard.rule.DynamicRuleProvider;
import com.alibaba.csp.sentinel.datasource.Converter;
import com.alibaba.nacos.api.config.ConfigService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -51,7 +52,7 @@ public class FlowRuleNacosProvider implements DynamicRuleProvider<List<FlowRuleE
String dataId=new StringBuilder(appName).append(NacosConstants.DATA_ID_POSTFIX).toString();
String rules = nacosConfiguration.getConfig(dataId,nacosProperties.getGroupId(),3000);
//log.info("pull FlowRule from nacos Config:"+rules);
if (rules.isEmpty()) {
if (StringUtils.isEmpty(rules)) {
return new ArrayList<>();
} else {
return converter.convert(rules);


+ 2
- 2
sentinel-dashboard/src/main/resources/bootstrap-test.yaml 查看文件

@@ -9,8 +9,8 @@ spring:
file-extension: yaml
sentinel:
transport:
dashboard: 172.19.192.44:7777
port: 8719
dashboard: 172.19.192.44:8098
port: 8098
datasource:
- nacos:
server-addr: 172.19.42.44:8848


+ 1
- 1
sentinel-dashboard/src/main/resources/bootstrap.yaml 查看文件

@@ -9,7 +9,7 @@ spring:
file-extension: yaml
sentinel:
transport:
dashboard: 172.19.192.44:7777
dashboard: 172.19.192.44:8098
datasource:
- nacos:
server-addr: 172.19.42.44:8848


Loading…
取消
儲存