Code Monkey home page Code Monkey logo

raftsies's Introduction

raftsies

CircleCI

This is a fault-tolerant key/value storage system using Raft for distributed consensus. The implemention is pure Python without any 3rd party dependencies (but test dependencies are in dev-requirements.txt).

⚠️ I implemented this for learning and fun only, definitely do not use this in a production context. I started working on this during David Beazley's excellent Raft class (check it out here, you should take it!).

Running the raft cluster

Run in separate Python interpreters (can do on a single host for testing) or on separate hosts:

./run.py <node_num>

where <node_num> is unique and corresponds to the entries in config.json.

./run.py 0
./run.py 1
./run.py 2
./run.py 3
./run.py 4

To start a node in a particular server state (FOLLOWER, CANDIDATE or LEADER) for debugging purposes:

./debug.py <node_num> LEADER

Configuration is stored in config.json. An example config is committed. For demo purposes you may want to slow down the elections (so it's easier to follow the node messages), e.g. making the election start and stop times longer, but note that the heartbeat time should be faster than the shortest election time.

make clean removes all the persistent raft state, including the transaction log. This is useful for testing purposes.

Interact with cluster as a client

./example_client.py

Development

pip install -r dev-requirements.txt
make test  # unsurprisingly this run tests
make lint  # runs linter and type checker

raftsies's People

Contributors

redshiftzero avatar

Stargazers

Scott avatar

Watchers

James Cloos 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.