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

Does nacos support to register a instance with host name? #963

Closed
riyueshiwang opened this issue Mar 26, 2019 · 10 comments
Closed

Does nacos support to register a instance with host name? #963

riyueshiwang opened this issue Mar 26, 2019 · 10 comments
Labels
Milestone

Comments

@riyueshiwang
Copy link

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?

curl -X POST http://ip:8848/nacos/v1/ns/instance?serviceName=nacos.test.1\&ip=mesos-slave-online717-bjdxt9.cloud.xxx\&port=8888
instance format invalid:mesos-slave-online717-bjdxt9.cloud.xxx:8888:unknown:DEFAULT_1.0_true_false_DEFAULT

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?

@nkorange
Copy link
Collaborator

@riyueshiwang What is the need of registering hostname? Why not IP?

@riyueshiwang
Copy link
Author

@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.

@nkorange
Copy link
Collaborator

@riyueshiwang You have a good point, it will be supported in the next one or two version.

@nkorange nkorange added contribution welcome good first issue Good for newcomers help wanted Extra attention is needed labels Mar 27, 2019
@Jnoee
Copy link

Jnoee commented Apr 16, 2019

能否增加一个配置参数,让用户可以指定是否优先使用hostname映射的ip地址?即优先使用 InetAddress.getLocalHost() 获取的ip地址。

@Albert-Hugo
Copy link
Contributor

@nkorange I would like to try this. Could you help me to start this ?

@nkorange
Copy link
Collaborator

@Albert-Hugo Great, first please get familiar with the code in naming module, you can start with the class 'Instance'.

@Albert-Hugo
Copy link
Contributor

@nkorange Ok, thank you.

@Albert-Hugo
Copy link
Contributor

@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?

@nkorange
Copy link
Collaborator

@Albert-Hugo It's already defined, use UtilsAndCommons.IP_PORT_SPLITER.

@Albert-Hugo
Copy link
Contributor

@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.

Albert-Hugo pushed a commit to Albert-Hugo/nacos that referenced this issue Apr 18, 2019
nkorange pushed a commit that referenced this issue Apr 23, 2019
[ISSUE #963] to support registering instance with host name
@nkorange nkorange added this to the 1.0.1 milestone May 17, 2019
@nkorange nkorange mentioned this issue Jun 12, 2019
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants