spring cloud:服務註冊時,設置使用ip註冊,而不是主機名

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.



發佈了51 篇原創文章 · 獲贊 22 · 訪問量 14萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章