Starting with Riak – Part I

Read reader,

This is first post of my Raik journey. Journey of discovering and crafting Riak database. Riak is an open-source, fault-tolerant key-value NoSQL database written in Erlang. I cannot it describe better than Basho who invented it below.

Basho’s goals for Riak

Goal Description
Availability Riak writes to and reads from multiple servers to offer data availability even when hardware or the network itself are experiencing failure conditions
Operational simplicity Easily add new machines to your Riak cluster without incurring a larger operational burden
Scalability Riak automatically distributes data around the cluster and yields a near-linear performance increase as you add capacity
Masterless Your requests are not held hostage to a specific server in the cluster that may or may not be available

Installation

I choose install from source, before you install make sure you have already installed Xcode, Java and Erlang. Don’t use homebrew installation, in time writing this it has old version 1.4.7 which didn’t work for me. Here is list of commands which I executed:

wget http://s3.amazonaws.com/downloads.basho.com/riak/2.0/2.0.0pre11/riak-2.0.0pre11.tar.gz
tar zxvf riak-2.0.0pre11.tar.gz
cd riak-2.0.0pre11
make rel

I assume you are install your risk to directory /Users/xyz/riak-2.0.0pre11 and risk libs will be located on path
riak-2.0.0pre11/rel/riak/bin. Please add this path to $PATH file accordingly:

sudo nano /etc/paths

Now we are going to do five minute install describe in risk documentation here.
Go back to path where you installed risk to create five node cluster by following commands:

make all
make devrel DEVNODES=5
for node in `ls`; do $node/bin/riak start; done
for node in `ls`; do $node/bin/riak ping; done
for n in {2..5}; do dev$n/bin/riak-admin cluster join dev1@127.0.0.1; done

Congratulation, you are proud owner or Riak cluster!
Now you can check your cluster plan by riak-admin on any node:

dev1/bin/riak-admin cluster plan

and commit the batch:

dev2/bin/riak-admin cluster commit

Also you can check how well balanced your cluster is by:

dev1/bin/riak-admin member-status

My Intention with Riak

If you thinking about high available and fault-tolerant cluster for computing great amount operations, let’s say I’d love to compute
millions of pattern recognition which database has the best assumptions to achieve this task. I think the Riak is the right one.

Next Steps

I will write basic CRUD operations with languages Erlang and F#.

I hope this is useful for you!

Reference:

http://docs.basho.com/riak/2.0.0pre11/theory/why-riak/

http://en.wikipedia.org/wiki/Riak

Advertisements

Greetings!

Hello everyone,

I’d like to welcome you at my new blog about data science with functional approach. This blog has main purpose as textbook for my findings, for things I found interesting to share or discuss. I will try to write regularly every weekend, my topic is broad from tips about functional languages like F#, Haskell, Erlang, Scala via data science languages like R or Julia to more interesting and more complex topics about machine learning, statistics and crunching big data.

I hope you find my blog enjoyable, please let me know everything what you like to discuss or know more or even correct my thought. I’m all ears!