如何在不使用Eureka的情况下连接zuul和微服务

时间:2019-07-29 09:24:15

标签: spring netflix-eureka netflix-zuul

我需要在没有尤里卡的情况下连接zuul和微服务

server:
  port: 9090

eureka:
  client:
    serviceUrl:
      defaultZone: http://127.0.0.1:8761/eureka/

zuul:
  #Service will be mapped under the /api URI
  prefix: /MicroService
#  Uncomment to disable auto-registering all services read from Eureka
#  ignoredServices: '*'
  routes:
    test:
      path: /redirect/**
      url: http://google.com
    customer-by-address:
      path: /customer-by-address/**
      url: http://localhost:9098
    customer-by-service:
      path: /customer-by-service/**
      serviceId: CUSTOMER-SERVICE
    account-by-service:
      path: /account-by-service/**
      serviceId: ACCOUNT-SERVICES1
    apiService:
      path: /Service/**
      url: MICROSERVICE              
    static:
      path: /static/**
    host:
      connect-timeout-millis: 5000
      socket-timeout-millis: 10000  

hystrix:
  command:
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 60000


spring:
  application:
    name: zuul-server

1 个答案:

答案 0 :(得分:0)

尤里卡和祖尔的目的不同。
Eureka-服务发现和监视
Zuul-创建代理。

只需将路由添加到zuul服务器属性文件中即可。 例如:-

zuul.routes.books.url=http://localhost:8083
zuul.routes.books.path=/book-service/**
zuul.routes.books.sensitive-headers=Set-Cookie,Authorization
hystrix.command.books.execution.isolation.thread.timeoutInMilliseconds=600000