Dynomite and RocksDB running on Docker

Dynomite is a kick ass cluster/proxy solution that provides high availability and strong consistent to databases. Dynomite was created and battle tested by Netflix using Memcached and Redis as primary store backend.

RocksDB it's a Facebook Embedded Key/Value store which is growing up a lot because of his incredible high performance and low latency.

For this blog post, I will show some simple project I create for the developers to get started with Dynomite and RocksDB together. This project uses docker and creates a Dynomite cluster using RocksDB as backend.

Let's get started...




Dynomite Super Powers

Dynomite is interesting for many reasons but one very simple and limited way to see Dynomite as a supercharged Redis with batteries included. Why not use ElastiCache(Amazon Redis managed service) well because first of all you should think twice before get fully coupled to Amazon or any public cloud vendor.  In the beginning, it might look like a good idea since you have all sorts of services that are integrated but there are many limitations and as you get a vendor LOCK IN you won't be able to get better and cheaper competitors offers and also it can be less available. I guess everybody remembers last S3 outage almost tear down the whole with it. If you have a portable solution you can run your solution in other cloud vendors like Google or Azure. Solutions like Spinnaker can help you a lot with that but they won't help you if your persistence system is fully coupled to one vendor.

IMHO because Dynomite is based on Amazon Dynamo paper still has superior clustering solution them original Redis cluster(Master/Replica) and elastiCacheit's pretty much the same cluster as OSS Redis Cluster but managed by AWS.

Another more comprehensive and correct way to see Dynomite is looking as a Generic Supercharger because as long as you have something that talks Redis protocol you can benefit from all Redis ecosystem and Dynomite as well.  There is a very nice project which helps on that front called ARDB.

Dynomite-Docker-RocksDB project

Basically this a very simple and tiny project. Where I have some bash scripts to create Dynomite clusters using ARDB and RocksDB as persistent backend. Let's see how to get started. First of all, you need to make sure you have Docker installed on your Linux.

How to install it?

git clone https://github.com/diegopacheco/dynomite-docker-rocksdb.git
cd dynomite-docker-rocksdb/

How bootstrap a simple cluster

cd dynomite-docker-rocksdb/
./dynomite-docker.sh run_single 0.5.8

Checking with Docker

You can run a docker ps to see thar are 3 images running.

$ docker ps
CONTAINER ID        IMAGE                                COMMAND                  CREATED             STATUS              PORTS                                 NAMES
ce924ebfa311        diegopacheco/dynomitedockerrocksdb   "/usr/local/dynomi..."   13 seconds ago      Up 12 seconds       8101-8102/tcp, 16379/tcp, 22222/tcp   dynomite3
b5ef6d44841b        diegopacheco/dynomitedockerrocksdb   "/usr/local/dynomi..."   14 seconds ago      Up 13 seconds       8101-8102/tcp, 16379/tcp, 22222/tcp   dynomite2
1822be0c7c01        diegopacheco/dynomitedockerrocksdb   "/usr/local/dynomi..."   14 seconds ago      Up 13 seconds       8101-8102/tcp, 16379/tcp, 22222/tcp   dynomite1

How test the cluster

In order to test the cluster we will run DCC: Dynomite Cluster Checker another side project I have to check dynomite deploys. DCC will setup a dyno client in java and connect on the cluster and perform a series of validations.

cd dynomite-docker-rocksdb/
./dynomite-docker.sh dcc_single

After DCC runs you shall see a report like this:

[
  {
    "server":"[172.18.0.101:8101:rack1:dc:100, 172.18.0.102:8101:rack2:dc:100, 172.18.0.103:8101:rack3:dc:100]",
    "seeds":"172.18.0.101:8101:rack1:dc:100|172.18.0.102:8101:rack2:dc:100|172.18.0.103:8101:rack3:dc:100",
    "insertTime":"0",
    "consistency":"true"
,  },
  {
    "server":"172.18.0.101",
    "seeds":"172.18.0.101:8101:rack1:dc:100",
    "getTime":"0",
    "consistency":"true"
,  },
  {
    "server":"172.18.0.102",
    "seeds":"172.18.0.102:8101:rack2:dc:100",
    "getTime":"0",
    "consistency":"true"
,  },
  {
    "server":"172.18.0.103",
    "seeds":"172.18.0.103:8101:rack3:dc:100",
    "getTime":"0",
    "consistency":"true"
,  }
]
}

--
TIME TO RUN: 3 seconds

Getting information about the cluster

cd dynomite-docker-rocksdb/
./dynomite-docker.sh info

You should see something like this:

$ ./dynomite-docker.sh info
Cluster 1 - Topology :
token: 100 dc: dc
  rack1 - 172.18.0.101
  rack2 - 172.18.0.102
  rack3 - 172.18.0.103
Seeds: 172.18.0.101:8101:rack1:dc:100|172.18.0.102:8101:rack2:dc:100|172.18.0.103:8101:rack3:dc:100

Avaliable Dynomite version: v0.5.8 and v0.5.9

Using Redis cli

You can also use redis-cli and connect to any node of the cluster: 172.18.0.101, 172.18.0.102 and 172.18.0.103. Here we are using port 8102 which is dynomite port.

$ redis-cli -p 8102 -h 172.18.0.101
172.18.0.101:8102> keys *
1) "DCC_dynomite_failoiverk"
172.18.0.101:8102>

That's it!

Now you have fun with Dynomite + RocksDB using docker. This is useful for:

  • Debugging
  • Testing
  • Testing Configs
  • Troubleshooting
  • General Development
Cheers,
Diego Pacheco


Popular posts from this blog

Having fun with Zig Language

C Unit Testing with Check

Cool Retro Terminal