Built a dynamic, fault-tolerant, and highly scalable document search system by adopting parallel TF-IDF algorithm, Apache Zookeeper, and leader election algorithm.
1.Start server 1(left-top), server 2(right-top), server 3(left-bottom), and server 4(right-bottom) sequentially.

2.Server 1 is the leader, server 2 to 4 are workers.

3.As the leader, server 1 distributes calculation tasks and collects results from worker servers 2 to 4.

4.If one of the workers went down accidentally, the system would still work.

5.If leader server went down, the system would reelect a new leader (server 2) from workers and the system would still work.

6.After the broken server recovered, it will join the workers and listen to the new leader.


