在 Zuul 中使用 Hystrix Stream 和 Eureka First 查找 Config 服务器
Using Hystrix Stream in Zuul with Eureka First to find Config server
我正在使用 spring cloud Brixton.M4 和 spring boot 1.3.1
我有
的 zuul 服务器
<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>
我首先使用 Eureka 来查找配置服务器,因此 bootstrap 看起来像
spring:
profiles: dev
cloud:
config:
fail-fast: true
discovery:
enabled: true
serviceId: config-server
zuul 注册了两次,首先是 UP 状态,然后是 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
如果我通过设置
移除对配置服务器的依赖
spring:
profiles: dev
cloud:
config:
fail-fast: false
discovery:
enabled: false
serviceId: config-server
一切正常。
我认为这很正常(bootstrap阶段必须注册以获取配置服务器位置,然后注销才能让主应用程序再次注册)。您可能会发现在应用程序完全启动后它会恢复到 UP。
我正在使用 spring cloud Brixton.M4 和 spring boot 1.3.1
我有
的 zuul 服务器 <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>
我首先使用 Eureka 来查找配置服务器,因此 bootstrap 看起来像
spring:
profiles: dev
cloud:
config:
fail-fast: true
discovery:
enabled: true
serviceId: config-server
zuul 注册了两次,首先是 UP 状态,然后是 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
如果我通过设置
移除对配置服务器的依赖spring:
profiles: dev
cloud:
config:
fail-fast: false
discovery:
enabled: false
serviceId: config-server
一切正常。
我认为这很正常(bootstrap阶段必须注册以获取配置服务器位置,然后注销才能让主应用程序再次注册)。您可能会发现在应用程序完全启动后它会恢复到 UP。