zoukankan      html  css  js  c++  java
  • Eureka 注册中心 和 Config中心 配置

    Eureka config:

    1 import spring-cloud-starter-netflix-eureka-client jar in pom.xml

    <dependency>
       <groupId>org.springframework.cloud</groupId>
       <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    </dependency>

    2 add @EnableDiscoveryClient in startup class “application.java”

    3 add configuration in yml.

    eureka:
    
      client:
    
        service-url:
    
          defaultZone: http://hostname:port/eureka # eureka server

     Config中心:

    1 import spring-cloud-starter-config jar in pom.xml

    <dependency>
    
       <groupId>org.springframework.cloud</groupId>
    
       <artifactId>spring-cloud-starter-config</artifactId>
    
    </dependency>

    2 add configuration in bootstrap.yml

    spring:
    
      application:
    
        name: apexa-fx-data-grabber
    
      cloud:
    
        config:
    
          uri: http://hostname:port/ # config server
    
          name: fx-cient # application name

    3 add configuration files in git repo assigned by config server 

    4 do not need to restart server to change configuration

    First, add spring-boot-starter-actuator jar in pom.xml.

    <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>

    Then, add configuration in bootstrap.yml

    management:
    
      endpoints:
    
        web:
    
          exposure:
    
            include: refresh

    and add Annotate Your configuration beans and beans where annotation Value is used with annotation @RefreshScope

    after changing configuration, need to post http://[instance host]:[port]/actuator/refresh to valid it.

  • 相关阅读:
    YOLO V5
    YOLO系列(单阶段目标检测)
    优化算法
    算法总结
    图像分类算法
    ResNet网络(里程碑)
    GoogleNet网络(纵横交错)
    VGGNet网络(走向深度)
    AlexNet网络(开山之作)
    案例
  • 原文地址:https://www.cnblogs.com/Jenny22/p/11341867.html
Copyright © 2011-2022 走看看