- The distributed file system is designed for basic file handling operations including write, read, delete and update.
- Utilizes Leader-Follower architecture to handle the operations and the master(leader) is selected through the leader election process.
- Tolerate multiple node failures without impacting file availability and file handling functionalities. Every file is written onto 3 nodes asynchronously via an active replication process to maintain 3 replicas of the file in case of node failure. The put and read operation make use of Simple Write Quorum wherein R = W = 2.
- Utilizes heartbeat monitoring for failure detection. Every node sends and receives heartbeat messages from 2 successor and 2 predecessor nodes in a ring topology.
Deployed on 3 AWS EC2 instances and 10 nodes. Achieved 35ms for write/update and 10ms for read for 100 Mb file size. Also working when not using AWS, just need to change up the config and main file.
- Set up PAT Code if you don't have it already.
- Set up 3 AWS EC2 Instance. I used Ubuntu t2.micro for all 3. Configure the security groups and VPC settings accordingly.
- Set up key pairs and ssh into all 3 instances accordingly.
- Edit the GatewayNodes value within the config.json file. Put in the value of the PRIVATE ip address of the instances you want to be the initial master/leader.
- Perform
git clone
this repo on all 3 instances. sudo apt-get update
andsudo apt install golang-go
cd go-fs/cmd
andgo build ./
go run main.go -i
to initialize the file system. Perform this command on the instance that has the private address you set up within GatewayNodesgo run main.go
on any 1 of the other 2 instances to Join the file system.go run main.go -g
on the remaining 1 to act as the local/guest machine.- The following commmands are available:
ls lshere get <remote file> <local file> put <local file> <remote file> remove <remote file> locate <remote file> report exit
- Lastly, remember to STOP/TERMINATE the EC2 instances when you are done to avoid charges.
-
Membership (A group of nodes can form a membership.)
- Determine leader to be the node that starts the membership
- Each membership is a replica for the file service
- Able to join and leave a group.
- Handling node failures and network partitions.
- Heartbeat to detect failures as shown
-
File Client and Server
- File operations for Client:
-
put
(upload) -
get
(download) -
remove
(delete) -
locate
(find) -
ls
(list all files) -
lshere
(list files at current node)
-
- Server manage file storage and respond to client requests.
- File operations for Client:
-
File Operation and Membership Commands
- Initializing a new group
- Joining an existing group
- Leaving the group
- File operations (
put
,get
,remove
,locate
,ls
,lshere
)
-
Replication and Consistency
- Data replication across multiple nodes.
- Consistency for replicated data.
- Sync for file operations.