/nubedb

Simple distributed K/V Database

Primary LanguageGoGNU Affero General Public License v3.0AGPL-3.0

NubeDB

NubeDB is a simple distributed key-value database that uses the Raft consensus algorithm for data replication and consistency.

Features

  • Distributed and replicated data storage
  • Simple to use
  • Automatic fail-over and recovery if any of the nodes go down.
    • Limitations:
      • The system needs 1 leader and 2 nodes to operate correctly.
      • It can go down as far as 1 leader and 1 node, but there are no warranties that it will be stable.
  • TODO:
    • True auto-scaling, in which a number of arbitrary nodes can be removed when the whole cluster is down, and the system can still reach a quorum on startup.

Table of Contents

Getting started

Starting a cluster

docker-compose up -d

Using the API

NubeDB provides a simple REST API for accessing its k/v database. You can interact with it using any HTTP client.

Consensus

State

To check the consensus state, you can send a GET request to consensus:

Healthcheck

To check the consensus health, you can send a GET request to health. It will return only a status code for simplicity:

Database

Store

To store a value for a key, you can send a POST request to store:

Get

To retrieve a value for a key, you can send a GET request to store:

GetKeys

To retrieve all keys in the DB, you can send a GET request to store/keys:

Delete

To delete a key, you can send a DELETE request to store:

Backup

To get a full backup of the DB, you can visit or send a GET request to store/backup:

Restore

To restore a backup of the DB, you can send a POST request to store/restore:

First ensure you are sending a form-data with a key backup as a file:

Example: