Learn
How to Deploy Elixir Modules @ Different Nodes?
Happy Coding !!
This article explains about Elixir Module Deployment across multiple nodes from the scratch. Here, we go with deep understanding of things like Node Creation, Establishing Node Connection, and Deploying Modules across multiple Nodes.
First we go with module creation which will be shared across the Nodes.
Module Creation
Here we create an Elixir Module with filename my_node.ex
and with convention we name our module as MyNode
.
Create a file using your favorite editor. Here I am using vim
.
$ vim mynode.ex
After creating the file copy the following code snippet and paste it inside the file mynode.ex
.
defmodule MyNode do
def hello do
IO.puts "hi !! #{Node.self()}"
end
end
The code snippet contains a function MyNode.hello/0
and this function will greet you with hi !!
and node name form where you are calling this function. The Node.self()
returns the current node.
After creating a file, compile the file with following command…
$ elixirc mynode.ex