sks

sks

Cluster erlang nodes without DNS and FQDN

I have create a Elixir Phoenix Project that is to be run on bare metal physical servers (one node per physical server) in a LAN setup.

I am using Elixir mainly for fault tolerance.

I am exporting my application using mix releases and running them on multiple nodes (1 node being 1 physical server)

I am trying to connect these nodes to each other using a custom UDP broadcast based setup, I tried using “libcluster” but it did not work out for me.

So what I am doing currently is broadcasting the nodename, from each node, to the UDP broadcast address 255.255.255.255 and then when other nodes receive the packet, they try to connect to each other.

However there are many issues that I am currently facing. I tried disabling EPMD and running the node on a static port (following many examples online, but that did not really solve my issue)

In my case, I don’t control the machine’s hostnames. The machines can all have the same hostname, and are thus by nature not resolvable by something like machine1.local or such. Also since this is just LAN, there is no DNS running, and this system is supposed to work without internet. That means this system is completely offline and not connected to the public internet.

Since i don’t control the machine’s hostnames, and in a cluster erlang nodes must have unique names. I am setting them up using this env.sh.eex file.

#!/bin/sh  
NODE="$(uuidgen)"
export RELEASE_DISTRIBUTION=name 
export RELEASE_COOKIE="static-cookie" 
export RELEASE_NODE="app@$NODE"

I am trying to set them to a unique name by providing a random hostname myself.
(I realize that this might not be a good solution)

From what I understand the erlang node names are not separate parts, they are a whole atom. So it is not really app@host, it is just a whole host name.

I have read up on several articles to come to the above conclusion.

SO here I am asking the community on what should I do to allow seamless automatic node connections in my setup.
NOTE: I want that whatever N number of machines are running with my elixir phoenix project on the local lan, should form a cluster, without DNS, FQDN or worrying about DHCP.

Since each node can also be connected to the LAN using multiple NICs (for fault tolerance), suffixing the node name with the IP address is not really a solution in my case, and also DHCP can make it change during restarts (such as if something goes wrong with one node)

So what are my options to make it auto connect, with the above restrictions.

I am open to any changes to my idea, but it would be better to depend less on the network, and more on the code, beacuse I am not in control of the network or the machine’s hostnames.

Thank you for reading the above.

Most Liked

joram

joram

I’m not an expert on this, but my understanding is that you need three things to make a connection:

  • Both sides need the same cookie
  • Both sides need to agree on the full name of the node being connected to, including the host part
  • The connecting side needs the part after the @ to resolve to the host the listening side is running on. That means it either needs to be an IP address, or it needs to be a working DNS name

If you can’t use IP addresses you need some kind of name resolution. One idea could be to generate a hostname (I believe it needs at least one dot) and have the receiving side of the broadcast put that into the local hosts file with the correct IP address before connecting.

You can also implement a custom EPMD module. The address_please/3 callback is the one doing DNS resolution.

junaid1460

junaid1460

Nice, didn’t know existed, I was suggesting how to build one if nothing out there. This is great.

Where Next?

Popular in Questions Top

chokchit
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2733ms. You can configure how long re...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
vac
Hi, I’m quite new in Elixir and I’m trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and I...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
yawaramin
In the Dialyzer docs ( dialyzer — OTP 29.0.2 (dialyzer 6.0.1) ), there is a way to turn off a specific warning for a function: -dialyzer...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 41989 114
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39467 209
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54120 245
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement