I am implementing micro service Netflix stack using spring cloud. Everything was going well but here is one problem.
My discovery server is hosted on digital ocean droplet. All of my eureka client from digital ocean are responding well. But one of my client is hosted in aws ec2 midium instance. After running my client it is connected with eureka server successfully. Eureka server showing my instance in dashboard but it's status is showing private DNS instead of public DNS or public IP. For this reason my zuul gateway is not connecting with that aws instance.
My question is:
Here is my eureka client's application.yml file:
# Spring properties
spring:
application:
name: product-service
# HTTP Server
server:
port: 9090
servlet:
context-path: /product-service
my_message:server 5050
# Discovery Server Access
eureka:
client:
serviceUrl:
defaultZone: http://xx.xx.xx.xx:8080/discovery-server/eureka/
instance:
leaseRenewalIntervalInSeconds: false
management:
security:
enabled: false
YES, finally i figured out of my problem and solved that issue in my server.
Analysis of problem:
For both cases, Netflix ribbon was calling eureka client using their provided ip. For this reason ribbon was failed to call expected client .
Solution:
Provide eureka instance the expected IP address and connect with eureka server using that IP address.
Just add bellow lines in eureka clients application.yml file:
eureka:
instance:
prefer-ip-address : true
ip-address : xx.xx.xx.xx
Thanks :)