[erlang-questions] Distributed erlang problem

Chandru chandrashekhar.mullaparthi@REDACTED
Tue Mar 25 15:01:52 CET 2008


On 19/01/2008, Serge Aleynikov <saleyn@REDACTED> wrote:
>
> Chandru wrote:
> > Well - there is an issue. This is because on the OMC node, host1-rep is
> > resolving to an IP address to which routing doesn't exist from the OMC
> (and
> > I can't get it added). The Security team won't allow this connectivity.
> >
> > But is there a reason why the node name should have the hostname in it?
> > Can't we have an erlang node on a machine registering with any arbitrary
> > name in epmd? There could be kernel configuration on other nodes which
> can
> > specify the host for each node name. This will have the added benefit
> that
> > an mnesia database backup can easily be ported across various sets of
> nodes
> > without having to change the name of the nodes in the backup file (which
> is
> > a bit of a hack).
>
>
> It sounds like what you need is to resolve a host name to IP on OMC that
>   doesn't resolve using default resolution method.
>
> What you can do is specify the {kernel, [{inetrc, CustomConfigFile}]}
> option that will customize the name resolution search path used by
> distributed Erlang.
>
> The CustomConfigFile could contain:
>
> {file, hosts, "/etc/hosts"}.
> {file, resolv, "/etc/resolv.conf"}.
> {lookup, [file, dns]}.
> {host, IpAddress1, ["db1@REDACTED"]}.
> {host, IpAddress2, ["db1@REDACTED"]}.
>
> This should solve your issue.


An update for the archives in case any one else tries to use this.

  {host, IpAddress2, ["db1@REDACTED"]}.

should be

{host, IpAddress2, ["host2-rep"]}.  %% Don't include the node name, just the
hostname

The other thing to keep in mind is that this hostname should not be in
/etc/hosts. This custom solution may or may not work if the same name exists
in both files because of the way inet:gethostbyname/1 traverses the
inet_hosts table. The implementation is not wrong, but it could probably do
better.

cheers
Chandru
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080325/ebc766ff/attachment.htm>


More information about the erlang-questions mailing list