5

I'm trying to start Erlang slave node on cluster and I receive bash: erl: command not found message. Though I have alias for erl. Here is what I actually do:

[user@n001 ~]$ erl -rsh ssh -sname n001    
Eshell V5.7.5  (abort with ^G)
    (n001@n001)1> slave:start_link("user@n002", n002, "-rsh ssh").
    bash: erl: command not found
                                {error,timeout}
    (n001@n001)2>

Maybe, there is something wrong? Thanks.

UPDATE:
I've added Erlang bin dir to my $PATH variable; I've set $ERLANG_ROOT_DIR variable; created symlink in ~/ to erl - but nothing have changed...
I have installed Erlang in ~/bin/erlang dir...

Tofu
  • 199
  • 2
  • 12
Zim
  • 585
  • 2
  • 8
  • 15

5 Answers5

2

The trouble was in bash: Actually erlang connects to node via ssh, invoking default sh in non-interactive mode. But when bash is started in non-interactive mode, it doesn't read .bashrc where my path variables and aliases are stored. So I switched to zsh and all is ok now! ;)

Zim
  • 585
  • 2
  • 8
  • 15
  • 1
    `.bashrc` usually contains the following line near the top: # If not running interactively, don't do anything [ -z "$PS1" ] && return So if you define your `PATH` variable before that, you can use your custom `erl`. Bash *does* read .bashrc in non-interactive mode. – aronisstav Feb 26 '13 at 12:21
1

I believe that the alias won't be honored

erl needs to actually be in your path

Also, I believe that your .bashrc doesn't execute either. So you may have to symlink "erl" to /usr/bin or /usr/local/bin

David Budworth
  • 11,248
  • 1
  • 36
  • 45
  • Thanks for trying to help..but.. I've added erlang bin dir to my $PATH variable; I've set $ERLANG_ROOT_DIR variable; created symlink in ~/ to erl - but nothing have changed... Btw, I have installed erlang in ~/bin/erlang dir... – Zim Apr 18 '10 at 12:58
1

You seem to be using a wrong format for the Host field of start_link/3;

It should be an atom representing the host where the node Name (second parameter, also an atom) should be started, resulting in node Name@Host.

So in your case that would be

slave:start_link('n002', 'n002', "-rsh ssh").
Berzemus
  • 3,618
  • 23
  • 32
  • Thanks, but slave:start_link('n002', 'n002', "-rsh ssh"). executes with the same result - > slave:start_link('n002', 'n002', "-rsh ssh"). bash: erl: command not found {error,timeout} – Zim Apr 19 '10 at 13:41
0

my guess is erlang cookie.

can you ping n002 ? if yes, then do the two nodes have the same cookie ?

for example you can try: erl -sname abc -rsh ssh -setcookie secretcookie

erl> slave:start(n002, name, "-setcookie secretcookie"). %% so these two nodes share a cookie

ssyeoh
  • 1
0

Just use

>ssh user@n002 erl

to check if erl is ok on n002.

Gentle Y
  • 331
  • 1
  • 10