OpenEBS for Cassandra
This tutorial provides detailed instructions to run a Kudo operator based Cassandra StatefulSets with OpenEBS storage and perform some simple database operations to verify the successful deployment and it's performance benchmark.
#
IntroductionApache Cassandra is a free and open-source distributed NoSQL database management system designed to handle a large amounts of data across nodes, providing high availability with no single point of failure. It uses asynchronous masterless replication allowing low latency operations for all clients.
OpenEBS is the most popular Open Source Container Attached Solution available for Kubernetes and is favored by many organizations for its simplicity and ease of management and it's highly flexible deployment options to meet the storage needs of any given stateful application.
Depending on the performance and high availability requirements of Cassandra, you can select to run Cassandra with the following deployment options:
For optimal performance, deploy Cassandra with OpenEBS Local PV. If you would like to use storage layer capabilities like high availability, snapshots, incremental backups and restore and so forth, you can select OpenEBS cStor.
Whether you use OpenEBS Local PV or cStor, you can set up the Kubernetes cluster with all its nodes in a single availability zone/data center or spread across multiple zones/ data centers.
#
Deployment model#
Configuration workflow- Install OpenEBS
- Select OpenEBS storage engine
- Configure OpenEBS Local PV StorageClass
- Install Kudo operator
- Install Kudo based Cassandra
- Verify Cassandra is up and running
- Testing Cassandra performance on OpenEBS
#
Install OpenEBSIf OpenEBS is not installed in your K8s cluster, this can be done from here. If OpenEBS is already installed, go to the next step.
#
Select OpenEBS storage engineA storage engine is the data plane component of the IO path of a Persistent Volume. In CAS architecture, users can choose different data planes for different application workloads based on a configuration policy. OpenEBS provides different types of storage engines and chooses the right engine that suits your type of application requirements and storage available on your Kubernetes nodes. More information can be read from here.
#
Configure OpenEBS Local PV StorageClassIn this tutorial, OpenEBS Local PV device has been used as the storage engine for deploying Kudo Cassandra. There are 2 ways to use OpenEBS Local PV.
openebs-hostpath
- Using this option, it will create Kubernetes Persistent Volumes that will store the data into OS host path directory at: /var/openebs/<cassandra-pv>
/. Select this option, if you don’t have any additional block devices attached to Kubernetes nodes. You would like to customize the directory where data will be saved, create a new OpenEBS Local PV storage class using these instructions.openebs-device
- Using this option, it will create Kubernetes Local PVs using the block devices attached to the node. Select this option when you want to dedicate a complete block device on a node to a Cassandra node. You can customize which devices will be discovered and managed by OpenEBS using the instructions here.
#
Install Kudo operator to install CassandraMake the environment to install Kudo operator using the following steps.
Choose the Kudo version. The latest version can be found here. In the following command, selected Kudo version is v0.14.0.
Change the permission
Install Cert-manager
Before installing the KUDO operator, the cert-manager must be already installed in your cluster. If not, install the cert-manager. The instruction can be found from here. Since our K8s version is v1.16.0, we have installed cert-manager using the following command.
Install Kudo operator using a specified version. In the following command, the selected version is v0.14.0.
Verify Kudo controller pods status
#
Install Kudo operator based CassandraInstall Kudo based Cassandra using OpenEBS storage engine. In this example, the storage class used is openebs-device
. Before deploying Cassandra, ensure that there are enough block devices that can be used to consume Cassandra application, by running kubectl get bd -n openebs
.
#
Verify Cassandra is up and runningGet the Cassandra Pods, StatefulSet, Service and PVC details. It should show that StatefulSet is deployed with 3 Cassandra pods in running state and a headless service is configured.
Login to one of the Cassandra pod to verify the Cassandra cluster health status using the following command.
Create a Test Keyspace with Tables. Login to one of the Cassandra pod and run the following commands from a cassandra pod.
Example command:
Creating a Keyspace. Now, let’s create a Keyspace and add a table with some entries into it.
Creating Data Objects
Inserting and Querying Data
Updating a data
#
Testing Cassandra Performance on OpenEBSLogin to one of the cassandra pod and run the following sample loadgen command to write and read some entry to and from the database.
Get the database health status
Go to the directory where the binary is located.
Run Write load
Run Read Load
#
See Also:OpenEBS architecture OpenEBS use cases Local PV concepts Understanding NDM