配置中心config-client
配置 中心 Client config
2023-06-13 09:17:29 时间
1 导入的包
implementation 'com.netflix.hystrix:hystrix-javanica'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.cloud:spring-cloud-netflix-hystrix-dashboard'
implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
implementation 'org.springframework.boot:spring-boot-starter-freemarker'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
//@EnableTurbine 集群监控
// https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-netflix-turbine
implementation 'org.springframework.cloud:spring-cloud-netflix-turbine'
// https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-turbine
// implementation 'org.springframework.cloud:spring-cloud-starter-turbine'
//配置中心
implementation 'org.springframework.cloud:spring-cloud-starter-config'
implementation 'org.springframework.cloud:spring-cloud-config-client'
//监控配置中心
//是一套监控的功能,可以监控程序在运行时状态,其中就包括/refresh的功能。
implementation 'org.springframework.boot:spring-boot-starter-actuator'
//对消息总线的支持
// https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-bus-amqp
implementation 'org.springframework.cloud:spring-cloud-starter-bus-amqp'
2 创建bootstrap.properties配置文件
#对应{application}部分
spring.cloud.config.name=neo-config
#对应{profile}部分
spring.cloud.config.profile=dev
#对应git的分支
spring.cloud.config.label=master
#配置中心的具体地址
spring.cloud.config.enabled=true
#spring.cloud.config.uri=http://localhost:8003/
spring.cloud.config.discovery.enabled=true
spring.cloud.config.discovery.service-id=ads-config-server
eureka.client.serviceUrl.defaultZone=http://4.1.22.22:8200/eureka/
#开启刷新配置 server也要加配置
management.endpoints.web.exposure.include=*
#特别注意:上面这些与spring-cloud相关的属性必须配置在bootstrap.properties中,
# config部分内容才能被正确加载。因为config的相关配置会先于application.properties,
# 而bootstrap.properties的加载也是先于application.properties。
3 测试
4 application.properties配置
spring.application.name=ads-demo-consumer
server.port=8302
eureka.client.serviceUrl.defaultZone=http://4.1.22.22:8200/eureka/
#开启熔断
feign.hystrix.enabled=true
#开启端口
management.endpoints.web.exposure.include=*
#跟踪总线事件 /trace
spring.cloud.bus.trace.enabled=true
spring.rabbitmq.host=88.8.66.88
spring.rabbitmq.port=5672
spring.rabbitmq.username=eet
spring.rabbitmq.password=971024
5 配置刷新
全部刷新
curl -v -X POST "http://localhost:8302/actuator/bus-refresh"
局部刷新
curl -v -X POST “http://localhost:8302/actuator/refresh”
相关文章
- 几行代码就可以使用分布式配置中心,Spring Cloud Alibaba真香
- 8000401a 因为配置标识不正确,系统无法开始服务器进程。请检查用户名和密码。「建议收藏」
- 怎么给idea配置jdk_ideaj配置tomcat
- 超详细的Git下载安装、环境变量配置教程
- Tapdata Cloud 版本上新 | 支持通知自配置,支持GP、MQ数据源,界面更友好!
- 微信公众号开发(一)服务器及接口的配置
- 实现配置中心和配置客户端的服务化
- creo每次都要配置config_config配置中心
- ZooKeeper入门(二):ZooKeeper常用命令介绍及使用Curator客户端实现分布式配置中心
- nacos 配置中心源码解析
- nacos配置中心 服务启动的配置加载
- 你好好想想,你真的需要配置中心吗?
- Etcd – 分布式配置中心
- spring cloud 配置中心配置哪些东西_druid连接池配置优化
- spring cloud系列教程第七篇-服务提供者集群环境搭建及负载均衡配置
- 【已解决】Nacos作为配置中心的时候,使用@Value注解一直提示Could not resolve placeholder
- Spring Cloud(八):分布式配置中心服务化和高可用详解编程语言
- springcloud之配置中心svn示例和refresh详解编程语言
- Oracle 参数 CLIENT_RESULT_CACHE_LAG 官方解释,作用,如何配置最优化建议
- Oracle 参数 RESULT_CACHE_REMOTE_EXPIRATION 官方解释,作用,如何配置最优化建议
- Oracle 参数 SORT_AREA_SIZE 官方解释,作用,如何配置最优化建议
- Linux MPI 配置实战:快速搭建集群(linuxmpi配置)
- Linux硬件配置:实施与优化(linux硬件配置)
- Apollo 配置中心简单介绍
- header的安全配置指南
- IIS6安装与配置.net2.0过程的详细图解