SpringCloud 尚硅谷 周阳教程学习 -- 第三部分中级 03 -- Config & Bus

目录

https://www.bilibili.com/video/BV18E411x7eT?p=74

P74_Config分布式配置中心介绍 10:50
P75_Config配置总控中心搭建 15:20
P76_Config客户端配置与测试 16:47
P77_Config动态刷新之手动版 12:50

P78_Bus消息总线是什么 07:55
P79_Bus之RabbitMQ环境配置 03:56
P80_Bus动态刷新全局广播的设计思想和选型 07:48
P81_Bus动态刷新全局广播配置实现 14:13
P82_Bus动态刷新定点通知 05:41

在这里插入图片描述

P74_Config分布式配置中心介绍

spring-cloud-config 官网
https://cloud.spring.io/spring-cloud-static/spring-cloud-config/2.2.1.RELEASE/reference/html/

在这里插入图片描述

P75_Config配置总控中心搭建

hosts 配置增加
127.0.0.1 config3344.com

启动eureka 注册中心
http://localhost:7001/

注意示例是 master 分支 ,我的是main 分支
注意示例是 config-3344 ,我的是 config3344

方式一
http://config3344.com:3344/main/config-dev.yml
http://config3344.com:3344/main/config-test.yml
http://config3344.com:3344/main/config-prod.yml

方式二 :
http://config3344.com:3344/config/dev/main
http://config3344.com:3344/config/test/main
http://config3344.com:3344/config/prod/main

P76_Config客户端配置与测试

在这里插入图片描述

P77_Config动态刷新之手动版

http://eureka7001.com:7001

http://config3344.com:3344/main/config-dev.yml

http://localhost:3355/configInfo

更改 https://github.com/wei198621/spingcloud-config/blob/main/config-dev.yml 中的内容,
http://config3344.com:3344/main/config-dev.yml
会变化
但是
http://localhost:3355/configInfo
没有变化

按照如下操作 ,
操作1 :
#暴露监控端点
management:
endpoints:
web:
exposure:
include: “*”
操作2: 3355 controller 上面增加
@RefreshScope

操作3:
curl -X POST “http://localhost:3355/actuator/refresh”
在这里插入图片描述
不用重启,再次执行 ,
http://localhost:3355/configInfo
有变化了,

P78_Bus消息总线是什么

P79_Bus之RabbitMQ环境配置

在这里插入图片描述https://www.erlang.org/downloads
https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.3/rabbitmq-server-3.8.3.exe
rabbitmq-plugins enable rabbitmq_management
在这里插入图片描述

http://localhost:15672
输入账号并登录 guest guest

在这里插入图片描述

P80_Bus动态刷新全局广播的设计思想和选型 在这里插入图片描述在这里插入图片描述

P81_Bus动态刷新全局广播配置实现

在这里插入图片描述在这里插入图片描述

http://eureka7001.com:7001
http://config3344.com:3344/main/config-dev.yml
http://localhost:3355/configInfo
http://localhost:3366/configInfo
修改 https://github.com/wei198621/spingcloud-config/blob/main/config-dev.yml 中的配置文件内容,再次查看上面的数据
发现 3344修改了 3355 3366 没有修改
当执行下面的更新后
curl -X POST “http://localhost:3344/actuator/bus-refresh”
再次 查看
http://localhost:3355/configInfo
http://localhost:3366/configInfo
已经修改

http://localhost:15672/

在这里插入图片描述

P82_Bus动态刷新定点通知

在这里插入图片描述执行下面语句后 3355 跟着3344变了 3366 没有变

curl -X POST “http://localhost:3344/actuator/bus-refresh/config-client:3355”
在这里插入图片描述在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值