I’m trying to connect to a remote node but the request keeps getting rejected. The error is: “Connection attempt from disallowed node”. I understand this means the cookie is invalid, i.e. doesn’t match the running node.
When I SSH to the remote machine and run cat vm.args
I see:
## Name of the node
-name myapp@127.0.0.1
## Cookie for distributed erlang
-setcookie JGpXR9PPNYgMLhMii#3VktVMUAb7dRU3G3VdLsLYXk6t
When I start a session on the remote machine, this cookie shows up as:
$: iex sname will --cookie JGpXR9PPNYgMLhMii#3VktVMUAb7dRU3G3VdLsLYXk6t
Interactive Elixir (1.5.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(will@iex_test)1> :erlang.get_cookie()
:"JGpXR9PPNYgMLhMii#3VktVMUAb7dRU3G3VdLsLYXk6t"
No matter how I tried to represent the cookie I get this error: {cookie}
, '{cookie}'
, "{cookie}"
, :"{cookie}"
.
I’m deploying the application inside a Docker container. My cookie is exported as an environment variable and I’m wondering if it’s getting set in a different format when grabbed by System.get_env("COOKIE")
in the Docker container than when it’s set from the shell.