Skip to content

kennyyu/cs262project

Repository files navigation

Project
=======
Distributed Grading

CS262 Group
===========
Kenny Yu
Tony Ho
Jim Danz
Stefan Muller
Rob Bowden
Willie Yao
Leora Pearson

To import into Eclipse:
======================
1) Make a directory (e.g. cs262) that will be your eclipse workspace directory.
2) cd into that directory, and execute:
      git clone git@github.com:kennyyu/cs262project.git
3) Open up eclipse and set the workspace to be the cs262 directory.
4) Go to File > Import... > General > Existing Projects Into Workspace
5) Select root directory to be the current directory.
6) 'cs262project' should show up on the bottom. Hit OK.

NOTE:
* Every time you pull new changes, click on the project's name on the left side 
  (containing the directory tree), and hit 'refresh'

Dependencies:
============
* MongoDB (http://www.mongodb.org/)
* Apache Tomcat (http://tomcat.apache.org/)
* Java SDK 1.6

To compile:
==========
To compile, execute:
    $ make

To run tests + generate code coverage report:
============================================
Tests require JUnit installed. To compile and run the JUnit tests, execute:
    $ make test

Note: mongod must be in your PATH, and you must have Java SDK 1.6
The code coverage report will be generated as html files in the coverage/ directory

To run tests on the SEAS cloud, use:
   $ make seastest

To run the services:
===================
0. Place the hostnames of all replicas into the config/services.config file, and
in WebContent/WEB-INF/lib/config/services.config. 

1. Start the rmi registry:

     $ rmiregistry &

2. Launch the appropropriate service. The update flag forces the rmi registry to
bind the name of the service to this current running instance.

     $ ./GradeStorageService [--update]

3. Copy the WebContent directory to the Apache Tomcat webapps/ directory.

4. Copy the compiled project directory classes/ into webapps/WebContent/WEB-INF

Note: For persistent storage services, also start the MongoDB instance.

To congif MongoDB replica set:
=============================

To setup each database, use "mongo_setup" located in the project root. Usage:

./mongo_setup [database name] [port #]

A sample valid command:

./mongo_setup graded 28001

The script will setup a database with that name and localhost:port #

To config the databases so they work as a replication set, use "mongo_config":

./mongo_config [database name] [port #1] [port #2] [port #3]

Currently it only supports exactly 3 distinct port numbers for 1 primary
and 2 secondary databases. We may change it.. but it's of little consequence.
Note that 3 folders with the port name will be created in the same directory
as the script for storing the databases.

Valid set of commands for setting up a fault tolerant database would be
(and this would be done once per database):

./mongo_setup graded 28001
./mongo_setup graded 28002
./mongo_setup graded 28003
./mongo_config graded 28001 28002 28003

Be sure to set your path to mongo.

It would also be trivial for these 2 script to take ip address + port number if we don't
want to set up these databases locally.

Detailed instructions (that can be ignored) below:
=================================================

1. Create data directory

mkdir <PATH>/node1
mkdir <PATH>/node2
mkdir <PATH>/node3

2. Starting Mongod 

./mongod --replSet <same replSet Name> --port 27017 --dbpath <PATH>/node1
./mongod --replSet <same replSet Name> --port 27018 --dbpath <PATH>/node2
./mongod --replSet <same replSet Name> --port 27019 --dbpath <PATH>/node3

3. Config the Replica Set

./mongo localhost:27017

Execute the following command to define the configuration members within your replica set:

> config = {_id: '<replSet Name>', members: [
               {_id: 0, host: 'localhost:27017'},
               {_id: 1, host: 'localhost:27018'},
               {_id: 2, host: 'localhost:27019'}]
           };
Once you have the configuration defined, you need to initial your configuration by executing: 

> rs.initiate(config);

To check everything is running as expected execute:

> rs.status();

More info here:
http://www.littlelostmanuals.com/2011/11/quick-example-of-mongodb-replica-set.html
http://www.mongodb.org/display/DOCS/Replica+Set+Configuration
http://www.mongodb.org/download/attachments/9830402/mongodb+replica+sets+intro.pdf
http://www.mongodb.org/display/DOCS/Replica+Sets#ReplicaSets-Gettingstarted

About

Final Project for CS 262 - Distributed Grading, or How I Learned to Stop Worrying and Love the Scores My Peers Give Me

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •