mindreader

mindreader

Classification of a nodes in a cluster?

We currently have a monolith where I work, on kubernetes. We are using libcluster to get the nodes the mesh together, and up until now, there has only been one type of node that has every possible dependency and library. It isn’t really sustainable so I’d like to break up some functionality.

The way libcluster works is it gets a list of ips where erlang nodes could be, and then connects them together. Since there could be multiple erlang vms on one machine, it uses a basename@hostname combo for its long names, where the hostname determines what machine it is on, and the basename determines which vm on that machine you want.

In kubernetes every container is just going to have one node on it, so libcluster made a design decision that every erlang node should have the same basename. That’s fine, but then how do I tell the difference between node types in my cluster?

For example, if I have some api nodes, and I have some analytics nodes, and one of the api nodes wants to contact a random analytics node to crunch some data and wait for the results, how do I determine which nodes are “analytics” nodes, when all of the nodes names look like :foo@whatever ?

Up until now I would have just named them api@whatever and analytics@whatever and just done a Node.list and filtered out the analytics nodes, but I don’t see a lot of people doing that so it makes me wonder if there is a better way.

Most Liked

shanesveller

shanesveller

Most of the time we’d use Pod labels and a ClusterIP or headless Service that selects over those labels to do sibling discovery, which is a model libcluster directly supports. In many environments you don’t have any direct connectivity to etcd that powers the cluster, for security and safety reasons, and some don’t actually use etcd under the hood. IIRC Amazon EKS is actually persisting to DynamoDB or something to that effect.

chasers

chasers

I think a lot of k8s people use a service registry like etcd.

I would be interested in another way however as I’m choosing not to go down the k8s route (for now … using Google’s instance groups) but I’m at a place where I need to deregister a node when it receives a sigterm. Perhaps Swarm or Syn.

Where Next?

Popular in Questions Top

Tee
can someone please explain to me how Enum.reduce works with maps
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
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
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

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
peerreynders
Manning 2016 Halloween weekend sale via Deal of the Day Friday, October 28 - Half off all MEAPs - code WM102816LT Saturday, October 29 ...
326 29600 154
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
magnetic
Hey :wave:t3: Elixir community, I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New

We're in Beta

About us Mission Statement