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

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
pgiesin
This should be a simple problem but I just can’t seem to figure it out. I have a standalone Elixir app that won’t find the database. Dep...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
kostonstyle
Hi all I want to have a unix time, from the current time plus 1 hour. DateTime.now + 1 hour How to get it in elixir? Thanks
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
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
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
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
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
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 ...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
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

We're in Beta

About us Mission Statement