Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Zuul Edge Server be used without Eureka / Ribbon

We have an infrastructure with service discovery and load balancing (i.e. server side with STM and weblogic cluster). Now we are in the process of refactoring into micro-services. We would need an API gateway which does basic routing to other microservices. Netflix Zuul looks a good candidate however I could not get Zuul working without Eureka - but we do not need Eureka since we already have service discovery and load balancing in place.

  1. Is it possible to use Zuul without Eureka and Ribbon?
  2. If yes please provide some guild-lines since the there's no mention about in the wiki.

Thanks.

like image 971
Fahim Farook Avatar asked Dec 02 '15 06:12

Fahim Farook


People also ask

Does Zuul use Eureka?

Each request received by Zuul is forwarded to a different instance in a round robin fashion. If we start another instance and register it in Eureka, Zuul will register it automatically and start forwarding requests to it: Hello from 'SPRING-CLOUD-EUREKA-CLIENT with Port Number 8083'!

Does Zuul automatically uses ribbon for load balancing?

Regarding Zuul, there is a RibbonRoutingFilter that routes your request to an actual service instance. RibbonRoutingFilter is using Ribbon to choose a server from the list that is given from your configuration or from Eureka. So if you want to use Zuul as a load-balanced reverse proxy, Zuul needs Ribbon.

What is difference between Zuul and Eureka?

Zuul acts as the API gateway, providing a uniform, single point of entry into the set of microservices, while Eureka is essentially used as a “meta data” transport. Each client application instance (read microservice) registers its instance information (location, port, etc.)

What is the need of Eureka server?

Eureka Server is an application that holds the information about all client-service applications. Every Micro service will register into the Eureka server and Eureka server knows all the client applications running on each port and IP address. Eureka Server is also known as Discovery Server.


3 Answers

Yes, it is totally possible.You have to use @EnableZuulProxy on your config class and config it something like this :

zuul:
  routes:
    yourService:
      path: /yourService/**
      serviceId: yourService

ribbon:
  eureka:
    enabled: false

yourService:
  ribbon:
    listOfServers: localhost:8080
like image 181
Ákos Ratku Avatar answered Nov 01 '22 13:11

Ákos Ratku


A sample usage can be like this:

shared.microservice.customer.service1.url=zttp://127.0.0.1:8080/shared/microservice/customer/

shared.microservice.customer.service2.url=zttp://127.0.0.1:8181/shared/microservice/customer/

ribbon.eureka.enabled = false

zuul.routes.customer-micro-service.path: /shared/microservice/customer/**

zuul.routes.customer-micro-service.serviceId: customers
customers.ribbon.listOfServers = 

zttp://ip:port1/shared/microservice/customer/,zttp://ip2:port2/shared/microservice/customer/
like image 24
user1562166 Avatar answered Nov 01 '22 15:11

user1562166


Yes, Of course you can. Actually, by default, if you use @EnableZuulProxy with the Spring Boot Actuator, you enable two additional endpoints:

  • Routes
  • Filters

application.yaml

zuul:
  routes:
    users:
      path: /myusers/**
      url: https://example.com/users_service

These simple url-routes do not get executed as a HystrixCommand, nor do they load-balance multiple URLs with Ribbon.

Yo can get more information from here.

like image 27
fgul Avatar answered Nov 01 '22 14:11

fgul