Spring Cloud Bus /bus/refresh 无效

今日学习中遇到了问题 Spring Cloud Bus 在将config-server加入总线后向其发送/bus/refresh 请求不会触发更新
config-server配置
server:
port: 7001

spring:
application:
name: config-server
cloud:
bus:
trace:
enabled: true
config:
server:
git:
uri: https://git.oschina.net/runtypig/scas.git
search-paths: config-repo
username:
password:
rabbitmq:
host: localhost
port: 5672
username: guest
password: guest

eureka:
client:
register-with-eureka: true
fetch-registry: false
serviceUrl:
defaultZone: http://192.168.22.128:6001/eureka/

management:
security:
enabled: false
config-client端配置
server:
port: 8002
spring:
application:
name: config-client
cloud:
bus:
trace:
enabled: true
config:
discovery:
enabled: true
service-id: config-server
name: batchserver
profile: dev
label: master
rabbitmq:
host: localhost
port: 5672
username: guest
password: guest

eureka:
client:
register-with-eureka: true
fetch-registry: true
serviceUrl:
defaultZone: http://192.168.22.128:6001/eureka/

management:
security:
enabled: false
config-client端分别启动 8001、8002 两个实例
执行 crul -X POST http://localhost:8001/bus/refresh 可以正常刷新配置
执行 crul -X POST http://localhost:7001/bus/refresh 则不会更新配置。
尝试 crul -X POST http://localhost:7001/bus/refresh?destination=config-client:** 仍然不行
server端日志如下:
2017-09-07 16:08:51.142  INFO 15694 --- [nio-7001-exec-7] c.n.d.s.r.aws.ConfigClusterResolver      : Resolving eureka endpoints via configuration
2017-09-07 16:08:51.143 INFO 15694 --- [nio-7001-exec-7] com.netflix.discovery.DiscoveryClient : Starting heartbeat executor: renew interval is: 30
2017-09-07 16:08:51.144 INFO 15694 --- [nio-7001-exec-7] c.n.discovery.InstanceInfoReplicator : InstanceInfoReplicator onDemand update allowed rate per min is 4
2017-09-07 16:08:51.144 INFO 15694 --- [nio-7001-exec-7] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1504771731144 with initial instances count: 0
2017-09-07 16:08:51.149 INFO 15694 --- [nio-7001-exec-7] o.s.c.n.e.s.EurekaServiceRegistry : Unregistering application config-server with eureka with status DOWN
2017-09-07 16:08:51.149 INFO 15694 --- [nio-7001-exec-7] o.s.c.n.e.s.EurekaServiceRegistry : Registering application config-server with eureka with status UP
2017-09-07 16:08:51.150 WARN 15694 --- [nio-7001-exec-7] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1504771731150, current=UP, previous=DOWN]
2017-09-07 16:08:51.150 INFO 15694 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_CONFIG-SERVER/192.168.22.128:config-server:7001: registering service...
2017-09-07 16:08:51.152 INFO 15694 --- [nio-7001-exec-7] o.s.cloud.bus.event.RefreshListener : Received remote refresh request. Keys refreshed []
2017-09-07 16:08:51.157 INFO 15694 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_CONFIG-SERVER/192.168.22.128:config-server:7001 - registration status: 204
client端没有任务日志输出。
自己曾经尝试 版本 Dalston.SR1、Dalston.SR2、Dalston.SR3
实在是找不出原因了,还请各位大神帮忙 谢谢
已邀请:

itmuch.com - 《Spring Cloud与Docker微服务架构实战》作者

赞同来自:

需要为每个业务服务配置spring.application.index,让同一个服务的index不是相同的值。
参考文档:http://cloud.spring.io/spring-cloud-static/Dalston.SR3/#_application_context_id_must_be_unique
 
原因分析:http://www.itmuch.com/spring-cloud-code-read/spring-cloud-code-read-spring-cloud-bus/
 

RuntyPig - 80后IT男

赞同来自:

太棒了,问题解决了。谢谢

要回复问题请先登录注册