GithubHelp home page GithubHelp logo

rainlab-inc / nbd-rs Goto Github PK

View Code? Open in Web Editor NEW
13.0 3.0 1.0 269 KB

[READ ONLY MIRROR] Network Block Storage server, written in Rust. Supports pluggable and chainable underlying storage

License: GNU General Public License v3.0

Dockerfile 0.21% Rust 99.79%
nbd block-storage rust disk

nbd-rs's Introduction

nbd-rs

Network Block Device Server written in Rust. Currently in alpha stage. See Disclaimer.

Why?

Main purpose of this project is to explore possibilities around network block storage, using the capabilities of NBD Protocol, but beyond the capabilities of nbd-server. Some of the extended features are:

  • Pluggable backends (Block: Raw, Sharded, Distributed Object: File, S3)
  • Chainable backends (i.e. Cache, Retry)
  • Memory-safety & Race-free NBD Server implementation, thanks to Rust

Disclaimer

DO NEVER USE THIS FOR PRODUCTION

Do not use this for any data that you cannot afford to lose any moment. Expect data loss, corruption/bit rot, and every other possible storage disaster.

If you use alpha level software for your data, you might end up like we did previously => sheepdog/sheepdog#425

We're learning Rust, don't judge. Help instead.

NOT FEATURES

  • You will lose your data if you rely on this alpha software
    • Test it, OK
    • Use it, you will lose your data

Features

See changelog.

  • Ability to serve raw images
  • Ability to serve chunked volumes (a raw image, split into 4MB chunks)
    • from various (pluggable) backends, currently file and s3 backends are implemented
  • Ability to use chainable backends, like cache
  • Ability to distributed chunks to multiple backend storages

General Architecture

TODO: Make a graph / drawing

  • NBD Server
  • -> serves an export(volume)
  • -> uses a BlockStorage internally
    • could be a single RAW image (RawStorage)
    • could be a distributed volume (DistributedStorage)
  • -> uses an ObjectStorage backend (could be chained)
    • could be a single file (mmap'ed) (FileObjectStorage) file:$(pwd)/raw.bin
    • could be multiple files for DistributedStorage (FileObjectStorage) file:$(pwd)/disk1/chunks/
    • could be S3 for multiple files (S3ObjectStorage) s3://minio:minio@localhost:9000/diskbucket/disk1/chunks/
    • could use CacheStorage for memory cache (chained to something else above) cache+s3://minio:minio@localhost:9000/diskbucket/disk1/chunks/

Build

cargo build

The executable binary is located at ./target/debug/nbd-rs.

Run

Subcommands

nbd-rs init --size <SIZE> <DRIVER> <DRIVER_CFG>
nbd-rs serve --export <EXPORT> <DRIVER> <DRIVER_CFG>
nbd-rs destroy <DRIVER> <DRIVER_CFG>

Simple Example

nbd-rs init --size 100Mi raw "file:$(pwd)/raw.bin"
nbd-rs serve --export mydisk raw "file:$(pwd)/raw.bin"
nbd-rs destroy raw "file:$(pwd)/raw.bin"

Multiple Exports

nbd-rs init --size 100Mi raw "file:$(pwd)/raw.bin"
nbd-rs init --size 200Mi raw "file:$(pwd)/raw2.bin"
nbd-rs serve --export disk0 raw "file:$(pwd)/raw.bin" --export disk1 raw "file:$(pwd)/raw2.bin"
nbd-rs destroy raw "file:$(pwd)/raw.bin"
nbd-rs destroy raw "file:$(pwd)/raw2.bin"

Distributed Example

nbd-rs init --size 2Gi distributed "replicas=3;backends=\
cache:s3:http://usename:password@${S3_HOST}/node0,\
cache:s3:http://usename:password@${S3_HOST}/node1;"
nbd-rs serve --export mydisk distributed "replicas=3;backends=\
cache:s3:http://username:password@${S3_HOST}/node0,\
cache:s3:http://username:password@${S3_HOST}/node1;"
nbd-rs destroy distributed "replicas=3;backends=\
cache:s3:http://username:password@${S3_HOST}/node0,\
cache:s3:http://username:password@${S3_HOST}/node1;"

For more advanced examples please look examples.md.

Contributing

VERY WELCOME! (Contributions to the contribution guide is also very welcome.)

Please see CONTRIBUTING.md

COPYING

GPL-3.0

Copyright 2021, Rainlab Inc. Tokyo and nbd-rs contributors (please see commit history)

nbd-rs's People

Contributors

bilalozdemir avatar furkanmustafa avatar keigo-kurita avatar tanaytekin avatar umurgdk avatar

Stargazers

 avatar  avatar  avatar  avatar  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.