UniversityOfHelsinkiCS / distributed-file-system

5 stars 0 forks source link

Distributed File System

Instructions

How to install

# Create virtual environment
$ python3 -m venv .venv

# Activate virtual environment
$ source .venv/bin/activate

# Install dependencies
$ pip install -r requirements.txt

How to run

With Docker

# Create storage directory if it doesn't exist
$ mkdir storage
# Starts the application with three replicas in ports 8000, 8001, and 8002
$ docker compose up

Without Docker

# Run in development mode
$ fastapi dev app/main.py

Code quality

# Lint
$ pylint app

# Format
$ black app

Overview

The goal of this project is to create a distributed file system using a multinode leader-follower architecture. The system will be deployed on a hosted OpenShift Kubernetes cluster. This project is developed as part of the course Distributed Systems offered by the University of Helsinki.

Technologies

Messaging protocols

Functionalities

Shared distributed state

Synchronization and consistency

Consensus

Fault tolerance

Architecture

One server node is always selected as the leader, which will handle writes. The other server nodes will act as follower nodes, each of which can handle reads.

Server nodes

Leader node:

Follower nodes:

Ingress/Load balancer node

Diagram

graph TD;
    subgraph VM1[VM 1 Leader]
        N1 --> Disk1[Disk]
        N1 --> Redis1[(Redis Metadata)]
    end

    subgraph VM2[VM 2 Follower]
        N2 --> Disk2[Disk]
        N2 --> Redis2[(Redis Metadata)]
    end

    subgraph VM3[VM 3 Follower]
        N3 --> Disk3[Disk]
        N3 --> Redis3[(Redis Metadata)]
    end

    Client
    Client <--> K8s[K8s Ingress];

    K8s <-.-> N1;
    K8s <-.-> N2;
    K8s <-.-> N3;

    VM1 --> VM2;
    VM1 --> VM3;

Team members

Challenges and considerations