This realization of this part has already been done by us.
- Download project from Gitlab to VMs
git clone https://gitlab.engr.illinois.edu/xinranw5/MachineProgramming.git
- The latest version of codes is on master branch
- Locate projects on /home of each VM, and move files
// go to /home/MachineProgramming/
cd /home/MachineProgramming/
// change the first line of mp.config to the number of each vm
// make sure that this file is in /home/MachineProgramming/src
sudo vi mp.config
We use gradle in this MP to help us build and run the programs.
- Run MP3 (& MP2) We use the same task name to run the main program of MP3
cd /home/MachineProgramming/
// Run Detector
// Gradle will compile and run this task automatically
gradle Detector
- Run Logger (MP1) For MP1, we can also use the same way to run Server and Client
cd /home/MachineProgramming/
// Run Client
gradle Client
// Run Server
gradle Server
// make sure that /home/mp1/ contains vm_x.log file
The Detector will continuously receive user input, until the input is "quit" or the process is killed. The program will deal with those input:
- quit Detector will quit.
- join This node will join into the group(If the introducer is active).
- leave This node will leave the group.
- show Show the id of this node, its membership list and all the members in this group.
- master Set the current machine as master
- store See what files are stored in this machine
- put localFile sdfsFile Put files into SDFS
- get sdfsFile localFile Read a file from SDFS
- delete sdfsFile Delete a file from SDFS
- get_version sdfsFile num_version localFile Get k versions of a file into localFile
- ls sdfsFile List where a file is stored
- msshow Show the file list on master
- msversion Show the file versions on master