I have two micro-services(car-management-service & rent-management-service), in rent-management-service i'm calling car-management-service through Ribbon& FeignClient with the help of Eureka Discovery Server. And it's working perfectly.
I have started three instances of car-management-service running on port (8100,8101,8102), and Eureka provide these three instances perfectly one after the other.
Now I want to try is it possible to limit this to call only two of these instances by disabling (Temporary- just to Test is it possible) Eureka and providing direct urls of the car-management-service instances while still keeping Ribbon & FeignClient.
Portion of the application.yml
of rent-management-service
eureka:
client:
service-url:
defaultZone: ${EUREKA_URI:http://localhost:8761/eureka}
car-management-service:
ribbon:
eureka:
enabled: false
listOfServers: localhost:8100, localhost:8101
#listOfServers: localhost:8100, localhost:8101, localhost:8102
ServerListRefreshInterval: 1000
Portion of the application.yml
of car-management-service
server:
port: 8100
eureka:
client:
enabled: true
service-url:
defaultZone: ${EUREKA_URI:http://localhost:8761/eureka}
Even though I have disabled Eureka in rent-management-service for discover car-management-service instances and hardcoded two of the three running car-management-service instances, rent-management-service still picks up all the three instances.
Why is it happening? Is there wrong with application.yml configuration or rent-management-service still picks up all the three car-management-service instances because they have the Eureka server dependency in pom.xml?
if I understand right you want 3rd instance from your car-management-service not to get traffic from discovery service. isn't it? you run 3 instances but you want to keep one away from eureka? you can do this. run 2 instances from car-management-service and in 3rd instance add bellow property
eureka:
client:
fetch-registry: false
register-with-eureka: false
in this case that 3rd service will not register with eureka.