Using Hystrix Stream in Zuul with Eureka First to find Config server

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-06 20:09:50

问题


I'm using spring cloud Brixton.M4 with spring boot 1.3.1

I have zuul server with

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-netflix-hystrix-stream</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
    </dependency>

and i'm using Eureka first to find Config-Server so bootstrap looks like

spring:
 profiles: dev 
 cloud:
   config:
     fail-fast: true
     discovery:
       enabled: true
       serviceId: config-server

zuul is registring two time first with UP state then with STARTING

2016-01-18 14:47:27.209  INFO 2808 --- [           main] c.w.i.edgeserver.EdgeServerApplication   : Started EdgeServerApplication in 21.651 seconds (JVM running for 22.232)
2016-01-18 14:47:56.231  INFO 2808 --- [ool-20-thread-1] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_EDGE-SERVER/192.168.17.178:edge-server:8003 - Re-registering apps/EDGE-SERVER
2016-01-18 14:47:56.270  INFO 2808 --- [ool-20-thread-1] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_EDGE-SERVER/192.168.17.178:edge-server:8003: registering service...
2016-01-18 14:47:56.281  INFO 2808 --- [ool-20-thread-1] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_EDGE-SERVER/192.168.17.178:edge-server:8003 - registration status: 204
2016-01-18 14:48:06.230  INFO 2808 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_EDGE-SERVER/192.168.17.178:edge-server:8003: registering service...
2016-01-18 14:48:06.238  INFO 2808 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_EDGE-SERVER/192.168.17.178:edge-server:8003 - registration status: 204

If I remove dependency on config-server by setting

spring:
 profiles: dev 
 cloud:
   config:
     fail-fast: false
     discovery:
       enabled: false
       serviceId: config-server

everything runs fine.


回答1:


That's normal I think (the bootstrap phase has to register to get the configserver location, and then unregister to let the main application register again). You will probably find that it settles back to UP after the application has started up fully.



来源:https://stackoverflow.com/questions/34851294/using-hystrix-stream-in-zuul-with-eureka-first-to-find-config-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!