/DSA-P2

Distributed Systems & Algorithms Project 2

Primary LanguagePython

DSA-P2

Distributed Systems & Algorithms Project 2

Useful links

Project Prompt

ZooKeeper Slides

ZooKeeper’s atomic broadcast protocol: Theory and practice

Leader Election algorithms (we are using the Bully algorithm)

Order of events

  • Upping all servers individually
  • All upped servers start two listeners
  • One listener for client on client_port
  • One listener for server connections on server_port
  • Client sends "start" to one server
  • Server that receives "start" broadcasts election start to other servers
  • For now, it can just broadcast "I am your leader"
  • When a server receives a "leader is #" message
  • Stop server listener
  • Leader server runs "lead_connections" and other servers run "leader_listener"
  • After connections are formed, re-initialize listener for server

Config file formatting:

[Server number] [Server IP] [server_port] [leader_port] [client_port]

Testing

Run 3 servers with

$ . ./test_scripts/run3.sh

Run test case with

$ python cli_client.py <server-host> <server-client-port>  <  <input-file>

Kill the running servers with

$ . ./test_scripts/kill.sh

Message types

For requesting and committing transactions

['transaction_request', operation, epoch-string, counter-string, originator-num] - follower requests a transaction to leader
['transaction_proposal', transaction-string, epoch-string, counter-string, originator-num] - transaction proposal from leader to followers
['transaction_acknowledge', transaction-string, epoch-string, counter-string, originator-num] - trasaction accept/acknowledge from follower to the leader
['transaction_commit', transaction-string, epoch-string, counter-string, originator-num] - leader committing a transaction to the followers

For elections

['election', server-number, epoch-string, counter-string] - Initiating election
['higher_id', server-number, epoch-string, counter-string] - Response to election
['lower_id', server-number, epoch-string, counter-string] - Response to election
['coordinator', server-number, epoch-string, counter-string] - Become coordinator

TODO:

  • Elections
  • two-phase commits
  • Rebuild recovered server from written history & downloaded history