我有一个运行在linux机器上的netflix oss堆栈。这个堆栈有Eureka,并安装了一堆微服务(hello服务),所有这些都运行在单独的docker容器中。
它是使用Maven和Spring Boot安装的。
我的问题是:如何将Zuul添加到此堆栈?我在网上找到了一些东西,但他们也安装了Eureka,如果我运行这个程序,我会改写当前的Eureka。
发布于 2017-01-09 22:57:04
您需要将@EnableZuulProxy
注释添加到主类中
@SpringBootApplication
@EnableZuulProxy
@EnableHystrixDashboard
public class ZuulApp{
public static void main(String[] args) {
SpringApplication.run(ZuulApp.class, args);
}
}
并在application.yml文件中添加带有eureka-microservices名称的路由
zuul:
ignoredServices: '*'
routes:
microservice1:
path: /microservice1/**
stripPrefix: false
microservice2:
path: /microservice2/**
stripPrefix: false
...
#If you have hystrix
hystrix:
threadpool:
default:
maxQueueSize: 100
queueSizeRejectionThreshold: 100
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 60000
#load balancing
ribbon:
MaxAutoRetries: 2
MaxAutoRetriesNextServer: 2
OkToRetryOnAllOperations: true
ServerListRefreshInterval: 2000
ConnectTimeout: 50000
ReadTimeout: 50000
默认情况下,zuul在端口8500上运行。
maven依赖项
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zuul</artifactId>
</dependency>
发布于 2017-05-18 21:55:47
httpbin: path: /** serviceId: httpbin
功能区:尤里卡:已启用: false
通过以上配置,您可以在不修改zull路由服务器配置的情况下,为以后的特定服务动态添加更多的服务器,因为zull路由服务器可以通过查询eureka来查询和更新运行特定服务的服务器
https://stackoverflow.com/questions/41550018
复制相似问题