Skip to content

Latest commit

 

History

History
46 lines (31 loc) · 1.12 KB

12_NodeAndDistributedErlang.md

File metadata and controls

46 lines (31 loc) · 1.12 KB

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 [email protected] on a Hamler REPL console:

hamler repl
> import Control.Distributed.Node
> import Control.Distributed.NetKernel
> start :"[email protected]"

Start [email protected] on another Hamler REPL console, then connect to the [email protected] node:

hamler repl
> import Control.Distributed.Node
> import Control.Distributed.NetKernel
> start :"[email protected]"
> connectNode :"[email protected]"
true
> nodes
['[email protected]']

RPC

-- TODO: ...