我正在尝试使用zuul和Eureka服务器运行一个示例。
下面是我的配置:
eureka-service
server.port=8761
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
logging.level.com.netflix.eureka=OFF
logging.level.com.netflix.discovery=OFF
eureka -client (bootstrap.properties):
spring.application.name=ab
management.server.port=9001
management.server.address: 127.0.0.1
server.port=8081
edge-service(zuul) :
zuul.routes.ab.url=http://localhost:8081
ribbon.eureka.enabled=false
spring.application.name=API-Gateway
eureka.client.eureka-server-port=8761
server.port=8080当我点击URL http:localhost:8080/clientapi时,我得到了一个白色标签错误页面,似乎缺少什么配置,因为我可以看到边缘服务以及eureka-client,都正确地注册到了eureka -server。
我使用的是spring boot: 2.1.4。
发布于 2019-08-13 19:50:45
让我给你看我的例子:
application.yml文件中的尤里卡:
server:
port: 8761
eureka:
client:
register-with-eureka: false
fetch-registry: true
instance-info-replication-interval-seconds: 10
server:
eviction-interval-timer-in-ms: 50000
wait-time-in-ms-when-sync-empty: 5zuul:
zuul.routes.1.url=http://localhost:8081
zuul.routes.2.url=http://localhost:8082
zuul.prefix=/client
zuul.host.max-per-route-connections=10
zuul.host.max-total-connections=10我有两个服务(1 -本地主机:8081和2-本地主机:8082)
你需要注释主类Zuul:
@EnableZuulProxy
@EnableDiscoveryClient然后启动应用程序。当您转到
localhost/8070/client/1时,将重定向到第一个服务(localhost:8081)。
localhost/8070/client/2我希望它能对你有所帮助。
您将重定向到第二个服务(localhost:8082)
https://stackoverflow.com/questions/55841843
复制相似问题