All Projects → simonacca → Zatt

simonacca / Zatt

Licence: agpl-3.0
Python implementation of the Raft algorithm for distributed consensus

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Zatt

Hraftd
A reference use of Hashicorp's Raft implementation
Stars: ✭ 732 (+515.13%)
Mutual labels:  consensus, raft, distributed-systems
Rqlite
The lightweight, distributed relational database built on SQLite
Stars: ✭ 9,147 (+7586.55%)
Mutual labels:  consensus, raft, distributed-systems
Atomix
A reactive Java framework for building fault-tolerant distributed systems
Stars: ✭ 2,182 (+1733.61%)
Mutual labels:  consensus, raft, distributed-systems
Verdi Raft
An implementation of the Raft distributed consensus protocol, verified in Coq using the Verdi framework
Stars: ✭ 143 (+20.17%)
Mutual labels:  consensus, raft, distributed-systems
Raft
Raft Consensus Algorithm
Stars: ✭ 370 (+210.92%)
Mutual labels:  consensus, raft, distributed-systems
raftor
Distributed chat system built with rust
Stars: ✭ 31 (-73.95%)
Mutual labels:  distributed-systems, raft, consensus
Etcd
Distributed reliable key-value store for the most critical data of a distributed system
Stars: ✭ 38,238 (+32032.77%)
Mutual labels:  consensus, raft, distributed-systems
little-raft
The lightest distributed consensus library. Run your own replicated state machine! ❤️
Stars: ✭ 316 (+165.55%)
Mutual labels:  distributed-systems, raft, consensus
Dragonboat
Dragonboat is a high performance multi-group Raft consensus library in pure Go.
Stars: ✭ 3,983 (+3247.06%)
Mutual labels:  consensus, raft, distributed-systems
coolbeans
Coolbeans is a distributed work queue that implements the beanstalkd protocol.
Stars: ✭ 56 (-52.94%)
Mutual labels:  distributed-systems, raft, consensus
Copycat
A novel implementation of the Raft consensus algorithm
Stars: ✭ 551 (+363.03%)
Mutual labels:  consensus, raft, distributed-systems
Nuraft
C++ implementation of Raft core logic as a replication library
Stars: ✭ 428 (+259.66%)
Mutual labels:  consensus, raft, distributed-systems
Bifrost
Pure rust building block for distributed systems
Stars: ✭ 118 (-0.84%)
Mutual labels:  consensus, raft, distributed-systems
Yaraft
Yet Another RAFT implementation
Stars: ✭ 109 (-8.4%)
Mutual labels:  consensus, raft
Awesome Distributed Systems
A curated list to learn about distributed systems
Stars: ✭ 7,263 (+6003.36%)
Mutual labels:  consensus, distributed-systems
Kingbus
A distributed MySQL binlog storage system built on Raft
Stars: ✭ 798 (+570.59%)
Mutual labels:  raft, distributed-systems
Blog
my blog, using markdown
Stars: ✭ 25 (-78.99%)
Mutual labels:  raft, distributed-systems
Abci Host
Clojure host/server for Tendermint's ABCI protocol.
Stars: ✭ 18 (-84.87%)
Mutual labels:  consensus, distributed-systems
Consensus Yaraft
consensus-yaraft is a library for distributed, strong consistent, highly replicated log storage. It's based on yaraft, which is an implementation of the Raft protocol.
Stars: ✭ 30 (-74.79%)
Mutual labels:  consensus, raft
Translations
🐼 Chinese translations for classic IT resources
Stars: ✭ 6,074 (+5004.2%)
Mutual labels:  consensus, distributed-systems

Zatt

Zatt is a distributed storage system built on the Raft consensus algorithm.

By default, clients share a dict data structure, although every python object is potentially replicable with the pickle state machine.

Zatt was developed as part of my thesis work at the University of Trento, Italy. See Slides and Thesis.

Zatt Logo

Please note that the client is compatible with both python2 and python3, while the server makes heavy use of the asynchronous programming library asyncio and is therefore python3-only. This won't affect compatibility with legacy code since the server is standalone.

Structure of the project

The most relevant part of the code concerning Raft is in the states and in the log files.

TODO: extend

Installing

Both the server and the client are shipped in the same package (Note: this link won't work until the project is public).

Zatt can be installed by several means:

Pypi

$ pip3 install zatt. (Note: this won't work until the project is public).

Pip and Git

$ pip3 install git+ssh://github.com/simonacca/[email protected]

Cloning

$ git clone [email protected]:simonacca/zatt.git
$ cd zatt
$ git checkout develop
$ python3 setup.py install

Regardless of the installation method, $ zattd --help should work at this point.

Examples

This screencast shows a basic usage of the code. The code run can be found below.

asciicast

Spinning up a cluster of servers

A server can be configured with command-line options or with a config file, in this example, we are going to use both.

First, create an empty folder and enter it: $ mkdir zatt_cluster && cd zatt_cluster.

Now create a config file zatt.conf with the following content:

{"cluster": {
    "0": ["127.0.0.1", 5254],
    "1": ["127.0.0.1", 5255],
    "2": ["127.0.0.1", 5256]
 }
}

You can now run the first node:

$ zattd -c zatt.conf --id 0 -s zatt.0.persist --debug

This tells zattd to run the node with id:0, taking the info about address and port from the config file.

Now you can spin up a second node: open another terminal, navigate to zatt_cluster and issue:

$ zattd -c zatt.conf --id 2 -s zatt.2.persist --debug

Repeat for a third node, this time with id:2

Client

To interact with the cluster, we need a client. Open a python interpreter ($ python) and run the following commands:

In [1]: from zatt.client import DistributedDict
In [2]: d = DistributedDict('127.0.0.1', 5254)
In [3]: d['key1'] = 0

Let's retrieve key1 from a second client:

Open the python interpreter on another terminal and run:

In [1]: from zatt.client import DistributedDict
In [2]: d = DistributedDict('127.0.0.1', 5254)
In [3]: d['key1']
Out[3]: 0
In [4]: d
Out[4]: {'key1': 0}

Notes

Please note that in order to erase the log of a node, the corresponding zatt.{id}.persist folder has to be removed.

Also note that JSON, currently used for serialization, only supports keys of type str and values of type int, float, str, bool, list, dict.

Tests

In order to run the tests:

  • clone the repo if you haven't done so already: git clone [email protected]:simonacca/zatt.git
  • navigate to the test folder: cd zatt/tests
  • execute: python3 run.py

Contributing

TODO

License

TODO

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].