<div dir="ltr">I don't know about a way to change the distribution module programmatically. You can however list multiple modules, as long as their <font face="monospace">select/1</font> callback can properly sort out which module to use towards which node (may work in IPv4 vs IPv6 cases, wont work with plain vs tls connections).<div><br></div><div>An easy workaround may be to implement your custom distribution module, a proxy, that takes from some app env setting or similar the name of a real distribution module. Than you can simply proxy all API calls towards that module.</div><div><br></div><div>BR,</div><div>Daniel<br><br><div class="gmail_quote"><div dir="ltr">On Sat, 8 Dec 2018, 08:34 Ajit Yagaty, <<a href="mailto:ajityagaty@gmail.com" target="_blank">ajityagaty@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello All,<div><br></div><div>
<p class="m_-610346273632317944m_-650959888031191593gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">Currently, one can start an Erlang node in distributed mode by passing in the “proto_dist” parameter on the command line. Could anyone please let me know if there is a way to start the distribution on a non-distributed Erlang node (in any one of inet_tcp/inet6_tcp/inet_tls/inet6_tls modes) programmatically?</p>
<p class="m_-610346273632317944m_-650959888031191593gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69);min-height:14px"><br></p>
<p class="m_-610346273632317944m_-650959888031191593gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">In the code (<a href="https://github.com/erlang/otp/blob/master/lib/kernel/src/net_kernel.erl#L1487" target="_blank"><span class="m_-610346273632317944m_-650959888031191593gmail-s1" style="color:rgb(228,175,10)">https://github.com/erlang/otp/blob/master/lib/kernel/src/net_kernel.erl#L1487</span></a>), there seems to be a reliance on the presence of the command line argument “proto_dist”. If not passed, proto_dist always defaults to inet_tcp.</p>
<p class="m_-610346273632317944m_-650959888031191593gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69);min-height:14px"><br></p>
<p class="m_-610346273632317944m_-650959888031191593gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">If there is a way to start the distribution programmatically, then the logic that decides what proto_dist value to pass can be moved from the init script (when the application is run as a service) into an Erlang module. This would also help in not having to re-write this code snippet for all the different platforms (Linux/Windows/OSX) that one would want to support.</p>
<p class="m_-610346273632317944m_-650959888031191593gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69);min-height:14px"><br></p>
<p class="m_-610346273632317944m_-650959888031191593gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">Any tips on this will be very helpful.</p><p class="m_-610346273632317944m_-650959888031191593gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)"><br></p><p class="m_-610346273632317944m_-650959888031191593gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">But if there is no support to start the distribution programmatically, then would it make sense to add that support?</p><p class="m_-610346273632317944m_-650959888031191593gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)"><br></p><p class="m_-610346273632317944m_-650959888031191593gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">Best regards,</p><p class="m_-610346273632317944m_-650959888031191593gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">Ajit</p></div></div>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div>
</div></div>