Reputation: 53
Here is my eureka yml:
eureka:
instance:
hostname: eureka
client:
registerWithEureka: false
fetchRegistry: false
serviceUrl:
defaultZone: http://eureka:8761/eureka/
server:
waitTimeInMsWhenSyncEmpty: 0
And here is my zuul server yml eureka part:
eureka:
client:
serviceUrl:
defaultZone: http://eureka:8761/eureka/
When I registry the zuul server to eureka , it throws
java.net.UnknownHostException: eureka
If I change the zuul server yml to defaultZone: http://localhost:8761/eureka/
it would be deployed successfully,
so how can I use 'eureka' host replace localhost, can somebody help me?
Upvotes: 1
Views: 1856
Reputation: 1483
If I change the zuul server yml to defaultZone: http://localhost:8761/eureka/ it would be deployed successfully
Which means you have deployed Eureka server on your local machine. If you want to use eureka
as hostname, you can change your hostname to eureka
.
Or may be you meant to use ${eureka.hostname}
. The documentation says;
${eureka.hostname} is a native placeholder only available in later versions of Eureka. You could achieve the same thing with Spring placeholders as well, e.g. using ${eureka.instance.hostName}
Upvotes: 1