A simple distributed systems logic JAVA
Tools
1. Maven 2. Zookeeper 3. Java
#you need JDK 1.8 or later installed on machine first ..
Step
- follow link https://zookeeper.apache.org/releases.html to download
- unzip or unrar, paste in a preferred location
- locate conf folder & change zoo_sample.cfg file to -> zoo.cfg
- open terminal >>> in bin location and run ./zkService start (logs folder will be created automatically in zookeeper folder)
- update dataDir in zoo.cfg file ->>>> eg.(mine) dataDir=home/***/zookeeper/logs
--bin dir <> contains CL tools for zookeeper
Demo includes
- create a child nodes to join cluster
- using Zookeeper to simplify selection a leader in a cluster( zookeeper algorithm makes it simple to elect a node)
- using watchers to trigger alerts on failure of a node , i.e= stopped, deleted, noResponse, etc 1. Fault-tolerant implementation
- re-election a node to become a leader, 1. adding nodes dynamically 2. prevent hard effect elimination of node with no bottlenecks
- Implementation of Service Registry & service discovery
- Add callback to leader election in cluster
- Build & Implement multithreaded http server with standard java libraries 1. the server will have two endpoints 2. /status - handles GET requests(Reports the health of the application) 3. /task - handles POST requests(sends results)
- creating custom headers
- Testing Http server created(Use cURL to test the endpoints) 1. eg. curl --request GET -v localhost:8080/status - to get status of server 2. eg. curl --request POST -v --data "xxx" localhost:8080/task - to post data to server