Coder Social home page Coder Social logo

arkgil-tanodb's Introduction

tanodb

A riak_core application

Build

make release

Test

rebar3 ct

Run

make console

Try

1> tanodb:ping().
{pong,753586781748746817198774991869333432010090217472}

Quit

2> q().

Play with Clustering

Build 3 releases that can run on the same machine:

make devrel

Start them in different consoles:

make dev1-console
make dev2-console
make dev3-console

join 2 nodes to the first one:

make devrel-join

check the status of the cluster:

make devrel-status

you should see something like this:

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

it should say that 3 nodes are joining, now check the cluster plan:

make devrel-cluster-plan

it should display the cluster plan, now we can commit the plan:

make devrel-cluster-commit

check the status of the cluster again:

make devrel-status

you could see the vnodes transfering:

================================= Membership ==================================
Status     Ring    Pending    Node
-------------------------------------------------------------------------------
valid      75.0%     25.0%    '[email protected]'
valid       9.4%     25.0%    '[email protected]'
valid       7.8%     25.0%    '[email protected]'
-------------------------------------------------------------------------------
Valid:3 / Leaving:0 / Exiting:0 / Joining:0 / Down:0

at some point you should see something like this:

================================= Membership ==================================
Status     Ring    Pending    Node
-------------------------------------------------------------------------------
valid      33.3%      --      '[email protected]'
valid      33.3%      --      '[email protected]'
valid      33.3%      --      '[email protected]'
-------------------------------------------------------------------------------
Valid:3 / Leaving:0 / Exiting:0 / Joining:0 / Down:0

when you are bored you can stop them:

make devrel-stop

Riak Core Metadata

Create some variables in all nodes you are going to run the calls:

FullPrefix = {<<"tanodb">>, <<"config">>}.
Key1 = key_1.
Val1 = <<"value 1">>.

Run each line on any node:

riak_core_metadata:get(FullPrefix, Key1).
% undefined

riak_core_metadata:get(FullPrefix, Key1, [{default, default_value_here}]).
% default_value_here

riak_core_metadata:put(FullPrefix, Key1, Val1).
% ok

riak_core_metadata:get(FullPrefix, Key1).
% <<"value 1">>

riak_core_metadata:to_list(FullPrefix).
% [{key_1,[<<"value 1">>]}]

riak_core_metadata:delete(FullPrefix, Key1).
% ok

riak_core_metadata:to_list(FullPrefix).
% [{key_1,['$deleted']}]

Trace Metadata Calls:

ReturnTrace = fun(_) -> return_trace() end.
% at most 1000 calls per second
Rate = {1000, 1000}.
recon_trace:calls([{riak_core_broadcast, '_',
        fun ([A, _]) when A /= lazy_tick -> return_trace() end},
           {riak_core_metadata_hashtree, '_', ReturnTrace},
           {riak_core_metadata_object, '_', ReturnTrace},
           {riak_core_metadata_manager, '_', ReturnTrace},
           {riak_core_metadata_exchange_fsm, '_', ReturnTrace},
           {riak_core_metadata, '_', ReturnTrace}], Rate).

Clear the trace:

recon_trace:clear().

TODO

  • define license and create LICENSE file

License

TODO

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.