Skip to content

NytePlus/Chfs

Repository files navigation

Chfs

overall-arch

Introduction

这是一个类似于GFS的inode分布式文件系统,在此基础上实现了raft协议和map-reduce任务。你可以查看文档获得具体的信息。

  1. Basic Filesystem: 单机文件系统,在单机上实现基于inode的文件管理
  2. Distributed FileSystem:分布式文件系统,客户端通过远程方法调用访问元数据与数据服务器
  3. Raft:分布式日志协议,维持高可用的日志服务
  4. MapReduce With Distributed File System:在chfs存储上实现大数据mr任务

感谢开源项目DeepWiki支持,同样可以查看 https://deepwiki.com/NytePlus/chfs 获得更便捷的代码访问,同时支持项目问答

Get Started

We use the libfuse userspace library provided by FUSE (Filesystem in Userspace) to implement the adaptor layer. You can refer to daemons/distributed/main.cc for the detailed implementation.

We use docker compose to set up the environment, so you might need to install docker compose plugin first. You can refer to Overview of installing Docker Compose for more details.

To launch the environment, start a shell and execute the following commands under the scripts/lab2 directory:

# pull cse-lab2-base image
docker pull registry.cn-shenzhen.aliyuncs.com/cse-lab/cse-lab2-base
# rename the image
docker tag registry.cn-shenzhen.aliyuncs.com/cse-lab/cse-lab2-base cse-lab2-base
# set up the environment
docker compose up

After this, all containers are launched and initiated. You can use docker ps to check the status of containers. Then open another shell and execute the following command to enter the container that mounts the filesystem:

docker exec -it lab2-fs_client-1 bash

The mount point is at /tmp/mnt in the lab2-fs_client-1 container. The filesystem you have implemented is mounted to this directory, which means that every filesystem request inside this directory will be fulfilled by the filesystem you have implemented.

Run Demo

  • You can create a new directory:

    mkdir my_dir 
  • Then you can create a new file inside the newly created directory:

    touch my_dir/a.txt 
  • Check whether the file is created successfully:

    ls my_dir 
  • After that, you can write something into this file:

    echo "foo" >> my_dir/a.txt
    echo "bar" >> my_dir/a.txt
  • Read the file, then you will see the contents you have just written:

    cat my_dir/a.txt 
  • Then if you do not need this file anymore, delete it:

    rm my_dir/a.txt 

About

A distributed filesystem based on C ++.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •