文章目录
- 概述
- 特别注意版本信息
- 使用@RefreshScope /actuator/bus-refresh端点手动刷新配置
-
- Step1. 添加依赖
- Step2. 配置RabbitMQ信息
- Step3. Config Server暴露/actuator/bus-refresh端点
- Step4. 启动RabbitMQ的Docker镜像
- Step5. 启动artisan config server微服务
- Step6. 启动artisan order 微服务
- Step7. Artisan Order中写个测试类 验证自动刷新
- 使用Spring Cloud Bus自动更新配置
-
- 公网映射
- 设置webhooks
- config server端加入 monitor
- config client端加入 spring.cloud.bus.id 修复spring cloud bus的bug
- 修改git上的 artisan-order-dev.yml中的env的值
- 代码
概述
Spring Cloud实战-05配置中心的搭建(配合使用Eureka)和Config Server高可用 中的遗留问题:不能自动更新配置。
这里我们将介绍手动和自动两种方式来更新配置
上图的架构将Config Server也纳入到了消息总线中,并使用Config Server的/actuator/bus-refresh端点来实现配置的刷新。 这样做的好处就是,各个微服务仅仅需要关注自身的业务,而不需要承担刷新配置的职责了。
特别注意版本信息
spring-boot-starter-parent: 2.0.3.RELEASE
spring-cloud.version:Finchley.RELEASE
使用@RefreshScope /actuator/bus-refresh端点手动刷新配置
事实上,手动刷新其实并不需要接入消息对了,@RefreshScope是关键。这里是为了下面做自动刷新才引入了消息队列.
Step1. 添加依赖
根据上图的描述我们知道 Config Server和微服务都需要接入到消息队列中
artisan-config(Config Server) 配置中心服务端 pom文件引入依赖
代码语言:javascript复制 <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
artisan-order (同时也是config client)同样的也需要加入上述依赖
Step2. 配置RabbitMQ信息
artisan-config (Config Server) 的 application.yml增加 RabbitMQ的配置信息如下
artisan-order(Config Client) 的配置文件增加 RabbitMQ的配置信息如下
这里我放到了远端的Git
通过config server 访问artisan order 使用的配置文件dev分支的信息
Step3. Config Server暴露/actuator/bus-refresh端点
根据上面的架构,我们是通过Config Server暴露出来的endpoints来请求Config Server ,所以需要在Config Server暴露端点,这里我们设置默认全部暴露出来
确保依赖中有spring-boot-starter-actuator 。 因为 spring-cloud-config-server依赖了spring-boot-starter-actuator ,故无需重复引用。
代码语言:javascript复制#actuator 启用所有的监控端点 “*”号代表启用所有的监控端点,可以单独启用,例如,health,info,metrics
# spring boot 升为 2.0 后,为了安全,默认 Actuator 只暴露了2个端点,heath 和 info
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
当访问这些端点无效时,可以重启下应用,观察启动日志,看是否加载了对应的endpoints信息
Step4. 启动RabbitMQ的Docker镜像
代码语言:javascript复制[root@artisan ~]# docker run -d --hostname my-rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3.7.8-management
e287474e3ce40746819738c079bf32604536c122e2d9cba938269f9c71a09fd1
可参考: Docker-Centos7安装Docker CE 及在Docker CE中安装RabbitMQ
Step5. 启动artisan config server微服务
启动成功后,访问 http://localhost:8762/
登录RabbitMQ查看
可以看到artisan config自动创建了一个队列 。 (观察启动日志,可以看到创建过程 )
Step6. 启动artisan order 微服务
启动成功后查看注册中心
同时,看下消息队列中的队列
artisan-order微服务连接RabbitMQ,也自动创建了一个消息队列。
artisan-order的启动日志
代码语言:javascript复制declaring queue for inbound: springCloudBus.anonymous.jd0h4ldGRi-Aw7MWHDbdug, bound to: springCloudBus
DiscoveryClient_ARTISAN-ORDER/localhost:artisan-order:8081 - registration status: 204
Channel 'artisan-order-1-1.springCloudBus.anonymous.jd0h4ldGRi-Aw7MWHDbdug.errors' has 1 subscriber(s).
Channel 'artisan-order-1-1.springCloudBus.anonymous.jd0h4ldGRi-Aw7MWHDbdug.errors' has 2 subscriber(s).
started inbound.springCloudBus.anonymous.jd0h4ldGRi-Aw7MWHDbdug
Step7. Artisan Order中写个测试类 验证自动刷新
@RefreshScope 重点是这个注解
代码语言:javascript复制package com.artisan.order.controller;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RefreshScope
public class ConfigClientController {
@Value("${env}")
private String env;
@GetMapping("/env")
public String getValueFromGit(){
return env;
}
}
现在远端Git上的配置为 dev2
通过artisan-order 访问下 http://localhost:8081/env
现在将env的值修改为 dev2-artisan
再次访问下 http://localhost:8081/env
还是。。。。
居然没有变化,手工刷新下吧 ,同时观察artisn config 和 artisan order微服务的日志
代码语言:javascript复制 curl -v -X POST http://localhost:9898/actuator/bus-refresh
我们从上面的架构中可以知道,对外提供刷新端点的是Config Server微服务,所以POST请求到 Config Server这个为服务上。
再次访问 http://localhost:8081/env
可以看到已经更新为修改后的值了。
首先看下artisan-config(Config Server端)
代码语言:javascript复制2019-04-09 19:46:54.895 INFO 22752 --- [nio-9898-exec-5] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [10.72.38.235:5672]
2019-04-09 19:46:54.899 INFO 22752 --- [nio-9898-exec-5] o.s.a.r.c.CachingConnectionFactory : Created new connection: rabbitConnectionFactory.publisher#41b8bdb3:0/SimpleConnection@2f5a0df8 [delegate=amqp://guest@10.72.38.235:5672/, localPort= 61369]
2019-04-09 19:46:54.902 INFO 22752 --- [nio-9898-exec-5] o.s.amqp.rabbit.core.RabbitAdmin : Auto-declaring a non-durable, auto-delete, or exclusive Queue (springCloudBus.anonymous.Hn7DXYSmSB-NAptg8TXPJQ) durable:false, auto-delete:true, exclusive:true. It will be redeclared if the broker stops and is restarted while the connection factory is alive, but all messages will be lost.
2019-04-09 19:46:56.280 INFO 22752 --- [nio-9898-exec-5] o.s.cloud.commons.util.InetUtils : Cannot determine local hostname
2019-04-09 19:46:56.338 INFO 22752 --- [nio-9898-exec-5] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@50eb43d8: startup date [Tue Apr 09 19:46:56 CST 2019]; root of context hierarchy
2019-04-09 19:46:56.385 INFO 22752 --- [nio-9898-exec-5] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-04-09 19:46:56.406 INFO 22752 --- [nio-9898-exec-5] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$2a1d7182] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-04-09 19:46:57.821 INFO 22752 --- [nio-9898-exec-5] o.s.cloud.commons.util.InetUtils : Cannot determine local hostname
2019-04-09 19:46:57.875 INFO 22752 --- [nio-9898-exec-5] o.s.boot.SpringApplication : No active profile set, falling back to default profiles: default
2019-04-09 19:46:57.879 INFO 22752 --- [nio-9898-exec-5] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@413aa17: startup date [Tue Apr 09 19:46:57 CST 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@50eb43d8
2019-04-09 19:46:57.882 INFO 22752 --- [nio-9898-exec-5] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-04-09 19:46:57.892 INFO 22752 --- [nio-9898-exec-5] o.s.boot.SpringApplication : Started application in 2.973 seconds (JVM running for 1066.868)
2019-04-09 19:46:57.892 INFO 22752 --- [nio-9898-exec-5] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@413aa17: startup date [Tue Apr 09 19:46:57 CST 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@50eb43d8
2019-04-09 19:46:57.892 INFO 22752 --- [nio-9898-exec-5] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@50eb43d8: startup date [Tue Apr 09 19:46:56 CST 2019]; root of context hierarchy
2019-04-09 19:46:58.069 INFO 22752 --- [nio-9898-exec-5] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
2019-04-09 19:46:58.073 INFO 22752 --- [nio-9898-exec-5] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2019-04-09 19:47:00.478 INFO 22752 --- [nio-9898-exec-5] com.netflix.discovery.DiscoveryClient : Unregistering ...
2019-04-09 19:47:00.488 INFO 22752 --- [nio-9898-exec-5] com.netflix.discovery.DiscoveryClient : DiscoveryClient_ARTISAN-CONFIG/localhost:artisan-config:9898 - deregister status: 200
2019-04-09 19:47:00.502 INFO 22752 --- [nio-9898-exec-5] com.netflix.discovery.DiscoveryClient : Completed shut down of DiscoveryClient
2019-04-09 19:47:00.509 INFO 22752 --- [nio-9898-exec-5] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
2019-04-09 19:47:00.512 INFO 22752 --- [nio-9898-exec-5] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2019-04-09 19:47:00.512 INFO 22752 --- [nio-9898-exec-5] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2019-04-09 19:47:00.512 INFO 22752 --- [nio-9898-exec-5] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2019-04-09 19:47:00.512 INFO 22752 --- [nio-9898-exec-5] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2019-04-09 19:47:00.591 INFO 22752 --- [nio-9898-exec-5] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
2019-04-09 19:47:00.591 INFO 22752 --- [nio-9898-exec-5] com.netflix.discovery.DiscoveryClient : Disable delta property : false
2019-04-09 19:47:00.591 INFO 22752 --- [nio-9898-exec-5] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
2019-04-09 19:47:00.591 INFO 22752 --- [nio-9898-exec-5] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
2019-04-09 19:47:00.591 INFO 22752 --- [nio-9898-exec-5] com.netflix.discovery.DiscoveryClient : Application is null : false
2019-04-09 19:47:00.591 INFO 22752 --- [nio-9898-exec-5] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
2019-04-09 19:47:00.591 INFO 22752 --- [nio-9898-exec-5] com.netflix.discovery.DiscoveryClient : Application version is -1: true
2019-04-09 19:47:00.591 INFO 22752 --- [nio-9898-exec-5] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
2019-04-09 19:47:00.597 INFO 22752 --- [nio-9898-exec-5] com.netflix.discovery.DiscoveryClient : The response status is 200
2019-04-09 19:47:00.597 INFO 22752 --- [nio-9898-exec-5] com.netflix.discovery.DiscoveryClient : Starting heartbeat executor: renew interval is: 30
2019-04-09 19:47:00.597 INFO 22752 --- [nio-9898-exec-5] c.n.discovery.InstanceInfoReplicator : InstanceInfoReplicator onDemand update allowed rate per min is 4
2019-04-09 19:47:00.597 INFO 22752 --- [nio-9898-exec-5] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1554810420597 with initial instances count: 2
2019-04-09 19:47:00.601 INFO 22752 --- [nio-9898-exec-5] o.s.c.n.e.s.EurekaServiceRegistry : Unregistering application artisan-config with eureka with status DOWN
2019-04-09 19:47:00.601 INFO 22752 --- [nio-9898-exec-5] o.s.c.n.e.s.EurekaServiceRegistry : Registering application artisan-config with eureka with status UP
2019-04-09 19:47:00.601 WARN 22752 --- [nio-9898-exec-5] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1554810420601, current=UP, previous=DOWN]
2019-04-09 19:47:00.601 INFO 22752 --- [nio-9898-exec-5] o.s.cloud.bus.event.RefreshListener : Received remote refresh request. Keys refreshed []
2019-04-09 19:47:00.601 INFO 22752 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_ARTISAN-CONFIG/localhost:artisan-config:9898: registering service...
2019-04-09 19:47:00.611 INFO 22752 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_ARTISAN-CONFIG/localhost:artisan-config:9898 - registration status: 204
2019-04-09 19:47:02.249 INFO 22752 --- [nio-9898-exec-6] .c.s.e.MultipleJGitEnvironmentRepository : Fetched for remote master and found 1 updates
2019-04-09 19:47:03.568 INFO 22752 --- [nio-9898-exec-6] o.s.cloud.commons.util.InetUtils : Cannot determine local hostname
2019-04-09 19:47:03.603 INFO 22752 --- [nio-9898-exec-6] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@5b357406: startup date [Tue Apr 09 19:47:03 CST 2019]; root of context hierarchy
2019-04-09 19:47:03.607 INFO 22752 --- [nio-9898-exec-6] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-04-09 19:47:03.611 INFO 22752 --- [nio-9898-exec-6] o.s.c.c.s.e.NativeEnvironmentRepository : Adding property source: file:/E:/config-repo/artisan-order-dev.yml
2019-04-09 19:47:03.611 INFO 22752 --- [nio-9898-exec-6] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@5b357406: startup date [Tue Apr 09 19:47:03 CST 2019]; root of context hierarchy
从远端Git获取最新的数据
artisan-order的日志
代码语言:javascript复制2019-04-09 19:46:56.297 INFO 13380 --- [i-Aw7MWHDbdug-1] o.s.cloud.commons.util.InetUtils : Cannot determine local hostname
2019-04-09 19:46:56.379 INFO 13380 --- [i-Aw7MWHDbdug-1] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@5d6d9ee5: startup date [Tue Apr 09 19:46:56 CST 2019]; root of context hierarchy
2019-04-09 19:46:56.457 INFO 13380 --- [i-Aw7MWHDbdug-1] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-04-09 19:46:56.457 INFO 13380 --- [i-Aw7MWHDbdug-1] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$54833da6] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-04-09 19:46:57.803 INFO 13380 --- [i-Aw7MWHDbdug-1] o.s.cloud.commons.util.InetUtils : Cannot determine local hostname
2019-04-09 19:46:57.809 INFO 13380 --- [i-Aw7MWHDbdug-1] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2019-04-09 19:46:57.826 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
2019-04-09 19:46:57.841 INFO 13380 --- [i-Aw7MWHDbdug-1] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2019-04-09 19:46:57.841 INFO 13380 --- [i-Aw7MWHDbdug-1] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2019-04-09 19:46:57.841 INFO 13380 --- [i-Aw7MWHDbdug-1] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2019-04-09 19:46:57.841 INFO 13380 --- [i-Aw7MWHDbdug-1] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2019-04-09 19:46:57.960 INFO 13380 --- [i-Aw7MWHDbdug-1] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
2019-04-09 19:46:57.960 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Disable delta property : false
2019-04-09 19:46:57.960 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
2019-04-09 19:46:57.960 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
2019-04-09 19:46:57.960 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Application is null : false
2019-04-09 19:46:57.960 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
2019-04-09 19:46:57.960 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Application version is -1: true
2019-04-09 19:46:57.960 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
2019-04-09 19:46:57.978 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : The response status is 200
2019-04-09 19:46:57.978 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Not registering with Eureka server per configuration
2019-04-09 19:46:57.978 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1554810417978 with initial instances count: 2
2019-04-09 19:46:59.295 INFO 13380 --- [i-Aw7MWHDbdug-1] o.s.cloud.commons.util.InetUtils : Cannot determine local hostname
2019-04-09 19:46:59.325 INFO 13380 --- [i-Aw7MWHDbdug-1] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:9898/
2019-04-09 19:47:03.611 INFO 13380 --- [i-Aw7MWHDbdug-1] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=artisan-order, profiles=[dev], label=null, version=5968dd8ea58a354b9f3172cceafd53d968d78847, state=null
2019-04-09 19:47:03.615 INFO 13380 --- [i-Aw7MWHDbdug-1] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource {name='configService', propertySources=[MapPropertySource {name='configClient'}, MapPropertySource {name='https://github.com/yangshangwei/spring-cloud-config-center/artisan-order-dev.yml'}]}
2019-04-09 19:47:03.615 INFO 13380 --- [i-Aw7MWHDbdug-1] o.s.boot.SpringApplication : No active profile set, falling back to default profiles: default
2019-04-09 19:47:03.615 INFO 13380 --- [i-Aw7MWHDbdug-1] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@48c3a65e: startup date [Tue Apr 09 19:47:03 CST 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@5d6d9ee5
2019-04-09 19:47:03.619 INFO 13380 --- [i-Aw7MWHDbdug-1] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-04-09 19:47:03.627 INFO 13380 --- [i-Aw7MWHDbdug-1] o.s.boot.SpringApplication : Started application in 8.674 seconds (JVM running for 724.763)
2019-04-09 19:47:03.627 INFO 13380 --- [i-Aw7MWHDbdug-1] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@48c3a65e: startup date [Tue Apr 09 19:47:03 CST 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@5d6d9ee5
2019-04-09 19:47:03.627 INFO 13380 --- [i-Aw7MWHDbdug-1] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@5d6d9ee5: startup date [Tue Apr 09 19:46:56 CST 2019]; root of context hierarchy
2019-04-09 19:47:03.631 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
2019-04-09 19:47:03.635 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Completed shut down of DiscoveryClient
2019-04-09 19:47:03.674 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
2019-04-09 19:47:03.674 INFO 13380 --- [i-Aw7MWHDbdug-1] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2019-04-09 19:47:06.679 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Unregistering ...
2019-04-09 19:47:06.691 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : DiscoveryClient_ARTISAN-ORDER/localhost:artisan-order:8081 - deregister status: 200
2019-04-09 19:47:06.698 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Completed shut down of DiscoveryClient
2019-04-09 19:47:06.698 INFO 13380 --- [i-Aw7MWHDbdug-1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2019-04-09 19:47:06.710 INFO 13380 --- [i-Aw7MWHDbdug-1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2019-04-09 19:47:06.710 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
2019-04-09 19:47:06.714 INFO 13380 --- [i-Aw7MWHDbdug-1] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2019-04-09 19:47:06.714 INFO 13380 --- [i-Aw7MWHDbdug-1] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2019-04-09 19:47:06.714 INFO 13380 --- [i-Aw7MWHDbdug-1] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2019-04-09 19:47:06.714 INFO 13380 --- [i-Aw7MWHDbdug-1] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2019-04-09 19:47:06.788 INFO 13380 --- [i-Aw7MWHDbdug-1] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
2019-04-09 19:47:06.788 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Disable delta property : false
2019-04-09 19:47:06.788 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
2019-04-09 19:47:06.788 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
2019-04-09 19:47:06.788 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Application is null : false
2019-04-09 19:47:06.788 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
2019-04-09 19:47:06.788 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Application version is -1: true
2019-04-09 19:47:06.788 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
2019-04-09 19:47:06.792 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : The response status is 200
2019-04-09 19:47:06.792 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Starting heartbeat executor: renew interval is: 30
2019-04-09 19:47:06.796 INFO 13380 --- [i-Aw7MWHDbdug-1] c.n.discovery.InstanceInfoReplicator : InstanceInfoReplicator onDemand update allowed rate per min is 4
2019-04-09 19:47:06.796 INFO 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1554810426796 with initial instances count: 2
2019-04-09 19:47:06.796 INFO 13380 --- [i-Aw7MWHDbdug-1] o.s.c.n.e.s.EurekaServiceRegistry : Unregistering application artisan-order with eureka with status DOWN
2019-04-09 19:47:06.796 INFO 13380 --- [i-Aw7MWHDbdug-1] o.s.c.n.e.s.EurekaServiceRegistry : Registering application artisan-order with eureka with status UP
2019-04-09 19:47:06.796 WARN 13380 --- [i-Aw7MWHDbdug-1] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1554810426796, current=UP, previous=DOWN]
2019-04-09 19:47:06.796 INFO 13380 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_ARTISAN-ORDER/localhost:artisan-order:8081: registering service...
2019-04-09 19:47:06.800 INFO 13380 --- [i-Aw7MWHDbdug-1] o.s.cloud.bus.event.RefreshListener : Received remote refresh request. Keys refreshed [config.client.version, env]
2019-04-09 19:47:06.812 INFO 13380 --- [i-Aw7MWHDbdug-1] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [10.72.38.235:5672]
2019-04-09 19:47:06.816 INFO 13380 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_ARTISAN-ORDER/localhost:artisan-order:8081 - registration status: 204
2019-04-09 19:47:06.824 INFO 13380 --- [i-Aw7MWHDbdug-1] o.s.a.r.c.CachingConnectionFactory : Created new connection: rabbitConnectionFactory.publisher#4a6a3d48:0/SimpleConnection@831d875 [delegate=amqp://guest@10.72.38.235:5672/, localPort= 61388]
2019-04-09 19:47:06.826 INFO 13380 --- [i-Aw7MWHDbdug-1] o.s.amqp.rabbit.core.RabbitAdmin : Auto-declaring a non-durable, auto-delete, or exclusive Queue (springCloudBus.anonymous.jd0h4ldGRi-Aw7MWHDbdug) durable:false, auto-delete:true, exclusive:true. It will be redeclared if the broker stops and is restarted while the connection factory is alive, but all messages will be lost.
Fetching config from server at : http://localhost:9898/
从Config Server端拉取最新的配置文件
为了观察RabbitMQ中消息的变化,我又重新刷新了几次,所以时间上和上面的日志对不上,请忽略。
artisan config 绑定的消息队列情况如下:
artisan order绑定的消息队列情况如下:
使用Spring Cloud Bus自动更新配置
官网指导: https://cloud.spring.io/spring-cloud-static/Finchley.SR2/single/spring-cloud.html#_push_notifications_and_spring_cloud_bus
加上了monitor, 在Github中设置了WebHooks路径,也指定了路径 ?path=*
.我试了下,貌似还是不行,请求虽然能正常发出,Config server服务端控制台也正常打印显示配置刷新,但是Config client没有反应,无法读取到最新的配置
所以从Github上搜了下issue ,解决办法是在config client端配置 spring.cloud.bus.id Spring Cloud Bus的bug导致
公网映射
使用ngork 代理
代码语言:javascript复制ngork.exe http 9898
测试下
先看下目前配置文件中env的值
设置webhooks
config server端加入 monitor
代码语言:javascript复制 <dependency>
<groupId>org.springframework.cloudgroupId>
<artifactId>spring-cloud-config-monitorartifactId>
dependency>
–
config client端加入 spring.cloud.bus.id 修复spring cloud bus的bug
spring cloud bus的bug ,详见 https://github.com/spring-cloud/spring-cloud-bus/issues/124
代码语言:javascript复制spring:
application:
name: artisan-order
cloud:
config:
profile: dev
# 可配置多个,不推荐使用,因为需要设置具体的ip.服务端修改或者新增IP后,要同步修改
# uri: http://localhost:9898/,http://localhost:9999/
discovery:
# 指定Config Server在服务发现中的service Id ,默认为configserver
service-id: ARTISAN-CONFIG
# 表示使用服务发现组件中的Config Server,而不自己指定Config Server的uri,默认为false
enabled: true
# 修复github webhook 只能刷新config server 无法刷新config client的问题
bus:
#Workaround for defect in https://github.com/spring-cloud/spring-cloud-bus/issues/124
id: ${vcap.application.name:${spring.application.name:application}}:${vcap.application.instance_index:${spring.cloud.config.profile:${local.server.port:${server.port:0}}}}:${vcap.application.instance_id:${random.value}}
#Eureka
eureka:
client:
service-url:
defaultZone: http://localhost:8762/eureka/
修改git上的 artisan-order-dev.yml中的env的值
artisan config(config server)日志
代码语言:javascript复制2019-04-09 21:40:43.615 INFO 23220 --- [nio-9898-exec-9] o.s.c.c.monitor.PropertyPathEndpoint : Refresh for: artisan:order-dev
2019-04-09 21:40:44.020 INFO 23220 --- [nio-9898-exec-9] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@63668467: startup date [Tue Apr 09 21:40:44 CST 2019]; root of context hierarchy
2019-04-09 21:40:44.047 INFO 23220 --- [nio-9898-exec-9] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-04-09 21:40:44.048 INFO 23220 --- [nio-9898-exec-9] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$ec009efd] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-04-09 21:40:44.457 INFO 23220 --- [nio-9898-exec-9] o.s.boot.SpringApplication : No active profile set, falling back to default profiles: default
2019-04-09 21:40:44.459 INFO 23220 --- [nio-9898-exec-9] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@251ccd87: startup date [Tue Apr 09 21:40:44 CST 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@63668467
2019-04-09 21:40:44.462 INFO 23220 --- [nio-9898-exec-9] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-04-09 21:40:44.466 INFO 23220 --- [nio-9898-exec-9] o.s.boot.SpringApplication : Started application in 0.842 seconds (JVM running for 1860.429)
2019-04-09 21:40:44.467 INFO 23220 --- [nio-9898-exec-9] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@251ccd87: startup date [Tue Apr 09 21:40:44 CST 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@63668467
2019-04-09 21:40:44.467 INFO 23220 --- [nio-9898-exec-9] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@63668467: startup date [Tue Apr 09 21:40:44 CST 2019]; root of context hierarchy
2019-04-09 21:40:44.671 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
2019-04-09 21:40:44.672 INFO 23220 --- [nio-9898-exec-9] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2019-04-09 21:40:47.674 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Unregistering ...
2019-04-09 21:40:47.685 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : DiscoveryClient_ARTISAN-CONFIG/localhost:artisan-config:9898 - deregister status: 200
2019-04-09 21:40:47.690 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Completed shut down of DiscoveryClient
2019-04-09 21:40:47.691 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
2019-04-09 21:40:47.694 INFO 23220 --- [nio-9898-exec-9] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2019-04-09 21:40:47.695 INFO 23220 --- [nio-9898-exec-9] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2019-04-09 21:40:47.695 INFO 23220 --- [nio-9898-exec-9] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2019-04-09 21:40:47.695 INFO 23220 --- [nio-9898-exec-9] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2019-04-09 21:40:47.788 INFO 23220 --- [nio-9898-exec-9] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
2019-04-09 21:40:47.789 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Disable delta property : false
2019-04-09 21:40:47.789 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
2019-04-09 21:40:47.789 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
2019-04-09 21:40:47.789 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Application is null : false
2019-04-09 21:40:47.789 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
2019-04-09 21:40:47.789 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Application version is -1: true
2019-04-09 21:40:47.789 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
2019-04-09 21:40:47.794 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : The response status is 200
2019-04-09 21:40:47.795 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Starting heartbeat executor: renew interval is: 30
2019-04-09 21:40:47.795 INFO 23220 --- [nio-9898-exec-9] c.n.discovery.InstanceInfoReplicator : InstanceInfoReplicator onDemand update allowed rate per min is 4
2019-04-09 21:40:47.796 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1554817247796 with initial instances count: 2
2019-04-09 21:40:47.796 INFO 23220 --- [nio-9898-exec-9] o.s.c.n.e.s.EurekaServiceRegistry : Unregistering application artisan-config with eureka with status DOWN
2019-04-09 21:40:47.796 INFO 23220 --- [nio-9898-exec-9] o.s.c.n.e.s.EurekaServiceRegistry : Registering application artisan-config with eureka with status UP
2019-04-09 21:40:47.796 WARN 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1554817247796, current=UP, previous=DOWN]
2019-04-09 21:40:47.797 INFO 23220 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_ARTISAN-CONFIG/localhost:artisan-config:9898: registering service...
2019-04-09 21:40:47.797 INFO 23220 --- [nio-9898-exec-9] o.s.cloud.bus.event.RefreshListener : Received remote refresh request. Keys refreshed []
2019-04-09 21:40:47.797 INFO 23220 --- [nio-9898-exec-9] o.s.c.c.monitor.PropertyPathEndpoint : Refresh for: artisan-order:dev
2019-04-09 21:40:47.805 INFO 23220 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_ARTISAN-CONFIG/localhost:artisan-config:9898 - registration status: 204
2019-04-09 21:40:48.287 INFO 23220 --- [nio-9898-exec-9] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@3db008: startup date [Tue Apr 09 21:40:48 CST 2019]; root of context hierarchy
2019-04-09 21:40:48.303 INFO 23220 --- [nio-9898-exec-9] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-04-09 21:40:48.303 INFO 23220 --- [nio-9898-exec-9] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$ec009efd] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-04-09 21:40:48.705 INFO 23220 --- [nio-9898-exec-9] o.s.boot.SpringApplication : No active profile set, falling back to default profiles: default
2019-04-09 21:40:48.707 INFO 23220 --- [nio-9898-exec-9] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@6acdeb4c: startup date [Tue Apr 09 21:40:48 CST 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@3db008
2019-04-09 21:40:48.709 INFO 23220 --- [nio-9898-exec-9] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-04-09 21:40:48.713 INFO 23220 --- [nio-9898-exec-9] o.s.boot.SpringApplication : Started application in 0.911 seconds (JVM running for 1864.675)
2019-04-09 21:40:48.714 INFO 23220 --- [nio-9898-exec-9] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@6acdeb4c: startup date [Tue Apr 09 21:40:48 CST 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@3db008
2019-04-09 21:40:48.714 INFO 23220 --- [nio-9898-exec-9] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@3db008: startup date [Tue Apr 09 21:40:48 CST 2019]; root of context hierarchy
2019-04-09 21:40:48.921 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
2019-04-09 21:40:48.921 INFO 23220 --- [nio-9898-exec-9] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2019-04-09 21:40:51.924 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Unregistering ...
2019-04-09 21:40:51.934 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : DiscoveryClient_ARTISAN-CONFIG/localhost:artisan-config:9898 - deregister status: 200
2019-04-09 21:40:51.938 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Completed shut down of DiscoveryClient
2019-04-09 21:40:51.939 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
2019-04-09 21:40:51.943 INFO 23220 --- [nio-9898-exec-9] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2019-04-09 21:40:51.943 INFO 23220 --- [nio-9898-exec-9] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2019-04-09 21:40:51.943 INFO 23220 --- [nio-9898-exec-9] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2019-04-09 21:40:51.943 INFO 23220 --- [nio-9898-exec-9] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2019-04-09 21:40:52.043 INFO 23220 --- [nio-9898-exec-9] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
2019-04-09 21:40:52.044 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Disable delta property : false
2019-04-09 21:40:52.044 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
2019-04-09 21:40:52.044 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
2019-04-09 21:40:52.044 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Application is null : false
2019-04-09 21:40:52.044 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
2019-04-09 21:40:52.044 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Application version is -1: true
2019-04-09 21:40:52.044 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
2019-04-09 21:40:52.055 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : The response status is 200
2019-04-09 21:40:52.056 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Starting heartbeat executor: renew interval is: 30
2019-04-09 21:40:52.056 INFO 23220 --- [nio-9898-exec-9] c.n.discovery.InstanceInfoReplicator : InstanceInfoReplicator onDemand update allowed rate per min is 4
2019-04-09 21:40:52.057 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1554817252057 with initial instances count: 2
2019-04-09 21:40:52.057 INFO 23220 --- [nio-9898-exec-9] o.s.c.n.e.s.EurekaServiceRegistry : Unregistering application artisan-config with eureka with status DOWN
2019-04-09 21:40:52.057 INFO 23220 --- [nio-9898-exec-9] o.s.c.n.e.s.EurekaServiceRegistry : Registering application artisan-config with eureka with status UP
2019-04-09 21:40:52.057 WARN 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1554817252057, current=UP, previous=DOWN]
2019-04-09 21:40:52.058 INFO 23220 --- [nio-9898-exec-9] o.s.cloud.bus.event.RefreshListener : Received remote refresh request. Keys refreshed []
2019-04-09 21:40:52.058 INFO 23220 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_ARTISAN-CONFIG/localhost:artisan-config:9898: registering service...
2019-04-09 21:40:52.058 INFO 23220 --- [nio-9898-exec-9] o.s.c.c.monitor.PropertyPathEndpoint : Refresh for: artisan-order-dev
2019-04-09 21:40:52.063 INFO 23220 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_ARTISAN-CONFIG/localhost:artisan-config:9898 - registration status: 204
2019-04-09 21:40:52.450 INFO 23220 --- [nio-9898-exec-9] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@2eb4e6fe: startup date [Tue Apr 09 21:40:52 CST 2019]; root of context hierarchy
2019-04-09 21:40:52.480 INFO 23220 --- [nio-9898-exec-9] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-04-09 21:40:52.480 INFO 23220 --- [nio-9898-exec-9] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$ec009efd] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-04-09 21:40:52.835 INFO 23220 --- [nio-9898-exec-9] o.s.boot.SpringApplication : No active profile set, falling back to default profiles: default
2019-04-09 21:40:52.837 INFO 23220 --- [nio-9898-exec-9] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@7751cf4: startup date [Tue Apr 09 21:40:52 CST 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@2eb4e6fe
2019-04-09 21:40:52.838 INFO 23220 --- [nio-9898-exec-9] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-04-09 21:40:52.842 INFO 23220 --- [nio-9898-exec-9] o.s.boot.SpringApplication : Started application in 0.781 seconds (JVM running for 1868.804)
2019-04-09 21:40:52.843 INFO 23220 --- [nio-9898-exec-9] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@7751cf4: startup date [Tue Apr 09 21:40:52 CST 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@2eb4e6fe
2019-04-09 21:40:52.843 INFO 23220 --- [nio-9898-exec-9] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@2eb4e6fe: startup date [Tue Apr 09 21:40:52 CST 2019]; root of context hierarchy
2019-04-09 21:40:52.945 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
2019-04-09 21:40:52.945 INFO 23220 --- [nio-9898-exec-9] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2019-04-09 21:40:54.070 INFO 23220 --- [nio-9898-exec-2] .c.s.e.MultipleJGitEnvironmentRepository : Fetched for remote master and found 1 updates
2019-04-09 21:40:54.487 INFO 23220 --- [nio-9898-exec-2] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@3a19c86d: startup date [Tue Apr 09 21:40:54 CST 2019]; root of context hierarchy
2019-04-09 21:40:54.489 INFO 23220 --- [nio-9898-exec-2] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-04-09 21:40:54.495 INFO 23220 --- [nio-9898-exec-2] o.s.c.c.s.e.NativeEnvironmentRepository : Adding property source: file:/E:/config-repo/artisan-order-dev.yml
2019-04-09 21:40:54.496 INFO 23220 --- [nio-9898-exec-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@3a19c86d: startup date [Tue Apr 09 21:40:54 CST 2019]; root of context hierarchy
2019-04-09 21:40:55.948 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Unregistering ...
2019-04-09 21:40:55.952 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : DiscoveryClient_ARTISAN-CONFIG/localhost:artisan-config:9898 - deregister status: 200
2019-04-09 21:40:55.956 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Completed shut down of DiscoveryClient
2019-04-09 21:40:55.957 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
2019-04-09 21:40:55.959 INFO 23220 --- [nio-9898-exec-9] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2019-04-09 21:40:55.959 INFO 23220 --- [nio-9898-exec-9] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2019-04-09 21:40:55.959 INFO 23220 --- [nio-9898-exec-9] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2019-04-09 21:40:55.959 INFO 23220 --- [nio-9898-exec-9] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2019-04-09 21:40:56.062 INFO 23220 --- [nio-9898-exec-9] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
2019-04-09 21:40:56.062 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Disable delta property : false
2019-04-09 21:40:56.062 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
2019-04-09 21:40:56.062 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
2019-04-09 21:40:56.062 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Application is null : false
2019-04-09 21:40:56.062 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
2019-04-09 21:40:56.062 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Application version is -1: true
2019-04-09 21:40:56.062 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
2019-04-09 21:40:56.066 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : The response status is 200
2019-04-09 21:40:56.067 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Starting heartbeat executor: renew interval is: 30
2019-04-09 21:40:56.068 INFO 23220 --- [nio-9898-exec-9] c.n.discovery.InstanceInfoReplicator : InstanceInfoReplicator onDemand update allowed rate per min is 4
2019-04-09 21:40:56.068 INFO 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1554817256068 with initial instances count: 2
2019-04-09 21:40:56.069 INFO 23220 --- [nio-9898-exec-9] o.s.c.n.e.s.EurekaServiceRegistry : Unregistering application artisan-config with eureka with status DOWN
2019-04-09 21:40:56.069 INFO 23220 --- [nio-9898-exec-9] o.s.c.n.e.s.EurekaServiceRegistry : Registering application artisan-config with eureka with status UP
2019-04-09 21:40:56.069 WARN 23220 --- [nio-9898-exec-9] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1554817256069, current=UP, previous=DOWN]
2019-04-09 21:40:56.069 INFO 23220 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_ARTISAN-CONFIG/localhost:artisan-config:9898: registering service...
2019-04-09 21:40:56.069 INFO 23220 --- [nio-9898-exec-9] o.s.cloud.bus.event.RefreshListener : Received remote refresh request. Keys refreshed []
2019-04-09 21:40:56.081 INFO 23220 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_ARTISAN-CONFIG/localhost:artisan-config:9898 - registration status: 204
artisan-order(config client)日志
代码语言:javascript复制2019-04-09 21:40:48.295 INFO 15384 --- [M-hMsHP_7Ig1A-1] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@30727eb2: startup date [Tue Apr 09 21:40:48 CST 2019]; root of context hierarchy
2019-04-09 21:40:48.369 INFO 15384 --- [M-hMsHP_7Ig1A-1] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-04-09 21:40:48.371 INFO 15384 --- [M-hMsHP_7Ig1A-1] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$17ab65d3] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-04-09 21:40:48.769 INFO 15384 --- [M-hMsHP_7Ig1A-1] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2019-04-09 21:40:48.777 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
2019-04-09 21:40:48.781 INFO 15384 --- [M-hMsHP_7Ig1A-1] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2019-04-09 21:40:48.781 INFO 15384 --- [M-hMsHP_7Ig1A-1] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2019-04-09 21:40:48.781 INFO 15384 --- [M-hMsHP_7Ig1A-1] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2019-04-09 21:40:48.781 INFO 15384 --- [M-hMsHP_7Ig1A-1] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2019-04-09 21:40:48.929 INFO 15384 --- [M-hMsHP_7Ig1A-1] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
2019-04-09 21:40:48.933 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Disable delta property : false
2019-04-09 21:40:48.933 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
2019-04-09 21:40:48.933 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
2019-04-09 21:40:48.933 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Application is null : false
2019-04-09 21:40:48.933 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
2019-04-09 21:40:48.933 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Application version is -1: true
2019-04-09 21:40:48.933 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
2019-04-09 21:40:48.938 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : The response status is 200
2019-04-09 21:40:48.938 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Not registering with Eureka server per configuration
2019-04-09 21:40:48.939 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1554817248939 with initial instances count: 2
2019-04-09 21:40:49.387 INFO 15384 --- [M-hMsHP_7Ig1A-1] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:9898/
2019-04-09 21:40:54.498 INFO 15384 --- [M-hMsHP_7Ig1A-1] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=artisan-order, profiles=[dev], label=null, version=a5d2b388f4f5f0f77b0754f69458777740461be5, state=null
2019-04-09 21:40:54.498 INFO 15384 --- [M-hMsHP_7Ig1A-1] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource {name='configService', propertySources=[MapPropertySource {name='configClient'}, MapPropertySource {name='https://github.com/yangshangwei/spring-cloud-config-center/artisan-order-dev.yml'}]}
2019-04-09 21:40:54.500 INFO 15384 --- [M-hMsHP_7Ig1A-1] o.s.boot.SpringApplication : No active profile set, falling back to default profiles: default
2019-04-09 21:40:54.502 INFO 15384 --- [M-hMsHP_7Ig1A-1] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@7f179bae: startup date [Tue Apr 09 21:40:54 CST 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@30727eb2
2019-04-09 21:40:54.504 INFO 15384 --- [M-hMsHP_7Ig1A-1] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-04-09 21:40:54.509 INFO 15384 --- [M-hMsHP_7Ig1A-1] o.s.boot.SpringApplication : Started application in 6.704 seconds (JVM running for 519.003)
2019-04-09 21:40:54.509 INFO 15384 --- [M-hMsHP_7Ig1A-1] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@7f179bae: startup date [Tue Apr 09 21:40:54 CST 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@30727eb2
2019-04-09 21:40:54.510 INFO 15384 --- [M-hMsHP_7Ig1A-1] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@30727eb2: startup date [Tue Apr 09 21:40:48 CST 2019]; root of context hierarchy
2019-04-09 21:40:54.510 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
2019-04-09 21:40:54.517 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Completed shut down of DiscoveryClient
2019-04-09 21:40:54.592 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
2019-04-09 21:40:54.593 INFO 15384 --- [M-hMsHP_7Ig1A-1] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2019-04-09 21:40:57.595 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Unregistering ...
2019-04-09 21:40:57.606 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : DiscoveryClient_ARTISAN-ORDER/localhost:artisan-order:8081 - deregister status: 200
2019-04-09 21:40:57.612 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Completed shut down of DiscoveryClient
2019-04-09 21:40:57.613 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
2019-04-09 21:40:57.618 INFO 15384 --- [M-hMsHP_7Ig1A-1] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2019-04-09 21:40:57.618 INFO 15384 --- [M-hMsHP_7Ig1A-1] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2019-04-09 21:40:57.618 INFO 15384 --- [M-hMsHP_7Ig1A-1] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2019-04-09 21:40:57.618 INFO 15384 --- [M-hMsHP_7Ig1A-1] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2019-04-09 21:40:57.723 INFO 15384 --- [M-hMsHP_7Ig1A-1] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
2019-04-09 21:40:57.723 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Disable delta property : false
2019-04-09 21:40:57.724 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
2019-04-09 21:40:57.724 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
2019-04-09 21:40:57.724 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Application is null : false
2019-04-09 21:40:57.724 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
2019-04-09 21:40:57.724 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Application version is -1: true
2019-04-09 21:40:57.724 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
2019-04-09 21:40:57.736 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : The response status is 200
2019-04-09 21:40:57.737 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Starting heartbeat executor: renew interval is: 30
2019-04-09 21:40:57.738 INFO 15384 --- [M-hMsHP_7Ig1A-1] c.n.discovery.InstanceInfoReplicator : InstanceInfoReplicator onDemand update allowed rate per min is 4
2019-04-09 21:40:57.739 INFO 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1554817257739 with initial instances count: 2
2019-04-09 21:40:57.739 INFO 15384 --- [M-hMsHP_7Ig1A-1] o.s.c.n.e.s.EurekaServiceRegistry : Unregistering application artisan-order with eureka with status DOWN
2019-04-09 21:40:57.739 INFO 15384 --- [M-hMsHP_7Ig1A-1] o.s.c.n.e.s.EurekaServiceRegistry : Registering application artisan-order with eureka with status UP
2019-04-09 21:40:57.740 WARN 15384 --- [M-hMsHP_7Ig1A-1] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1554817257740, current=UP, previous=DOWN]
2019-04-09 21:40:57.740 INFO 15384 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_ARTISAN-ORDER/localhost:artisan-order:8081: registering service...
2019-04-09 21:40:57.740 INFO 15384 --- [M-hMsHP_7Ig1A-1] o.s.cloud.bus.event.RefreshListener : Received remote refresh request. Keys refreshed [config.client.version, env]
2019-04-09 21:40:57.752 INFO 15384 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_ARTISAN-ORDER/localhost:artisan-order:8081 - registration status: 204
访问http://localhost:8081/env
自动更新成功 。
代码
artisan config Config Server: https://github.com/yangshangwei/springcloud-o2o/tree/master/artisan_config
artisan orderConfig Client:https://github.com/yangshangwei/springcloud-o2o/tree/master/artisan_order