Git Product home page Git Product logo

nkbase's Introduction

Introduction

NkBASE is a distributed, highly available key-value database designed to be integrated into Erlang applications based on riak_core. It is one of the core pieces of the upcoming Nekso's Software Defined Data Center Platform, NetComposer.

NkBASE uses a no-master, share-nothing architecture, where no node has any special role. It is able to store multiple copies of each object to achive high availabity and to distribute the load evenly among the cluster. Nodes can be added and removed on the fly. It shows low latency, and it is very easy to use.

NkBASE has some special features, like been able to work simultaneously as a eventually consistent database using Dotted Version Vectors, a strong consistent database and a eventually consistent, self-convergent database using CRDTs called dmaps. It has also a flexible and easy to use query language that (under some circunstances) can be very efficient, and has powerful support for auto-expiration of objects.

The minimum recommended cluster size for NkBASE is three nodes, but it can work from a single node to hundreds of them. However, NkBASE is not designed for very high load or huge data (you really should use the excellent Riak and Riak Enterprise for that), but as an in-system, flexible and easy to use database, useful in multiple scenarios like configuration, sessions, cluster coordination, catalogue search, temporary data, cache, field completions, etc. In the future, NetComposer will be able to start and manage multiple kinds of services, including databases like a full-blown Riak.

NkBASE has a clean code base, and can be used as a starting point to learn how to build a distributed Erlang system on top of riak_core, and to test new backends or replication mechanisms. NkBASE would have been impossible without the incredible work from Basho, the makers of Riak: riak_core, riak_dt and riak_ensemble.

Features

  • Highly available, allowing read and write operation even in case of node failures.
  • Operation friendly. Nodes can be added and removed on the fly.
  • Scalable from three to hundreds of nodes.
  • Disk (leveldb) and memory (ets) backends.
  • Three simultaneous operation modes:
    • Eventually consistent mode using Dotted Version Vectors.
    • Strong consistent mode based on using riak_ensemble's multi-paxos.
    • Easy to use, self-convergent dmaps.
  • Multiple, auto-generated secondary indices, usable in the three modes.
  • Simple, easy to use, utf8 and latin-1 aware query language for secondary indices.
  • Full support for auto-expiration of objects, with configurable resolution.

Documentation

Quick Start

Follow this steps to start a 5-node development cluster in a single machine:

git clone https://github.com/Nekso/nkbase.git
cd nkbase
make
make dev1

then, at another terminal console:

cd nkbase
make dev2

> nkbase_admin:join("[email protected]").
Success: staged join request for '[email protected]' to "[email protected]"
ok

and repeat for nodes 3 to 5. Then go to any of the nodes and run:

> nkbase_admin:cluster_plan().
=============================== Staged Changes ================================
Action         Details(s)
-------------------------------------------------------------------------------
join           '[email protected]'
join           '[email protected]'
join           '[email protected]'
join           '[email protected]'
-------------------------------------------------------------------------------


NOTE: Applying these changes will result in 1 cluster transition

###############################################################################
                         After cluster transition 1/1
###############################################################################

================================= Membership ==================================
Status     Ring    Pending    Node
-------------------------------------------------------------------------------
valid     100.0%     25.0%    '[email protected]'
valid       0.0%     25.0%    '[email protected]'
valid       0.0%     25.0%    '[email protected]'
valid       0.0%     12.5%    '[email protected]'
valid       0.0%     12.5%    '[email protected]'
-------------------------------------------------------------------------------
Valid:5 / Leaving:0 / Exiting:0 / Joining:0 / Down:0

Transfers resulting from cluster changes: 6
  1 transfers from '[email protected]' to '[email protected]'
  1 transfers from '[email protected]' to '[email protected]'
  2 transfers from '[email protected]' to '[email protected]'
  2 transfers from '[email protected]' to '[email protected]'

ok

and

> nkbase_admin:cluster_commit().
Cluster changes committed
ok

Congratulations! Now you have a 5-node NkBASE cluster. At any of the nodes, type:

> nkbase:put(domain, class, key, "my_value")
ok

and, at any other node,

> nkbase:get(domain, class, key)
{ok, ..., "my_value"}

Contributing

Please contribute with code, bug fixes, documentation fixes or any other form. Use GitHub Issues and Pull Requests, forking this repository.

nkbase's People

Contributors

altrg avatar kalta avatar ninioperdido avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nkbase's Issues

Installing nkbase error

I have followed the site instruction to install

git clone https://github.com/Nekso/nkbase.git
make

(I have erlang R17 installed)

with the result,

Compiled src/synctree_orddict.erl
Compiled src/synctree.erl
Compiled src/riak_ensemble_peer.erl
Compiling c_src/riak_ensemble_clock.c
==> pbkdf2 (compile)
ERROR: Cannot parse OTP Release version string: 17
ERROR: compile failed while processing /private/tmp/nkbase/deps/pbkdf2: rebar_abort
make: *** [compile] Error 1

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.