Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
- Resolve some typos
- Make the commands and output are clear to avoid confusion

Signed-off-by: Ranjith R <ranjith.raveendran@mayadata.io>
  • Loading branch information
ranjithwingrider authored Oct 19, 2020
1 parent ed6993f commit 0650606
Showing 1 changed file with 49 additions and 38 deletions.
87 changes: 49 additions & 38 deletions k8s/demo/cassandra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ If OpenEBS is not installed in your K8s cluster, this can be done from [here](ht

### Select OpenEBS storage engine

A 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 choose the right engine that suit for your type of application requirements and storage available on your Kubernetes nodes. More information can be read from [here](https://docs.openebs.io/docs/next/overview.html#openebs-storage-engines).
A 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 choose the right engine that suit for your type of application requirements and storage available on your Kubernetes nodes. More information can be read from [here](https://docs.openebs.io/docs/next/overview.html#openebs-storage-engines).

### Configure OpenEBS LocalPV StorageClass

Expand All @@ -46,9 +46,9 @@ In this tutorial, OpenEBS LocalPV device has been used as the storage engine for
- Make the environment to install Kudo operator using the following steps.

```
export GOROOT=/usr/local/go
export GOPATH=$HOME/gopath
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
$ export GOROOT=/usr/local/go
$ export GOPATH=$HOME/gopath
$ export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
```
- Choose the Kudo version. The latest version can be found [here](https://github.com/kudobuilder/kudo/releases). In the following command, selected Kudo version is v0.14.0.
```
Expand All @@ -59,22 +59,23 @@ In this tutorial, OpenEBS LocalPV device has been used as the storage engine for
```
- Change the permission
```
chmod +x kubectl-kudo
sudo mv kubectl-kudo /usr/local/bin/kubectl-kudo
$ chmod +x kubectl-kudo
$ sudo mv kubectl-kudo /usr/local/bin/kubectl-kudo
```
- 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](https://cert-manager.io/docs/installation/kubernetes/#installing-with-regular-manifests). Since our K8s version is v1.16.0, we have installed cert-manager using the following command.
```
kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v0.15.1/cert-manager.yaml
$ kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v0.15.1/cert-manager.yaml
```
- Install Kudo operator using specified version. In the following command, selected version is v0.14.0.
```
kubectl-kudo init --version 0.14.0
$ kubectl-kudo init --version 0.14.0
```
Verify Kudo controller pods status
```
kubectl get pod -n kudo-system
$ kubectl get pod -n kudo-system
NAME READY STATUS RESTARTS AGE
kudo-controller-manager-0 1/1 Running 0 2m40s
```
Expand All @@ -84,17 +85,18 @@ In this tutorial, OpenEBS LocalPV device has been used as the storage engine for
Install 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`.

```
export instance_name=cassandra-openebs
export namespace_name=cassandra
kubectl create ns cassandra
kubectl kudo install cassandra --namespace=$namespace_name --instance $instance_name -p NODE_STORAGE_CLASS=openebs-device
$ export instance_name=cassandra-openebs
$ export namespace_name=cassandra
$ kubectl create ns cassandra
$ kubectl kudo install cassandra --namespace=$namespace_name --instance $instance_name -p NODE_STORAGE_CLASS=openebs-device
```

### Verify Cassandra is up and running

- Get the Cassandra Pods, StatefulSet, Service and PVC details.
- Get 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.
```
kubectl get pod,service,sts,pvc -n cassandra Should show that Statefulset is deployed with 3 Cassandra pods in running state and a headless service is configured.
$kubectl get pod,service,sts,pvc -n cassandra
NAME READY STATUS RESTARTS AGE
cassandra-openebs-node-0 2/2 Running 0 4m
cassandra-openebs-node-1 2/2 Running 0 3m2s
Expand All @@ -104,7 +106,7 @@ kubectl kudo install cassandra --namespace=$namespace_name --instance $instance_
statefulset.apps/cassandra 3/3 6m35s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/cassandra ClusterIP None <none> 7000/TCP,7001/TCP,7199/TCP,9042/TCP,9160/TCP 6m35s
service/cassandra-openebs-svc ClusterIP None <none> 7000/TCP,7001/TCP,7199/TCP,9042/TCP,9160/TCP 6m35s
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
var-lib-cassandra-cassandra-openebs-node-0 Bound pvc-213f2cfb-231f-4f14-be93-69c3d1c6d5d7 20Gi RWO openebs-device 20m
Expand All @@ -113,68 +115,73 @@ kubectl kudo install cassandra --namespace=$namespace_name --instance $instance_
```
- Login to one of the Cassandra pod to verify the Cassandra cluster health status using the following command.
```
kubectl exec -it cassandra-openebs-node-0 -n cassandra -- nodetool status
$ kubectl exec -it cassandra-openebs-node-0 bash -n cassandra
cassandra@cassandra-openebs-node-0:/$ nodetool status
Datacenter: datacenter1
=======================
Status=Up/Down |/ State=Normal/Leaving/Joining/Moving -- Address Load Tokens Owns (effective) Host ID Rack
UN 192.168.30.24 94.21 KiB 256 63.0% 73c54856-f045-48db-b0db-e6a751d005f8 rack1
UN 192.168.93.31 75.12 KiB 256 65.3% d48c61b7-551b-4805-b8cc-b915d039f298 rack1
UN 192.168.56.80 75 KiB 256 71.7% 91fc4107-e447-4605-8cbf-3916f9fd8abf rack1
```

- Create a Test Keyspace with Tables. Login to one of the Cassandra pod and run the following commands from a cassandra pod.
```
$cqlsh <svc-name>.<namespace>.svc.cluster.local
cassandra@cassandra-openebs-node-0:/$ cqlsh <svc-name>.<namespace>.svc.cluster.local
```
Example command:
```
$cqlsh cassandra.cassandra.svc.cluster.local
Warning: Cannot create directory at `/home/cassandra/.cassandra`. Command history will not be saved.
Connected to cassandra at cassandra.cassandra.svc.cluster.local:9042.
[cqlsh 5.0.1 | Cassandra 3.11.5 | CQL spec 3.4.4 | Native protocol v4]
cassandra@cassandra-openebs-node-0:/$ cqlsh cassandra-openebs-svc.cassandra.svc.cluster.local
Connected to cassandra-openebs at cassandra-openebs-svc.cassandra.svc.cluster.local:9042.
[cqlsh 5.0.1 | Cassandra 3.11.6 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh>
```

- Creating a Keyspace. Now, let’s create a Keyspace and add a table with some entries into it.
```
$ cassandra@cqlsh> create keyspace dev
cqlsh> create keyspace dev
... with replication = {'class':'SimpleStrategy','replication_factor':1};
- Creating Data Objects
```
$cassandra@cqlsh> use dev;
cassandra@cqlsh:dev> create table emp (empid int primary key,
cqlsh> use dev;
cqlsh:dev> create table emp (empid int primary key,
... emp_first varchar, emp_last varchar, emp_dept varchar);

- Inserting and Querying Data
```
$cassandra@cqlsh:dev> insert into emp (empid, emp_first, emp_last, emp_dept)
$ cqlsh:dev> insert into emp (empid, emp_first, emp_last, emp_dept)
... values (1,'fred','smith','eng');
$cassandra@cqlsh:dev> select * from emp;
$ cqlsh:dev> select * from emp;
empid | emp_dept | emp_first | emp_last
-------+----------+-----------+----------
1 | eng | fred | smith
(1 rows)
- Updating a data
```
$cassandra@cqlsh:dev> update emp set emp_dept = 'fin' where empid = 1;
$cassandra@cqlsh:dev> select * from emp;
empid | emp_dept | emp_first | emp_last
-------+----------+-----------+----------
1 | fin | fred | smith
(1 rows)
```
```
$ cqlsh:dev> update emp set emp_dept = 'fin' where empid = 1;
$ cqlsh:dev> select * from emp;
empid | emp_dept | emp_first | emp_last
-------+----------+-----------+----------
1 | fin | fred | smith
(1 rows)
cqlsh:dev> exit
```
### Testing Cassandra Performance on OpenEBS
- Login to one of the cassandra pod and run the following sample loadgen command to write and read some entry to and from the database.
```
$kubectl exec -it cassandra-openebs-node-0 bash -n cassandra
$ kubectl exec -it cassandra-openebs-node-0 bash -n cassandra
```
- Get the database health status
```
$nodetool status
$ nodetool status
Datacenter: datacenter1
=======================
Status=Up/Down
Expand All @@ -183,6 +190,10 @@ kubectl kudo install cassandra --namespace=$namespace_name --instance $instance_
UN 192.168.7.79 189.98 MiB 256 36.3% 5f6176f5-c47f-4d12-bd16-c9427baf68a0 rack1
UN 192.168.70.87 127.46 MiB 256 31.2% da31ba66-42dd-4c85-a212-a0cb828bbefb rack1
```
- Go to the directory where the binary is located.
```
cassandra@cassandra-openebs-node-0:/$ cd /opt/cassandra/tools/bin
```
- Run Write load
```
cassandra@cassandra-openebs-node-0:/opt/cassandra/tools/bin$ ./cassandra-stress write n=1000000 -rate threads=50 -node 192.168.52.94
Expand Down

0 comments on commit 0650606

Please sign in to comment.