Giter Site home page Giter Site logo

mini-dfs's Introduction

Mini DFS实现

Mini DFS实现,通过线程机制,模仿NameNode和DataNode,实现基本的ls、put、read、fetch命令。

运行说明

  1. 基于python实现,运行mini_dfs.py文件即可: python mini_dfs.py

  2. 指令说明:

    # 列出dfs上的全部文件,返回id, name, length
    MiniDFS > ls
    
    # 将本地文件上传到miniDFS,返回ID
    MiniDFS > put source_file_path
    
    # 读取miniDFS上的文件:文件ID,偏移量,长度
    MiniDFS > read file_id offset count
    
    # 下载miniDFS上的文件:文件ID,保存路径
    MiniDFS > fetch file_id save_path
    
    # 退出
    MiniDFS > quit
    

功能说明

基于python threading实现,模拟分布式环境下TCP通信环境。

  1. 使用1个线程作为NameNode,维护整个DFS的元数据信息和任务调度;使用4个线程作为DataNode,负责文件的存储(每个Block默认为2MB)。

  2. 元数据维护基于pickle进行序列化和反序列化。

  3. 实现的功能的包括:

    • 文件列表
    • 文件上传
    • 多副本存储
    • 文件读取(下载)

存储目录

  1. 当前,在当前可执行文件目录,生成的dfs文件夹作为DFS文件目录。其中datanode0/1/2/3是 每个dataserver的存储目录;namenode是nameserver的存储目录。

  2. 文件被拆分后的命令方法和HDFS类似,比如a.txt-part-0

功能演示

dd

mini-dfs's People

Contributors

weiyucheng avatar zhaoyangliu-leo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.