参考链接 https://www.bilibili.com/video/BV18E411x7eT
- 构建module
- 修改pom
- 修改yml配置
- 修改主启动类
- 编写业务
https://github.com/spotify/docker-maven-plugin https://blog.csdn.net/a704397849/article/details/99656703 跨主机push镜像需要每个机器上都配置 "insecure-registries": [ "repos-ip:5000" ] 查看镜像及版本 http://repos-ip:5000/v2/_catalog http://repos-ip:5000/v2/cloud_eureka_7002/tags/list
org.springframework.boot spring-boot-maven-plugin com.tonlp.springcloud.Eureka7002 repackage需要管理员权限记事本 or 另存为
consul与服务不在同一网络时 http://ip:8500/v1/agent/checks
- RestTemplate + Ribbon调用
- OpenFeign + Ribbon 调用
运行异常、服务超时、服务熔断触发、线程池/信号量满了
客户端开启的话、 feign.hystrix.enable=true @EnableHystrix @HystrixCommand
类级别通用配置 @DefaultProperties(defaultFallback = "defaultOrderActionHandle") defaultOrderActionHandle方法不带参数 @HystrixCommand
一般通过Feign调用微服务时做统一处理 @FeignClient(value = "HYSTRIX-PAYMENT-SERVICE", fallback = HystrixPaymentClientFallback.class) HystrixPaymentClientFallback实现Feign客户端接口HystrixPaymentClient
被监控服务需配置 management: endpoints: web: exposure: include: hystrix.stream 监控服务9001/hystrix页面 输入http://localhost:8001/actuator/hystrix.stream即可查看监控
动态配置 spring.cloud.gateway.discovery.locator.enabled: true uri: lb:CLOUD-PAYMENT-SERVICE
/{label}/{name}-{profiles}.yml eg: localhost:3344/master/springcloud-config-dev.yml /{name}-{profiles}.yml eg: localhost:3344/springcloud-config-dev.yml /{name}/{profiles}/{label} eg: localhost:3344/springcloud-config/dev/master label: 分支 name: 服务名 profiles: 环境 客户端手动刷新
- 暴露actuator端点 management: endpoints: web: exposure: include: "*"
- Controller添加注解@RefreshScope
- 修改后发送POST请求 http://ip:port/actuator/refresh curl -X POST http://localhost:3355/actuator/refresh 动态刷新配置
- 服务端整合bus-amqp、暴露bus-refresh
- 客户端整合bus-amqp
- 配置更新后刷新 curl -X POST http://localhost:3355/actuator/bus-refresh
- 只更某个服务配置 curl -X POST http://localhost:3355/actuator/bus-refresh/{spring.application.name:server.port} curl -X POST http://localhost:3355/actuator/bus-refresh/cloud-config-client:3355
Binder 绑定器 Channel 频道 Source/Sink 输出/输入