distributed file system application
distributed file system application
Akash Maurya
202151013 Date: 21-10-2024
---------------------------------------------------------------------------------
Lab Assignment 7
Distributed File System Application
1. Introduction
The objective of this project is to design and implement a Distributed File
System (DFS) using Python to efficiently store and retrieve data across
multiple server nodes. The DFS ensures scalability, fault tolerance, and
high availability while handling user authentication, file storage, and
retrieval across four servers and one client. The project simulates a
scenario where files are split into chunks and distributed across several
servers, with mechanisms to retrieve, store, and manage files.
2. Implementation
2.1 Client-Side Implementation
The client program facilitates communication with all four servers. The
following functions are implemented in the client:
• Authentication: The client prompts the user to input a username
and password, which are then verified by the servers.
• List Files: The client can request the list of available files stored in
each server's directory.
• Upload Files (put): Files are split into chunks, and each chunk is
distributed to a different server. The client verifies that each chunk is
correctly transferred and stored.
• Retrieve Files (get): The client sends requests to retrieve file chunks
from the respective servers and reassembles them into the original
file on the client-side.
2.2 Server-Side Implementation
Each server (DFS1, DFS2, DFS3, DFS4) operates as a separate process and
listens for connections from the client. Key functionalities implemented on
the server side include:
• User Authentication: The server validates the username and
password provided by the client.
• File Storage: Upon receiving file chunks, the server stores them in a
directory corresponding to the user.
• File Retrieval: The server sends the requested file chunks to the
client for reassembly.
Server 1:
Server 2:
Server 3:
Server 4:
Server 2:
Server 3:
Server 4:
4: Listing Again to see available file
Client:
Server 1:
Server 2:
Server 3:
Server 4:
6: Checking other user can Access the file or not
Client:
Earlier we give the input file with profile “Akash” but when we use list
command with profile name “Vishal” we are unable to see any file this
mean files are safe and cannot be access by other user.
3. System Design
3.1 Overview
The DFS comprises four servers and one client. The client interacts with
the servers for tasks like uploading (putting) files, listing available files, and
retrieving (getting) files. The file system is designed to distribute file chunks
across the four servers to optimize storage and ensure fault tolerance. In
case a server goes down, the system can retrieve the data from other
servers.
3.2 Architecture
• Client: The client acts as the interface between the user and the
distributed system. It handles user authentication, allows the user to
upload or retrieve files, and communicates with all four servers.
• Servers (DFS1, DFS2, DFS3, DFS4): Each server is responsible for
receiving file chunks, storing them in the local directory, and
providing chunks to the client upon request. Each server listens on a
unique port.
The architecture follows a distributed storage approach, where each file
is split into multiple chunks and distributed among the servers, ensuring
that no single server holds the complete file.
3.3 File Storage and Retrieval
The DFS stores files by splitting them into chunks. For example, a file
named Book1.txt is divided into four chunks and distributed across the
servers. The client uploads these chunks in a round-robin fashion, with
each server receiving different parts of the file:
• DFS1 stores Book1_3.txt and Book1_4.txt
• DFS2 stores Book1_1.txt and Book1_4.txt
• DFS3 stores Book1_1.txt and Book1_2.txt
• DFS4 stores Book1_2.txt and Book1_3.txt
When retrieving files, the client gathers chunks from each server and
reassembles them into the original file.
4. Conclusion
This project successfully implements a Distributed File System using
Python, designed for scalability, fault tolerance, and high availability. By
distributing file chunks across multiple servers and ensuring proper fault-
handling mechanisms, the system achieves robust performance even in
the event of server failure. This DFS can be extended further with additional
features such as load balancing, dynamic scaling, and improved security
for real-world applications.
*****