Wednesday, January 4, 2017

Update from Cloud-Team: Deploying Cassandra Image as a Container in Bluemix

Introduction to Cassandra

Apache Cassandra is an open source distributed database that is built above the amazon Dynamo data distribution design and the bigtable data model. It is built to manage and handle very large amount of data that can be deployed across many servers and still provide high availability and performance. Cassandra's ring architecture is designed to be a peer-to-peer decentralised system where there is no single point of failure. The architecture is masterless and all the nodes are equally important. This distributed nature of its architecture allows for better scalability , high availability and operations simplicity. Additionally, Cassandra supports a SQL-like query language called CQL that can be used easily during the modelling and retrieving of the stored data.
One of the most common use cases for using Cassandra is to deal with time-series data.This makes Cassandra the best candidate for our use which is to have a historian service that logs all type of events (raw sensor events, processed events, and watering command events) to a persistence store. The historical data stored in Cassandra can be used later to provide analytics and insights into the farm watering process.
In this blog, I plan to give a quick tutorial in how to run cassandra as a container in IBM cloud platform "Bluemix". 

Deploy Cassandra as a docker container in Bluemix:

Below are the steps to deploy cassandra as a docker container in Bluemix:

  • If it hasn't been done already, you need to sign up for Bluemix account and create an organization/space. There are plenty of tutorials in the internet to do so. It should be an easy straight-forward step.
  • Login and select your organization/space that was created in the first step using the below terminal command:
 cf login
  • Install the bluemix container "cf ic" terminal plugin using the below terminal command:
cf install-plugin
  • Create a namespace:
cf ic namespace set <namespace_name>
  • Prepare the container plugins "cf ic":
cf ic init
  • Copy the cassandra official docker image to bluemix:
cf ic cpi cassandra:latest<namespace_name>/cassandra:latest
  • Confirm that the image copied:
cf ic images
  • Run the cassandra docker container in bluemix:
cf ic run --name cassandra -p 9042:9042 -d<namespace_name>/cassandra:latest
  • Confirm that the container is running:
cf ic ps 
  • Request a public IP address from Bluemix:
cf ic ip request
  • Bind the created IP address to the running cassandra container:
cf ic ip bind <IP_Address> cassandra
  • Confirm that cassandra container is up and running and test it with some queries using cqlsh:
cf ic exec -it cassandra bash
  • After executing all the above steps, you should be able to see the container running in bluemix as shown below:

No comments:

Post a Comment