Question

I'm trying to do call from nitrogen to a separate Erlang node on the same machine (currently testing it from the Nitrogen console, but the eventual goal is to have a call from a webapp to this other node). I've got an .erlang.cookie file set up in my home directory.

First attempt, starting the other node with erl -name node_a, then loading and starting an application, then doing

nitrogen@127.0.0.1> rpc:call(node_a@mymachine.fully.qualified.host, ps_bc, generate, [arglist]).

gives me

{badrpc, nodedown}

in the Nitrogen console, and

=ERROR REPORT==== 9-May-2012::14:25:28 ===
** Connection attempt from disallowed node 'nitrogen@127.0.0.1' ** 

in the node_a console. I assume this means that Nitrogen isn't reading the same cookie file as node_a. Is there a way of setting its cookie manually? Is there a way of getting the two nodes to play nice without setting the same cookie for both?

Was it helpful?

Solution

The recommended place to specify the Erlang cookie is in etc/vm.args. The first line should be a -setcookie line.

There is new documentation in the works will properly document specifying the erlang cookie. Thank you for pointing out that it was not in fact documented anywhere. In fact the new documentation will include a complete configuration settings section to help just this kind of thing. Thanks again!

The "in-the-works" documentation for configuration can currently be found at https://github.com/choptastic/nitrogen_core/blob/config-docs/doc/org-mode/config.org (please be aware, this documentation is very raw).

Edit: This is now officially documented here: http://nitrogenproject.com/doc/config.html

OTHER TIPS

Yes, there is a way to use the same cookie for many erlang nodes. For this case, you must not use -setcooke, nor erlang:setcookie/1 for all nodes.

no knowledge of nitrogen i have, but if it is connectivity issue, check the following

From nitrogen node

> node().
> erlang:get_cookie().

From your node

> node().
> erlang:get_cookie().

If cookie is different, use -setcookie to start your node

~$erl -name node_a@127.0.0.1 -setcookie nitrogen_cookie

Simpler than I thought, though it doesn't seem to be documented anywhere other than in the script code itself; bin/nitrogen accepts the -setcookie command line option just as erl would. It accepts -name and -sname too, though neither are particularly relevant here.

Using bighostkim's method tells me that the default nitrogen cookie is, in fact, "nitrogen", so another (less secure) option is to set the other node's cookie to the same.

If someone wants to put this up as a separate answer, go ahead so that I can accept yours (I can't accept my own for another day).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top