Chepurova Alla
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Group Project 2: Distributed File System Alla Chepurova, Anna Boronina, Ruslan Mihailov ## How to launch and use ### Usage First thing to do before using our DFS is to log in: ![](https://i.imgur.com/vcyOQAN.png) If you type incorrect or invalid cridentials, you will be automatically redirected to tha sign up page where you can create new account for the user: ![](https://i.imgur.com/82QnZFt.png) After creation of new user in our file system, you will be welcomed by the main page where all functionality is executed and managed along with displayed number of free bytes (if new file system was initialized): ![](https://i.imgur.com/BZIo1bm.png) For the sake of visuality, actions among files and directories are separated into 2 sections, where one can easily execute needed commands. The command starts as the button (which represents the action itself) is pressed. Couple of examples of functionality and outputs of our DFS: ![](https://i.imgur.com/btaN6yu.png) ![](https://i.imgur.com/F3fAyoc.png) ## Architectural diagram ![](https://i.imgur.com/VjH02hl.png) ## Description of communication protocols ### Client-Namenode Protocol The communication between the client and the namenode is very simple. Client sends a HTTP request with a json message to the server. The message describes the command and the arguments: ```json { "command": "read_dir", "args":{ "cur_dir": "ruslan/DS/" } } ``` In all the commands, we used the full paths in order to simplify the processing at the namenode side. In return, the client receives the following: ```json # no error occured: { "status": "<3" } # an error occured: { "status": "</3", "args": { "error": "The path isn't valid" } } ``` In case of a file read or write, the client sends a request, as usual. If the response is positive, the client starts to wait for a file from the namenode (which will get from the datanode, of course) or to send a file to the namenode. ### Namenode-Datanode Protocol The communication between the namenode and the datanode is simple as well. The namenode send a HTTP request to the datanode of the following form: ```json { "command": "delete_dir", "args": { "user": "/anya", "path": "/DS" } } ``` In return, the namenode will receive a response message. An example is below. ```json # no error occured: { "status": "OK", "message" : "" } # an error occured: { "status": "Failed", "message" : "Such directory doesn't exist" } ``` ## Heartbeat Protocol ### Initiation. Leader election. ![](https://i.imgur.com/IUMPM8J.png) ![](https://i.imgur.com/QReBpH0.png) ### Master node periodically polls with heart signal datanode and slave replicas to let them node it is alive. Also it gets the response from slaves and decides whether all they are alive. ![](https://i.imgur.com/yuPwyE8.png) ### Master node fails. It is detected by timeout on the slaves and namenode as there would be no heart signal for some time. After that election process would be initiate again. ![](https://i.imgur.com/MXqFp0H.png) ### Slave failure is detected by the abcense of responce from it. ![](https://i.imgur.com/YxNICvV.png) ### Maintaining scalability. Adding one new node. ![](https://i.imgur.com/6Lm49MP.png) #### Namenode-Datanode All the message are managed using HTTP requests and the commands in json representation. The communication with the master node goes in the following way: 1) the master node requests list of the slaves from the namenode and updated its own - some new namenodes could join since the last update, and in this case the master should send them all the files; 2) the master node sends a heartbeat to show that it's alive; 3) the master checks on each of the slave nodes and updates its own list of active namenodes; 4) the master node send its own list of alive nodes to the namenode, then the namenode updates its own list of active slaves and those, who are not present in the received list, marks as inactive. The communication with the other nodes is the following: - if the node has just joined, it will send a request to the namenode to include it in the list of slaves. If this node is the only one in the cluster, it will be set a master; - nodes can send a request to become a master node. In such case, the namenode should check if the master is up (it is checked by checking how much time passed since the last time when the master performed its step 2). If the master is up, the node's request is denied. If the master is, indeed, down, the node will become a new master. ## Link to the GitHub and Docker Hub [Github link](https://github.com/annwhoorma/DS20-project-2) [Data nodes image](https://hub.docker.com/repository/docker/screemix/datastorage) [Client Flask application image](https://hub.docker.com/r/dmmc123/client_web_app) [Namenode image](https://hub.docker.com/repository/docker/whoorma/namenode) [Neo4j used by Namenode image](https://hub.docker.com/repository/docker/whoorma/neo4j-for-namenode) Note that the last two images are both needed for a namenode to work properly. For some reason, while testing, the exposed port 5000 didn't get mapped on the local machine. So, you can test it by running the command below *inside* the namenode container. ``` json curl --header "Content-Type: application/json" --request GET --data '{"command": "init_node", "args": {"node": "10.0.0.1"}}' http://localhost:5000/ ``` ## Contribution of each team member ### Anna Boronina Anna was responsible for the naming server - we will call it a namenode. It is an interface between the client and the storage that makes sure that no bad request is satisfied and the state of the system is consistent. The Namenode is designed in the following way: it accepts a request from the client, processes it, checks the validity of the request and then forwards it to the master datanode. After that, if the master datanode responded "OK", the namenode makes certain changes in its database according to the command received from the client. If the datanode said "Failed", then no changes are applied to the database and the client is notified that the requested operation failed. Some commands can be processed without bothering the datanodes, such as authentication or listing the files in the directory. In addition to that, the namenode is responsible for keeping a list of all active datanodes (knowing who is the main datanode and who are the dependent ones) and check on the main datanode using the heartbeats protocol. Main datanode and the namenode exchange messages to keep the list of the active datanodes consistent. Also, whenever there is a datanode that just joined the system, this datanode will ask the namenode for initialization. ### Alla Chepuróva Alla's task was to implement the communication with the Namenode and logic of interaction between Datanodes: replication of data, dealing with storages, executing commands connecting with file systems, etc. Also the essential part of her task was to implement heartbeat protocol to maintain the consistency, fault tolerance and scalability of the application. As a result, the filesystems could be stored in consistent way on different machines. ### Ruslan Mihaylov Ruslan was implementing a Flask web application for the client. In general, it serves one main purpose - graphical interface for DFS commands. Internally, it's just a bunch of forms and buttons which trigger an application to send json data with command description towards the Namenode. Along with sending json commands according to developed API Ruslan needed to handle file upload/download from the client side. ## Reflection ### Good points 1. Each one of us showed themselves as a completely independent developer. 2. Each one of us showed that they are ready to devote a huge amount of time to learn something new such as files replication across multiple machines or writing an HTTP-server and a client using different approaches. ### Things that could go better 1. We experienced lack of communication within the team. We had only one meeting during which we had discussed what we wanted to see as our final result and split the tasks. We thought that our parts were mostly independent and it would be easy to define how these part were going to communicate in the end. We were definitely wrong about that. 2. Misunderstandings regarding the design. Since we were working mostly independently, some of our wrong conclusions stayed with each team member until the end. For example, the validity checks were implemented in both namenode and datanode. It had led to a lot of lines of redundant code. 3. We didn't agree upon the API from the very beginning. As was mentioned earlier, we thought we would specify it in the end. And then in the end we had to face how different our approaches are. That is why we didn't manage to connect our parts after all.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully