spring cloud eureka默認是使用hostname進行註冊的,如果要使用ip註冊,可以這樣設置
eureka.instance.preferIpAddress=true
Prefer IP Address
In some cases, it is preferable for Eureka to advertise the IP Adresses of services rather than the hostname. Set eureka.instance.preferIpAddress
to true
and
when the application registers with eureka, it will use its IP Address rather than its hostname.