i am learning distributed systems these days and want to implement a small program for fun. This program should work as follows:
- n number of target nodes
- Upload an executable to one node and then that node can send it through other nodes, until the target nodes are met.
- A consensus protocol (raft or paxos) that can do the consensus among these nodes (either start a new node or not).
- A node can be killed and then the program can initialize an extra node to reach the target node.
- Also i want to send the status back to main node. i.e. time required to reach the target node or time between shutting down of a node and start of a new node.
I am practicing this on my local machince and each node can have its own directory.
I dont know where to start and how to proceed along.
I would love to hear back from you guys.
You could try with this article:
It starts with theory and proceeds to elixir example (linking to elixir raft implementation).
To simulate the nodes you could run them in docker (each container has a separate IP) or on localhost on different ports, and break connectivity between them using iptables (firewall rules).
Thanks, it will be a good start. I was wondering, initially instead of using docker can i use
iex --sname node. Do they share state with other nodes, if initiated in different directories ?
Even if initiated in single directory it may not share state. All depends whether you explicitly share state through filesystem, otherwise these instances will be mostly independent.
Why not just have an network abstraction that send messages over erlang distribution. You can hook it up to “real tcp/tls” later… Plus that way you can have a global process do netdown or netlag events by injecting black hole or ring buffer handlers, or nodedowns by shutting down the entire VM.