Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spring.cloud.consul.discovery.prefer-ip-address 配置失效 #41

Closed
sail-y opened this issue Dec 7, 2018 · 3 comments
Closed

spring.cloud.consul.discovery.prefer-ip-address 配置失效 #41

sail-y opened this issue Dec 7, 2018 · 3 comments

Comments

@sail-y
Copy link

sail-y commented Dec 7, 2018

今天在基于Nepxion Discovery注册的时候,因为机器上有多网卡的关系,有几个是虚拟机的虚拟网卡,在注册consul的时候选用了虚拟网卡的ip。检查配置发现并没有配置

spring.cloud.consul.discovery.prefer-ip-address=true

ConsulApplicationContextInitializer.java类中,发现一行代码

ConsulDiscoveryProperties consulDiscoveryProperties = (ConsulDiscoveryProperties) bean;
consulDiscoveryProperties.setPreferIpAddress(true);

这里将配置写死了,建议大佬去除此配置,让用户可以自由配置spring.cloud.consul.discovery.prefer-ip-address 😄

@HaojunRen
Copy link
Member

很容易可以去除,但90%以上的场景都是ip地址注册的,机器名注册的很少,同时本框架不少功能都是通过ip地址展开的,如果采用机器名注册那些功能都将不能用。还有,Docker和K8S应该都是走ip地址注册的

@sail-y
Copy link
Author

sail-y commented Dec 17, 2018

说是这么说,但是怪怪的

@HaojunRen
Copy link
Member

我查看了一下,从代码级别可以取消IP地址注册限制,但是nacos服务注册根本就不支持机器名注册,只支持IP地址注册。如何保持这四个注册中心注册行为一致?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants