Closed riyueshiwang closed 5 years ago
@riyueshiwang What is the need of registering hostname? Why not IP?
@nkorange Now we use host name like this 'mesos-slave-online717-bjdxt9.cloud.xxx' in our company. It's not easy to get the actural IP for some reason. Before we used eureka1.x to register and it worked, and now we expect to change our registry from eureka to nacos.
@riyueshiwang You have a good point, it will be supported in the next one or two version.
能否增加一个配置参数,让用户可以指定是否优先使用hostname映射的ip地址?即优先使用 InetAddress.getLocalHost() 获取的ip地址。
@nkorange I would like to try this. Could you help me to start this ?
@Albert-Hugo Great, first please get familiar with the code in naming module, you can start with the class 'Instance'.
@nkorange Ok, thank you.
@nkorange after I change some code and try to build project and then I run this command 'mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V' . It shows this error message. 'PMD Failure: com.alibaba.nacos.naming.core.Instance:300 Rule:UndefineMagicConstantRule Priority:3 魔法值【":"】.' .
Where should I define this magic constant to fix this bug?
@Albert-Hugo It's already defined, use UtilsAndCommons.IP_PORT_SPLITER.
@nkorange Thanks. It is ok now. But I wonder when should I use this kind constants in the project. Because I saw some of codes that it just using plain string like I did , but it dose not break the build rule.
Issue Description
Type: feature request
Describe what happened (or what feature you want)
I used host name instead of ip to register instance while using nacos, i got this error as follows. Does nacos support to register a instance with host name?
Describe what you expected to happen
As we all use host name instead of ip, I expect to register and update the instance with host name.
How to reproduce it (as minimally and precisely as possible)
As describe above.
Tell us your environment
nacos_1.0.0_rc2
Anything else we need to know?