• SpringCloud Config + SpringCloud Bus实时刷新配置的配置


    config-server的配置:

    application.yml:

    spring:
      application:
        name: config-server
      cloud:
        config:
          server:
            git:
              uri: https://gitee.com/xgpxg/spring-cloud-config
              username:   ***
              password:    ***
              search-paths: config/
      kafka:
          bootstrap-servers: ip:port
    eureka:
      client:
        service-url:
          defaultZone: http://localhost:5000/eureka
        healthcheck:
          enabled: true
    server:
      port: 5008
    
    management:
      endpoint:
        health:
          show-details: always
      endpoints:
        web:
          exposure:
            include: bus-refresh
            #注意这里的bus-refresh不能写成"*",否则会导致配置中心请求路径和bus-refresh冲突
    

    config-client配置

    bootstrap.yml

    eureka:
      client:
        service-url:
          defaultZone: http://localhost:5000/eureka
    
    
    spring:
      cloud:
        config:
          discovery:
            service-id: config-server
            enabled: true
          profile: dev
          label: master
          name: appconfig
    

    application.yml

    spring:
      application:
        name: service-a
      kafka:
        bootstrap-servers: ip:port
    
    eureka:
      client:
        service-url:
          defaultZone: http://localhost:5000/eureka
        healthcheck:
          enabled: true
    server:
      port: 5007
    
    management:
      endpoint:
        health:
          show-details: always
      endpoints:
        web:
          exposure:
            include: "*"
    

    application.yml中的配置可以写在bootstrap.yml里,但是需要去掉 healthcheck.enabled=true

    请求路径:http://localhost:5008/actuator/bus-refresh?destination=service-a

    注意是Post请求,否则405

  • 相关阅读:
    访问修饰符的权限。
    字符编码
    3/11 作业
    3/10 作业
    作业 3/9
    流程控制之for循环
    Exception in createBlockOutputStream
    windows上传文件到 linux的hdfs
    win10 配置 hadoop-2.7.2
    hadoop 源码编译
  • 原文地址:https://www.cnblogs.com/cnsec/p/13286630.html
Copyright © 2020-2023  润新知