首页 文章

通过Eureka Server访问微服务

提问于
浏览
2

我可以通过这样的方式访问微服务:Eureka服务器:http://localhost:8761/微服务网址:http://localhost:8080/调用微服务是这样的:http://localhost:8761/name-service/它可以吗?当我打开eureka服务器时,服务已注册 .

尤里卡/ application.properties:

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

名称服务/ application.properties

spring.application.name=name-service
server.port=8080

我怎样才能做到这一点?

2 回答

  • 0

    您可以使用netflix zuul netflix eureka实现您所需的功能 . “name-service”是您向eureka服务器注册的服务的名称 . 你应该打ZUUL microproxy地址;不是尤里卡的地址

    我建议你从这里开始 . https://spring.io/blog/2015/01/20/microservice-registration-and-discovery-with-spring-cloud-and-netflix-s-eureka . 这是Josh Long写的一篇很好的文章

  • 3

    我 Build zulu服务器 . 当我放入application.properties时

    zuul.routes.name-service.url=http://localhost:8888
    ribbon.eureka.enabled=true
    server.port=8080
    

    作品 .

    如何连接从eureka注册表中读取数据?我试过这样但不起作用

    zuul.routes.name-service.path=/name-service/**
    zuul.routes.name-service.serviceId=name-service
    eureka.client.serviceUrl.defaultZone=http://localhost:8761
    

相关问题