[erlang-questions] Starting Erlang distribution programmatically

Ajit Yagaty ajityagaty@REDACTED
Mon Dec 17 18:55:05 CET 2018


Hello Daniel,

Apologies for the delay in response. Thanks for responding to my question!

I'll try to see if I can get to work with the proxy workaround that you've
suggested for now.

But I do think that it would be nice to enable the distribution in the
required mode programmatically.
I'll see if I can put out a patch.

Best regards,
Ajit

On Sun, Dec 9, 2018 at 3:33 PM Dániel Szoboszlay <dszoboszlay@REDACTED>
wrote:

> I don't know about a way to change the distribution module
> programmatically. You can however list multiple modules, as long as their
> select/1 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).
>
> 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.
>
> BR,
> Daniel
>
> On Sat, 8 Dec 2018, 08:34 Ajit Yagaty, <ajityagaty@REDACTED> wrote:
>
>> Hello All,
>>
>> 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?
>>
>>
>> In the code (
>> https://github.com/erlang/otp/blob/master/lib/kernel/src/net_kernel.erl#L1487),
>> 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.
>>
>>
>> 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.
>>
>>
>> Any tips on this will be very helpful.
>>
>>
>> But if there is no support to start the distribution programmatically,
>> then would it make sense to add that support?
>>
>>
>> Best regards,
>>
>> Ajit
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20181217/b2f84aaa/attachment.htm>


More information about the erlang-questions mailing list