-
Notifications
You must be signed in to change notification settings - Fork 3k
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
epmd: allow alternative to dns resolving for nodename #1694
epmd: allow alternative to dns resolving for nodename #1694
Conversation
Hello, thanks for the PR. Looks good, except lacking tests and docs as your say. First a question though, what is the reason for epmd using a different resolving strategy than the one that inet uses? |
Thanks for taking a look. I'll look into creating tests straight away. Currently the interface of My first and so far only use case would be to use |
I'm wondering a bit, is the erl_epmd the best place to put this? It is really about finding which ip the nodehostname represents, as the IP is also used to do the distributed connect, which has nothing to do with epmd. An idea, how about extending the inet:getaddr API to be able to do this: This would allow many more services to use the callback module for resolving the IP. It could even be configured in kernel to be used for all lookups using the stratagies described here: http://erlang.org/doc/apps/erts/inet_cfg.html We'd also have to add a way to configure inet_tcp_dist to use custom options to the inet:getaddr call. What do you think? @legoscia Do you have any thoughts on this? |
That is a really interesting thought. I can see that this could prove useful for MDNS in general, but other solutions could be built as well of course. I see Erlang nodenames not as 'hostnames' per se. It is a way of naming and identifying Erlang VMs using some registry. It happens to be that DNS was the chosen registry (and rightfully so). I like to see "epmd module" as an erlang discovery module, not limited to ports. But this just reflects my personal opinion. |
So, I've been thinking a bit and I see your point. Both approaches have their merits, but I think I/we are leaning towards your approach right now. I still like the idea of adding a callback module to inet:getaddr, but maybe not to solve the problem that you are trying to solve. However I think that it would be a good idea for the "address_please" call to also allow returns of {ok, Ip, Port}, so that it would be possible to lookup both address and port in one call. Also the dist_util:start_timer(SetupTime), should most likely be setup around the "address_please" call. Regarding docs, it is about time that we add some. In the erts User's Guide there is a chapter called "How to Implement an Alternative Carrier for the Erlang Distribution". We should add a chapter called "How to Implement an Alternative Service Discovery for Erlang Distribution" and in there document the erl_epmd API. Linking from the various places where one would expect to find info about how to implement an alternative service discovery mechanism. What do you think? |
Sounds great! I'll see if I can come up with the necessary patches. Do you want documentation as part of this PR or separately, since it would cover more then just this feature? Initially (in a separate dist module) I implemented |
Put the doc changes in this pr. I don't have a strong opinion regarding the naming. Choose what you find to be the best. |
0412212
to
73e24b5
Compare
c6974e0
to
ff3ae93
Compare
How is it going? Need any help with anything? |
I've been quite busy past few weeks. I'm slowly making some progress. Thanks! |
Hello! Any chance of getting this done within the next week? I'd like for it to be part of the OTP-21 rc1 if possible. |
Hey, sorry, have been on holiday as well. I'll finish it this week! |
Hi! I finally got around on finishing the documentation. I also merged master into my branch to resolve a conflict in inet_tls_dist. There was a small change in code I moved to another function, so I moved that change as well so it is still present. Happy to get any feedback on the documentation :) |
632de5b
to
f114ca9
Compare
Great! I'll have a look after the OTP-21 rc1 release is done, which quite soon. Would you mind doing a rebase ontop of master instead of merging? We never merge master into our development branches, but instead rebase them ontop until they are merged upstream. |
f114ca9
to
1baba13
Compare
Ok, rebased my branch on top of master instead of merging it :-) |
The xmllint fails in
If you run: "make xmllint" it should reproduce the error. |
1baba13
to
9c3d8cc
Compare
I couldn't get xmllint work right now (I'll look into it), but I think I resolved the error by looking at other docs. |
I just pushed xmllint checks into the travis builds on latest master, so if you rebase again you will get the checks in travis instead of having to run them yourself. |
9c3d8cc
to
4caa6ac
Compare
lib/kernel/doc/src/erl_epmd.xml
Outdated
</header> | ||
<module>erl_epmd</module> | ||
<modulesummary> | ||
Erlang interface towards <seealso marker="erts:epmd"><c>epmd</c></seealso> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xmllint
fails here since modulesummary
may only contain plain text. The rest looks great though!
Looks great! I did some small changes and restructured the alt_disco chapter a bit. If you are happy with my changes, please squash all of your and my changes into a single commit and push them to the PR and I'll merge this change. |
17dc2cb
to
bc8fde1
Compare
erts/doc/src/alt_disco.xml
Outdated
<item><p>Return the address of the given node. | ||
If not implemented, <seealso marker="kernel:inet#gethostbyname/1"> | ||
inet:gethostbyname/1</seealso> will be used instead</p> | ||
<p>This callback may also return the port of the given node. In that case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added one sentence here to clarify when port_please/3 may be omitted.
Thanks. It looks good! I added one sentence and squashed it all in one commit. I hope that's okay! |
This makes it possible to create a custom integration with a key-value store for example. The key would then point to the actual address. You would have to write your own epmd module to make use of that feature.
bc8fde1
to
662f3c7
Compare
I did a force push with some link changes. |
Merged! Thanks for you contribution! |
This makes it possible to create a custom integration with a
key-value store for example. The key would then point to the
actual address. You would have to write your own epmd module
to make use of that feature.
I have not contributed to erlang/otp before so it's kind of new to me. I have read the contributing guidelines, but I'm not sure if this change requires any of the mentioned steps (except for documentation which I will fix, if this PR is even 'considerable'). Please let me know if I'm missing or not understanding something there.
Having said that I also have "my own" tcp dist and epmd module that implements something alike here (although in Elixir): https://github.com/tverlaan/inet_tcp_dist/