官方教程
- guide
伪官方教程
https://springcloud.cc
https://legacy.gitbook.com/book/eacdy/spring-cloud-book/details
Actuator
https://blog.csdn.net/alinyua/article/details/80009435
management.endpoints.web.exposure.include="*" 或者 "hystrix.stream" 包含采集的数据.
健康检查
- 配置法:
management:
health:
solr:
enabled: false
db:
enabled: false
elasticsearch:
enabled: false
jms:
enabled: false
mail:
enabled: false
mongo:
enabled: false
rabbit:
enabled: false
redis:
enabled: false
- 代码
/** 系统有以下项:
* rabbitHealthIndicator
* diskSpaceHealthIndicator
* mongoHealthIndicator
* refreshScopeHealthIndicator
* discoveryClient
* configServerHealthIndicator
* hystrixHealthIndicator
*/
@Component("rabbitHealthIndicator")
open class rabbitHealthIndicator(var rabbitTemplate: RabbitTemplate) : RabbitHealthIndicator(rabbitTemplate) {
override fun doHealthCheck(builder: Health.Builder?) {
//跳过
}
}
使用代码,也可以增加额外的分健康检查.
config
启用配置中心:
命令行参数不能覆盖 远程配置中心配置 的问题排查
spring-cloud-context-2.0.0.RC2-sources.jar!/org/springframework/cloud/bootstrap/config/PropertySourceBootstrapProperties.java
这个文件 三个属性:
- allowOverride = true
- overrideNone = false
- overrideSystemProperties = true
看注释根本理解不了。 在get 方法上打断点开调试。
实验结果:
-
config 使用文件系统, 不使用git (使用git ,修改配置需要提交 )
spring.profiles.active: native
spring.cloud.config.profile: native
spring.cloud.config.server.native.search-locations: file:/home/udi/IdeaProjects/app.shop.java/config/git/{application} -
在 配置中心相应的 application应用配置文件中 添加 spring.cloud.config.overrideNone: true
文件位置: /home/udi/IdeaProjects/app.shop.java/config/git/shop-api/application.yml
高可用
unavailable-replicas
http://chenja.iteye.com/blog/2375104
https://blog.csdn.net/u012470019/article/details/77973156
https://www.cnblogs.com/sweetchildomine/p/8830863.html
有效:
1.eureka.instance.appname 必须等于 spring.application.name 并且不可缺省,所以直接占位符 appname: ${spring.application.name}
2.prefer-ip-address: 必须为false 或者缺省
3.fetch-registry 必须非false 或者缺省
4. 所有的设置:
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false