通过 Eureka Server 访问微服务
Access to Microservices via Eureka Server
我可以通过这样的方式访问微服务吗:
尤里卡服务器:http://localhost:8761/
微服务 url:http://localhost:8080/
调用微服务类似于:http://localhost:8761/name-service/
可能吗?
当我打开尤里卡服务器时,服务已注册。
eureka/application.属性:
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
name-service/application.属性
spring.application.name=name-service
server.port=8080
我怎样才能做到这一点?
您寻找的功能可以使用 netflix zuul + netflix eureka 实现。 "name-service" 是您注册到 eureka 服务器的服务的名称。您应该访问 ZUUL 微代理地址;不是尤里卡地址
我建议你从这里开始。 https://spring.io/blog/2015/01/20/microservice-registration-and-discovery-with-spring-cloud-and-netflix-s-eureka。这是 Josh Long 的一篇好文章
我搭建了祖鲁服务器。
当我输入 application.properties
zuul.routes.name-service.url=http://localhost:8888
ribbon.eureka.enabled=true
server.port=8080
有效。
如何连接从eureka registry中读取数据?
我这样试过但没有用
zuul.routes.name-service.path=/name-service/**
zuul.routes.name-service.serviceId=name-service
eureka.client.serviceUrl.defaultZone=http://localhost:8761
我可以通过这样的方式访问微服务吗: 尤里卡服务器:http://localhost:8761/ 微服务 url:http://localhost:8080/ 调用微服务类似于:http://localhost:8761/name-service/ 可能吗? 当我打开尤里卡服务器时,服务已注册。
eureka/application.属性:
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
name-service/application.属性
spring.application.name=name-service
server.port=8080
我怎样才能做到这一点?
您寻找的功能可以使用 netflix zuul + netflix eureka 实现。 "name-service" 是您注册到 eureka 服务器的服务的名称。您应该访问 ZUUL 微代理地址;不是尤里卡地址
我建议你从这里开始。 https://spring.io/blog/2015/01/20/microservice-registration-and-discovery-with-spring-cloud-and-netflix-s-eureka。这是 Josh Long 的一篇好文章
我搭建了祖鲁服务器。 当我输入 application.properties
zuul.routes.name-service.url=http://localhost:8888
ribbon.eureka.enabled=true
server.port=8080
有效。
如何连接从eureka registry中读取数据? 我这样试过但没有用
zuul.routes.name-service.path=/name-service/**
zuul.routes.name-service.serviceId=name-service
eureka.client.serviceUrl.defaultZone=http://localhost:8761