栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

spring cloud-BUS总线配置

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

spring cloud-BUS总线配置

 

目录

配置中心

pom

yml

客户端

pom

yml


bus一般配合config使用,以下都是在config基础上添加,pom中bus配合actuator使用

配置中心

pom
        
            org.springframework.cloud
            spring-cloud-starter-bus-amqp
        

yml
server:
  port: 3344
spring:
  application:
    name: cloud-config-center
  cloud:
    config:
      server:
        git:
          uri: https://github.com/用户名/springcloud-config.git #github仓库名字,对应哪个地址
          search-paths: #搜索目录
            - springcloud-config  #哪个仓库
          force-pull: true
          username: 用户
          password: 密码
      label: mian   #哪个分支
  rabbitmq:
    host: localhost
    port: 5672
    username: guest
    password: guest
eureka:
  client:
    service-url:
      defaultZone:  http://localhost:7001/eureka
management: #暴露监控端点
  endpoints:
    web:
      exposure:
        include: "bus-refresh"

客户端 pom
        
            org.springframework.cloud
            spring-cloud-starter-bus-amqp
        
yml
server:
  port: 3355
spring:
  application:
    name: config-client
  cloud:
    config: #客户端配置
      label: master #分支名称
      name: config  #配置文件名称
      profile: dev  #读取的后缀的名称 结合起来就是读取 master/config-dev.yml的配置文件
      uri: http://localhost:3344  #配置中心地址

  rabbitmq:
    host: localhost
    port: 5672
    username: guest
    password: guest
eureka:
  client:
    service-url:
      defaultZone:  http://localhost:7001/eureka
management: #暴露监控端点
  endpoints:
    web:
      exposure:
        include: "*"

修改github中的配置文件后执行

1、全部通知

curl -X POST "http://localhost:3344/actuator/bus-refresh"

2、指定客户端通知

curl -X POST "http://localhost:3344/actuator/bus-refresh/config-client:3355"

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/931171.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号