iyjim

iyjim

How to set env.sh.eex for DNSCluster?

Tried DNSCluster recently, but it did not connect my 2 nodes in LAN automatically. Used ‘DNS_CLUSTER_QUERY’ as keyword to google search the Internet, and read all I got, my DNSCluster still cannot connect my 2 nodes in LAN automatically.

Please help:

Here is part of my env.sh.eex of node1:

export APP_NAME="myapp"
export DNS_CLUSTER_QUERY="${APP_NAME}.internal"
export RELEASE_DISTRIBUTION=name
export RELEASE_NODE="${APP_NAME}@192.168.1.1" # for node1

And here is part of my env.sh.eex of node2:

export APP_NAME="myapp"
export DNS_CLUSTER_QUERY="${APP_NAME}.internal"
export RELEASE_DISTRIBUTION=name
export RELEASE_NODE="${APP_NAME}@192.168.1.2" # for node2

After run
_build/prod/rel/myapp/bin/myapp start_iex
on each node, the output of Node.list() is always [] no matter how long I waited.

But if I did Node.connect(:"myapp@192.168.1.2") in node1, Node.list() will have another node name in the output, and the Phoenix PubSub works across these 2 nodes.

What did I miss? Why DNSCluster did not connect my 2 nodes automatically? Please help.

Marked As Solved

sucipto

sucipto

edit:

make sure myapp.internal resolve A record dns both ip 192.168.1.2, 192.168.1.1

# Example, check using iex
iex(app@172.19.0.5)1> :inet_res.lookup(~c"chat.internal", :in, :a)
[{172, 19, 0, 5}]
iex(app@172.19.0.5)2>

Also Liked

iyjim

iyjim

Thanks a lot @sucipto , you save my life!

Where Next?

Popular in Questions Top

sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
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
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
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
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lists...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
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
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New

Other popular topics Top

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
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
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
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
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
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
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
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement