Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time

Node and Distributed Erlang

[ToC]

Distributed Erlang/OTP

Hamler is compiled to Erlang/OTP, which is a concurrent, fault-tolerant, distributed programming platform. A distributed Erlang/OTP system consists of a number of Erlang runtime systems called node. Nodes are connected with TCP/IP sockets and communicate by message passing.

DistributedNodes

Connect Nodes

An Erlang runtime system -- node is identified by a unique name like an email address. Erlang nodes communicate with each other via these names.

Start Erlang epmd for registering node name first:

epmd -daemon

Start n1@127.0.0.1 on a Hamler REPL console:

hamler repl
> import Control.Distributed.Node
> import Control.Distributed.NetKernel
> start :"n1@127.0.0.1"

Start n2@127.0.0.1 on another Hamler REPL console, then connect to the n1@127.0.0.1 node:

hamler repl
> import Control.Distributed.Node
> import Control.Distributed.NetKernel
> start :"n2@127.0.0.1"
> connectNode :"n1@127.0.0.1"
true
> nodes
['n1@127.0.0.1']

RPC

-- TODO: ...