A simple KV-Store which runs as a Leader Follower cluster.
- Handwritten binary protocol for client-server communication (No JSON or Protobuf 🙅♂️).
- Auto registration of new followers added to cluster.
- TTL for KV entries.
- Leader follower architecture.
- Leader maintains a map of its followers with their addresses.
- Leader runs on
:3000
- Follower runs on random ports.
- When follower boots up, it establishes a new TCP connection with Leader and Leader registers the follower by storing its details.
- When a SET, DEL command is given, leader ensures that all the followers are in sync with the given command.
- SET command can be paired up with a TTL(in seconds), after which entry will be removed from the store
- Working installation of Go (pref above 1.15)
- CLI
$ make leader
$ make follower
- Have a response timeout from the followers so that leader can know when a follower has went down.
- GET queries should be forwarded to the followers by the leader. (Optional, bring in a reverse proxy(handwritten) which can distribute the load in a Round-Robin fashion)
- Implement a consensus algorithm which can elect a leader amongst themselves, when a leader fails to send a heartbeat to its followers.