Riak is some hot stuff lately with the increasing need for clusterzitation in the world of NoSQL data stores .
Riak is a solution to big data problem, it was based on Amazon Dynamo design, to respond to request at a very large scale,
Basho introduced Riak as fault tolerant, simple, scalable, high availability friendly .
it’s fairly easy to create/add nodes with riak-admin to a riak cluster, but if this is combined with docker-compose capabilities it will give you the possibility to have an easily deployable/scalable cluster of riak nodes.
I created a docker-compose yaml to specify all the components of the cluster, basically a seed and a set of nodes
I used Hectcastro Riak docker image, because : that’s the beauty of containers, they are reusable !
- install docker-engine and docker compose
- You can either, copy/past the content of those files or clone this repo :
$git clone https://github.com/mbenachour/riak-cluster-compose.git
$cd riak-cluster-compose
- start compose as a daemon :
$docker-compose up -d
- you will have one seed and one node running :
- list all running containers
- let’s create an “Artists” buckets and add an object using node1 (port : 32812)
$curl -i -d '{"name":"Bruce"}' -H "Content-Type: application/json" \ localhost:32812/riak/artists/Bruce
- check the bucket was created :
Scale time ! :
- to scale you cluster you can add 3 nodes
$docker scale riak_node=4
- let’s query node4 for the list of buckets (port: 32818)
works !
if you are more interested to scale on multiple hosts, you can combine this with docker swarm.