In this project, we design and implement a robust Distributed File System (DFS) that ensures redundancy, reliability, and resilience. The system consists of a central metadata server that manages file metadata and various storage nodes responsible for storing file chunks. The DFS supports file uploads, downloads, and searches with built-in load balancing and replication. Additionally, it implements failover and recovery mechanisms to handle storage node failures.
- Metadata Server (Rank 0): Manages metadata and indexing for file chunks.
- Storage Nodes (Ranks 1 to N-1): Store file chunks and handle retrieval requests.
- Fault Tolerance: Includes heartbeat monitoring, failover, and recovery features.
- Files are split into fixed-size chunks (32 bytes each).
- Each chunk is replicated across three distinct storage nodes.
- No requirement to maintain the replication factor in case of failures.
- Distributes chunks evenly across storage nodes.
- Ensures that no node holds more than one replica of the same chunk.
- Each storage node periodically sends a heartbeat to the metadata server.
- If a node fails to send a heartbeat for more than 3 seconds, it is marked as down.
- A separate thread is used to handle heartbeats.
- Failover: Simulates storage node failure by stopping requests and heartbeat signals.
- Recovery: Restores failed nodes, allowing them to resume operations.
- Upload: Splits files into chunks and distributes them with replication.
- Retrieve: Retrieves chunks and reassembles the file.
- Search: Locates offsets containing a specific word within a file.
- Outputs
-1in case of errors (e.g., missing files, unavailable chunks, or invalid operations).
Commands accepted via stdin:
upload file_name absolute_pathretrieve file_namesearch file_name wordlist file file_namefailover rankrecover rankexit
1for successful operations.-1for errors.- Specific output format for
list fileandsearchcommands as described in requirements.
- Minimum of 4 processes required for execution.
- The metadata server is always available (0 downtime).
- Operations are designed to function even with node failures (within limits).