Skip to content

lufte/elixir-cluster-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

With Docker
-----------

Create a network so containers can see each other

  docker network create elixir

For each node, run the following replacing NAME with a unique name

  docker run -ti --net=elixir -w /root -v $PWD:/root elixir iex --sname NAME node.ex

Put each node's name (NAME@container-id) in hosts

Now create run the host

  docker run -ti --net=elixir -w /root -v $PWD:/root elixir iex --sname host cluster.ex

From the host shell, execute

  import_file "node.ex"
  Cluster.run

In a local network
------------------

For each host

  Create the cookie: echo 123 > ~/.erlang.cookie && chmod 700 ~/.erlang.cookie
  Create the source file with the content of node.ex
  Run the shell: iex --name NAME@hostname node.ex
  Put each node's name (NAME@hostname) in hosts
  
Run the host shell: iex --name host@hostname cluster.ex
From the host shell, execute

  import_file "node.ex"
  Cluster.run

About

Demonstration of Elixir's RPC capabilities

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages