Distributed java file search engine as part of project for college
I am using zookeeper 3.4.12 version for this and JAVA 17 under maven project
First start the zookeeper server
run the front end jar now run the cluster and slave node jar file with 4 instances for 3 slaves and 1 master
Whichever registers first will become the master
Here left most instance marked is the leader And top right is watching the leader and bottom left is watching top right And bottom right is watching bottom left as shown in Image. Here leader is keeping service registry which contain address of slaves To make system fault tolerant Now if we open frontend web browser search engine
Now we can give any term and search engine will give us the best result by calculating tf-idf algorithm. Suppose I give the term “monster” it should give us books from it’s database related to that term.
And below is the image how work was distributed
The top left was the leader and it distributed the work among 3 slaves by dividing the 18 files from database evenly for each slave. Now suppose any slave gets disconnected It should be updated to master registry
In the above Image bottom right node was terminated and it’s address was removed from registry which we can see in top left marked image And now the search engine should be working fine but the documents will be dived among 2 nodes
Now in the nodes work was divided only across two nodes Now suppose if leader itself gets terminated ,new leader will be elected
As we can see leader is terminated and top right was elected as leader and it has service registry Now there is only one slave all the documents has to be searched by only 1 slave
Now only bottom left was the only slave remaining .Hence it received all the 18 documents from database. And also user can read whichever book they want to read from clicking on the name in front end page