Erlang is a functional programming language with the built-in support for concurrency and distributed computing. Nodes running erlang virtual machine can communicate with each other without any additional coding.
Erlang use light weight process model to achieve the distributed computing. Erlang processes are lighter than linux thread. One erlang node can run more than 10k (sometime more than 100k) processes on a single node.
Erlang process is started using spawn or spawn_link function. A process can be started on the current vm (virtual machine) or on any other vm in the grid by just adding one additional parameter to these functions.
In order for 2 nodes to communicate with each other, both nodes should have the same cookie. In a grid, all erlang nodes should have the same secret (set via -setcookie command line option or using erlang:set_cookie/2 function)
Erlang nodes follow the following naming convention.
name@hostname where name can be any arbitrary name
In this example, I am assuming that I have 2 hosts namely node1.example.com and node2.example.com
Run the erlang vm on each node with short name
erl -sname foo -setcookie mysecret
erl -sname bar -setcookie mysecret
On node1.example.com, ping node2.