appagile-cassandra

AppAgile Cassandra

This release bases on cloud native deployment of cassandra on kuebernetes that can be found here https://github.com/kubernetes/kubernetes/tree/master/examples/cassandra. For documentation on native deployment refer to this readme https://github.com/kubernetes/kubernetes/blob/master/examples/cassandra/README.md.

Caution:
Node Port in multitier environment

The port number of the nodeport cannot be configured as a parameter due to problems with numerical values.
There are two ways to configure the node port.
– Set node port directly in template.

yaml
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "${DATABASE_SERVICE_NAME}",
"annotations": {
"description": "Exposes the database server"
}
},
"spec": {
"ports": [
{
"name": "cassandra",
"port": 9042,
"targetPort": 9042,
"nodePort": **30488**
}
],
"selector": {
"name": "${DATABASE_SERVICE_NAME}"
},
"type": "NodePort"
}
},
...

  • Edit the service after creation and set the nodePort to the desired value.

Templates

There are a couple of different templates that can be utilized.
* ephemeral templates
single tier template
multitier template
* persistent template
– single tier template: –
mutlitier template
This template uses persistent volumes. Make sure they are available.

Deploy ephemeral cassandra from template

The commands below assume that you have checked out the repository with command

“`
git clone https://gitdev.tsi-af.de/ose/appagile-cassandra.git

“`

and changed directory to ${checkout-dir}/appagile-cassandra

With the following command you can deploy the cassandra cluster from the terminal within your project.

oc process -f appagile-cassandra-multitier-template.json -v PARAMETER1=value1,PARAMETER2=value2 | oc create -f -

Parameters:

“name: “CASSANDRA_SERVICE_NAME”,
“description”: “Database service name”,
“value”: “cassandra”

“name”: “CASSANDRA_IMAGE”,
“description”: “Image to use for cassandra”,
“value”: “vmapgmucrep01.appacd.tsi-af.de:5000/test/appagile-cassandra:v1”

“name”: “MAX_HEAP_SIZE”,
“description”: “Database Pod Max Heap Size”,
“value”: “512M”

“name”: “HEAP_NEWSIZE”,
“description”: “Database Pod Max Heap New Size”,
“value”: “100M”

“name”: “KUBE_HOST”,
“description”: “Master Server on the enviroment”,
“value”: “https://vmapgprodmst5n1.appad5.tsi-af.de:8443”

Deploy persistent cassandra in a multitier environment from template

This cassandra-template utilizes persistent storage. For this reason scaling with openshift methodology does not work.
Every cassandra-node has to be created with a new deployment. Therefore you have to pass the Parameter NODE_ID with different IDs each. They are all composed together via one service. See template appagile-cassandra-service-template.json. To start a Cassandra instance as seed the name must contain the word seed, e.g. seed01. At least one seed is required in a cluster.

Create the following resources to get a persistent cassandra cluster up and running.
1. create the service
2. create the cassandra role
3. create multiple cassandra nodes

The commands below assume that you have checked out the repository with command

“`
git clone https://gitdev.tsi-af.de/ose/appagile-cassandra.git

“`

and changed directory to ${checkout-dir}/appagile-cassandra

Create a service

oc process -f appagile-cassandra-service-template.json -v CASSANDRA_SERVICE_NAME=cassandra | oc create -f -

Create a rolebinding

oc process -f appagile-cassandra-role-template.json -v CASSANDRA_SERVICE_NAME=cassandra | oc create -f -

Create a cassandra node

With the following command you can deploy one node into the cassandra cluster from the terminal within your project. If you like to add more than one, then use the command multiple times and use a unique NODE_ID each time. To start a Cassandra instance as seed the name must contain the word seed, e.g. seed01. At least one seed is required in a cluster.

oc process -f appagile-cassandra-persistent-multitier-template.json -v NODE_ID=node-01,CASSANDRA_SERVICE_NAME=cassandra | oc create -f -

Parameters:

“name”: “CASSANDRA_SERVICE_NAME”,

“description”: “Cassandra service name”,
“value”: “cassandra

“name”: “CASSANDRA_IMAGE”,

“description”: “Image to use for cassandra”,
“value”: “vmapgmucrep01.appacd.tsi-af.de:5000/test/appagile-cassandra:v1”

“name”: “MAX_HEAP_SIZE”,

“description”: “Database Pod Max Heap Size”,
“value”: “512M”

“name”: “HEAP_NEWSIZE”,

“description”: “Database Pod Max Heap New Size”,
“value”: “100M”

“name”: “KUBE_HOST”,

“description”: “Master Server on the enviroment”,
“value”: “https://vmapgprodmst5n1.appad5.tsi-af.de:8443”

“name”: NFS_DATA_STORAGE_SIZE,

“description”: “Central storage to be claimed for data”,
“value”: “1Gi”

“name”: “NODE_ID”,

“description”: “ID of Node – must be unique in a cluster, e.g. node-01. Name must contain ‘seed’ to start a Cassandra seed instance, e.g. seed01. At least one seed is required in a cluster.”,
“value”: “node-01”

Build docker image, build SeedProvider from source code

Use make to create the image from scratch. You have to have java development 1.8 and maven installed to successfully build the image. Further more the build will not succeed when running behind a cooperate proxy.

Helpful commands

add secret to access central docker registry

“`
oc secrets new-dockercfg dockerregcfg \
–docker-server=https://vmapgmucrep01.appacd.tsi-af.de:5000/v2 –docker-username=” –docker-password=”” –docker-email=”<your.emailadress.com>”

oc secrets add serviceaccount/default secrets/dockerregcfg –for=pull

“`