Skip to content

Instantly share code, notes, and snippets.

@narrowtux
Created September 14, 2022 07:46
Show Gist options
  • Save narrowtux/cf9b2e35b94422dc8c422a4879fa5211 to your computer and use it in GitHub Desktop.
Save narrowtux/cf9b2e35b94422dc8c422a4879fa5211 to your computer and use it in GitHub Desktop.
Distributed Erlang with WSL in the mix

Distributed Erlang with WSL

Checklist

  • Set the same erlang cookies (~/.erlang-cookie or :erlang.set_cookie :abc)

  • On the WSL machine, use ifconfig to find out the IP address of the WSL machine

  • Start nodes with FQDN using their IP address as hostname: iex --name main@[ip] -S mix [command]

  • On the WSL machine, run epmd -names to find the port of the erlang node that has just been started

  • On the WSL host, run these commands in powershell:

    netsh interface portproxy add v4tov4 listenport=[epmd port] listenaddress=0.0.0.0 connectport=[epmd port] connectaddress=[wsl ip]
    netsh interface portproxy add v4tov4 listenport=[main node port] listenaddress=0.0.0.0 connectport=[main node port] connectaddress=[wsl ip]
    

    The first opened port is for epmd, the second port should be the port that epmd -names reported for the erlang node main@.... Be sure to replace the IP adresses with the one from the WSL machine.

  • On any of the erlang nodes, execute Node.connect :"main@192...." to connect to the other one. It should return true and Node.list() should show that node too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment