Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I force Eureka registrations to use an ip address instead of a hostname?

Tags:

spring-cloud

I have a standalone, embedded Eureka server powered by Spring Boot 1.2.0.RELEASE and Spring Cloud 1.0.0.RC1. I see services properly registering themselves in the dashboard, which is great. The status links are using the host name of the box they are running on. Unfortunately, we are using virtual machines and they don't register themselves in DNS, which means that the links are unresolvable. I started looking through the code but was unable to find a way to force the links to use the host's ip address instead. Having a broken dashboard is not the end of the world but I am afraid that once we start using Ribbon or Feign to contact services, those URLs will also use the host name and be unresolvable. Maybe what I am really asking is there a way to force the clients to register with an ip address instead of a host name? Any help is appreciated.

like image 604
user1836542 Avatar asked Jan 28 '15 21:01

user1836542


People also ask

How do I change my Eureka instance hostname?

You can set your hostname at the run-time by using an environment variable — for example, eureka. instance. hostname=${HOST_NAME} .

Why is Eureka server named?

Eureka naming server is a REST-based server that is used in the AWS Cloud services for load balancing and failover of middle-tier services. Eureka naming server is an application that holds information about all client service applications. Each microservice registers itself with the Eureka naming server.

Is Eureka deprecated?

According to the Eureka wiki (https://github.com/Netflix/eureka/wiki), the Eureka 2.0 has been discontinued. The open source work on eureka 2.0 has been discontinued. The code base and artifacts that were released as part of the existing repository of work on the 2. x branch is considered use at your own risk.


1 Answers

set eureka.instance.preferIpAddress=true as documented here

like image 96
spencergibb Avatar answered Oct 06 '22 07:10

spencergibb