Description: distributed applications deployed on the service, since there may be more than one server NIC, IP addresses are not allowed to cause problems.
Solution:
1, Zhang added directly to ignore the configuration of a network card:
spring.cloud.inetutils.ignored-interfaces [0] = eth0 # ignore eth0, support for regular expressions
Regular:
spring.cloud.inetutils.ignored-interfaces=eth.*
2, specify the default IP:
spring.cloud.inetutils.preferred-networks = 192.168.20.123 # IP segments may be: 192.168.20
3, in addition to these configurations, as well as the following configurations:
spring.cloud.inetutils.default-hostname spring.cloud.inetutils.default-ip-address spring.cloud.inetutils.ignored-interfaces spring.cloud.inetutils.preferred-networks spring.cloud.inetutils.timeout-seconds spring.cloud.inetutils.use-only-site-local-interfaces
ignored-interfaces and two preferred-networks configuration. These two configuration determines the card spring cloud application at startup and used by IP address. ignored-interfaces to receive a regular expression array configuration Although the name is ignored-interfaces, ignore the card, but because it receives is a regular expression, so we can choose any of the anti-election and the machine card. is preferred-networks tend to use the IP address, and receiving a regular expression arrays, for selecting the IP address of the machine used Spring Cloud applications. Through these two configurations, we can specify any application using Spring card Cloud and IP address.
For more explanation refer to the official explanation, the Spring-Cloud-Commons project provides an implementation of the abstract and infrastructure top of Spring Cloud ecology. The basic network infrastructure is here with a corresponding realization: InetUtils, InetUtilsProperties UtilAutoConfiguration provides network configuration and related functions.
reference:
http://blog.csdn.net/neosmith/article/details/53126924
https://www.jianshu.com/p/90ec946293ee
http://blog.csdn.net/xichenguan/article/details/76557065