Riak TS Cluster with Docker

riak-docker

The Riak TS database, a distributed NoSQL key/value store optimized for time series data, was recently open sourced.  Time series data is any metric that has time in its denominator, such as CPU and request per seconds over time.  This type of databases are great for metrics, log analytics, IoT sensor data, etc, etc.

This post will show you how to set-up a 3 node Riak TS cluster with docker compose. Clone out the Github repository with the docker-compose file and change dir into that directory.

You should pull the image first:


docker pull garland/riak-ts:1.3.0-1

Next, we will turn up the cluster by executing the docker compose command:


docker-compose up

A bunch of log message will fly by, here is a snippet of it:


riaktsdocker_riak1_1 is up-to-date
Recreating riaktsdocker_riak3_1
Recreating riaktsdocker_riak2_1
Attaching to riaktsdocker_riak1_1, riaktsdocker_riak3_1, riaktsdocker_riak2_1
riak3_1 | ++ grep -v 127.0.0.1
riak3_1 | ++ grep -Eo '([0-9]*\.){3}[0-9]*'
riak3_1 | ++ grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*'
riak3_1 | ++ ifconfig
riak3_1 | + LOCAL_IP=172.18.0.3
riak3_1 | ++ head -1
riak3_1 | ++ ping -c 1 riak1
riak3_1 | ++ grep -E -o '[0-9]+.[0-9]+.[0-9]+.[0-9]+'
riak3_1 | + RIAK_1_IP=172.18.0.2

......

......

......

riak3_1 | 2016-05-24 05:50:58.159 [info] @riak_core_gossip:log_node_changed:351 'riak@172.18.0.3' changed from 'joining' to 'valid'
riak3_1 | 2016-05-24 05:50:58.159 [info] @riak_core_gossip:log_node_changed:351 'riak@172.18.0.4' changed from 'joining' to 'valid'
riak2_1 | 2016-05-24 05:50:58.129 [info] @riak_core_gossip:log_node_changed:351 'riak@172.18.0.3' changed from 'joining' to 'valid'
riak2_1 | 2016-05-24 05:50:58.129 [info] @riak_core_gossip:log_node_changed:351 'riak@172.18.0.4' changed from 'joining' to 'valid'

Once you see the last joining messages, the cluster is up!   You can view the 3 containers running with this command:


docker ps

This output will show 3 containers running and the names of the containers:


CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
473fb8937d96 garland/riak-ts:1.3.0-1 /bin/sh -c /opt/star 11 minutes ago Up 11 minutes riaktsdocker_riak2_1
add0832fca71 garland/riak-ts:1.3.0-1 /bin/sh -c /opt/star 11 minutes ago Up 11 minutes riaktsdocker_riak3_1
7a6fc715eece garland/riak-ts:1.3.0-1 /bin/sh -c /opt/star 12 minutes ago Up 11 minutes 0.0.0.0:8098:8098/tcp riaktsdocker_riak1_1

You can verify by using the riak-admin command to see the status of the cluster:


docker exec riaktsdocker_riak2_1 riak-admin member_status

Here’s the cluster status output:

================================= Membership ==================================
Status Ring Pending Node
-------------------------------------------------------------------------------
valid 34.4% -- 'riak@172.18.0.2'
valid 32.8% -- 'riak@172.18.0.3'
valid 32.8% -- 'riak@172.18.0.4'
-------------------------------------------------------------------------------
Valid:3 / Leaving:0 / Exiting:0 / Joining:0 / Down:0

Now you have a 3 node Riak TS cluster running locally on your machine!

Advertisements

3 thoughts on “Riak TS Cluster with Docker

    1. Odd, not sure why your setting named the container “riaktsdockermaster_riak2_1” while when i run it, it names it “riaktsdocker_riak2_1”.


      gkan@fish:~/Documents/repositories/flowlog-stats.com/drywall-flowlog-stats$ docker ps
      CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
      473fb8937d96 garland/riak-ts:1.3.0-1 "/bin/sh -c /opt/star" 6 days ago Up 32 seconds riaktsdocker_riak2_1
      add0832fca71 garland/riak-ts:1.3.0-1 "/bin/sh -c /opt/star" 6 days ago Up 32 seconds riaktsdocker_riak3_1
      7a6fc715eece garland/riak-ts:1.3.0-1 "/bin/sh -c /opt/star" 6 days ago Up 32 seconds 0.0.0.0:8098->8098/tcp riaktsdocker_riak1_1

      But basically you want to use one of the named container to run this command in. Anyone will do.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s