New Phoenix project, why do we need `DNSCluster`?

As per title, I found this in my supervision tree after generating a Phoenix 1.7 project:

{DNSCluster, query: Application.get_env(:my_app, :dns_cluster_query) || :ignore},

The description on hexdocs – “Simple DNS based cluster discovery.” – does not tell me anything that explains why does a Phoenix project needs it.

Does anybody know?

2 Likes

It’s there to set people up with dns based clustering out of the box, which is a common way of connecting nodes, like on fly.io, but also for things like kubernetes afaik. When disabled is simply does nothing. You can remove it if you don’t need it.

4 Likes

Yep I’ve noticed that the :ignore parameter to it simply prevents it from starting but I still don’t want the dns_cluster in my dependencies.

Thanks, I am removing it then.

There is this video where @chrismccord talks about dns_cluster…

…in the distributed Elixir chapter

2 Likes