- GET (Syntax: GET key): Returns the corresponding value.
- PUT (Syntax: PUT key value): Adds the KV pair to the database.
- DEL (Syntax: DEL key): Delete key from database.
- STORE (Syntax: STORE): Print entire database.
The database is distributed and can run on multiple machines.
- Clone the branch depending on communication method (tcp, udp, rmi)
- Compile files using
javac Program.java
- If running the program on multiple physical hosts, replace localhost in the below commands to that host's ip address.
- For running on same host use localhost.
Running command syntax (For 2 nodes. Can be extended similarly to n nodes):
java Program <current_node_id> <total_node_count> <node_1_id>:<node_1_ip_address> <node_2_id>:<node_2_ip_address>
-
For running 2 nodes run these commands in 2 different terminals:
- For node 0:
java Program 0 2 0:localhost 1:localhost
- For node 1:
java Program 1 2 0:localhost 1:localhost
-
Similarly For running 3 nodes run these commands in 3 different terminals:
- For node 0:
java Program 0 3 0:localhost 1:localhost 2:localhost
- For node 1:
java Program 1 3 0:localhost 1:localhost 2:localhost
- For node 2:
java Program 2 3 0:localhost 1:localhost 2:localhost
-
For running 4 nodes run these commands in 4 different terminals:
- For node 0:
java Program 0 4 0:localhost 1:localhost 2:localhost 3:localhost
- For node 1:
java Program 1 4 0:localhost 1:localhost 2:localhost 3:localhost
- For node 2:
java Program 2 4 0:localhost 1:localhost 2:localhost 3:localhost
- For node 3:
java Program 3 4 0:localhost 1:localhost 2:localhost 3:localhost
- If running on multiple physical hosts use following command:
- On host 0:
java Program 0 2 <host_0_ip_address> <host_1_ip_address>
- On host 1:
java Program 1 2 <host_1_ip_address> <host_0_ip_address>
Running command syntax (For 2 nodes. Can be extended similarly to n nodes):
java Program <current_node_id> <total_node_count> <node_1_ip_address> <node_2_ip_address>
-
For running 2 nodes run these commands in 2 different terminals:
- For node 0:
java Program 0 2
- For node 1:
java Program 1 2
-
Similarly For running 3 nodes run these commands in 3 different terminals:
- For node 0:
java Program 0 3
- For node 1:
java Program 1 3
- For node 2:
java Program 2 3
-
For running 4 nodes run these commands in 4 different terminals:
- For node 0:
java Program 0 4
- For node 1:
java Program 1 4
- For node 2:
java Program 2 4
- For node 3:
java Program 3 4
- If running on multiple physical hosts use following command:
- On host 0:
java Program 0 2 <host_0_ip_address> <host_1_ip_address>
- On host 1:
java Program 1 2 <host_1_ip_address> <host_0_ip_address>
Running command syntax (For 2 nodes. Can be extended similarly to n nodes):
java Program <current_node_id> <total_node_count> <node_1_ip_address> <node_2_ip_address>
-
For running 2 nodes run these commands in 2 different terminals:
- For node 0:
java Program 0 2
- For node 1:
java Program 1 2
-
Similarly For running 3 nodes run these commands in 3 different terminals:
- For node 0:
java Program 0 3
- For node 1:
java Program 1 3
- For node 2:
java Program 2 3
-
For running 4 nodes run these commands in 4 different terminals:
- For node 0:
java Program 0 4
- For node 1:
java Program 1 4
- For node 2:
java Program 2 4
- For node 3:
java Program 3 4