sks

sks

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.

Showing Posts 1 to 4

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

Register in postgres and setup notification ?

junaid1460

junaid1460

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

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
ryanwinchester
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted” Version...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews