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
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>
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









