github.com/microsoft/fabrikate@v1.0.0-alpha.1.0.20210115014322-dc09194d0885/testdata/generate/infra/fabrikate-jaeger/helm_repos/jaeger/charts/cassandra/README.md (about) 1 # Cassandra 2 A Cassandra Chart for Kubernetes 3 4 ## Install Chart 5 To install the Cassandra Chart into your Kubernetes cluster (This Chart requires persistent volume by default, you may need to create a storage class before install chart. To create storage class, see [Persist data](#persist_data) section) 6 7 ```bash 8 helm install --namespace "cassandra" -n "cassandra" incubator/cassandra 9 ``` 10 11 After installation succeeds, you can get a status of Chart 12 13 ```bash 14 helm status "cassandra" 15 ``` 16 17 If you want to delete your Chart, use this command 18 ```bash 19 helm delete --purge "cassandra" 20 ``` 21 22 ## Upgrading 23 24 To upgrade your Cassandra release, simply run 25 26 ```bash 27 helm upgrade "cassandra" incubator/cassandra 28 ``` 29 30 ### 0.12.0 31 32 This version fixes https://github.com/helm/charts/issues/7803 by removing mutable labels in `spec.VolumeClaimTemplate.metadata.labels` so that it is upgradable. 33 34 Until this version, in order to upgrade, you have to delete the Cassandra StatefulSet before upgrading: 35 ```bash 36 $ kubectl delete statefulset --cascade=false my-cassandra-release 37 ``` 38 39 40 ## Persist data 41 You need to create `StorageClass` before able to persist data in persistent volume. 42 To create a `StorageClass` on Google Cloud, run the following 43 44 ```bash 45 kubectl create -f sample/create-storage-gce.yaml 46 ``` 47 48 And set the following values in `values.yaml` 49 50 ```yaml 51 persistence: 52 enabled: true 53 ``` 54 55 If you want to create a `StorageClass` on other platform, please see documentation here [https://kubernetes.io/docs/user-guide/persistent-volumes/](https://kubernetes.io/docs/user-guide/persistent-volumes/) 56 57 When running a cluster without persistence, the termination of a pod will first initiate a decommissioning of that pod. 58 Depending on the amount of data stored inside the cluster this may take a while. In order to complete a graceful 59 termination, pods need to get more time for it. Set the following values in `values.yaml`: 60 61 ```yaml 62 podSettings: 63 terminationGracePeriodSeconds: 1800 64 ``` 65 66 ## Install Chart with specific cluster size 67 By default, this Chart will create a cassandra with 3 nodes. If you want to change the cluster size during installation, you can use `--set config.cluster_size={value}` argument. Or edit `values.yaml` 68 69 For example: 70 Set cluster size to 5 71 72 ```bash 73 helm install --namespace "cassandra" -n "cassandra" --set config.cluster_size=5 incubator/cassandra/ 74 ``` 75 76 ## Install Chart with specific resource size 77 By default, this Chart will create a cassandra with CPU 2 vCPU and 4Gi of memory which is suitable for development environment. 78 If you want to use this Chart for production, I would recommend to update the CPU to 4 vCPU and 16Gi. Also increase size of `max_heap_size` and `heap_new_size`. 79 To update the settings, edit `values.yaml` 80 81 ## Install Chart with specific node 82 Sometime you may need to deploy your cassandra to specific nodes to allocate resources. You can use node selector by edit `nodes.enabled=true` in `values.yaml` 83 For example, you have 6 vms in node pools and you want to deploy cassandra to node which labeled as `cloud.google.com/gke-nodepool: pool-db` 84 85 Set the following values in `values.yaml` 86 87 ```yaml 88 nodes: 89 enabled: true 90 selector: 91 nodeSelector: 92 cloud.google.com/gke-nodepool: pool-db 93 ``` 94 95 ## Configuration 96 97 The following table lists the configurable parameters of the Cassandra chart and their default values. 98 99 | Parameter | Description | Default | 100 | ----------------------- | --------------------------------------------- | ---------------------------------------------------------- | 101 | `image.repo` | `cassandra` image repository | `cassandra` | 102 | `image.tag` | `cassandra` image tag | `3.11.5` | 103 | `image.pullPolicy` | Image pull policy | `Always` if `imageTag` is `latest`, else `IfNotPresent` | 104 | `image.pullSecrets` | Image pull secrets | `nil` | 105 | `config.cluster_domain` | The name of the cluster domain. | `cluster.local` | 106 | `config.cluster_name` | The name of the cluster. | `cassandra` | 107 | `config.cluster_size` | The number of nodes in the cluster. | `3` | 108 | `config.seed_size` | The number of seed nodes used to bootstrap new clients joining the cluster. | `2` | 109 | `config.seeds` | The comma-separated list of seed nodes. | Automatically generated according to `.Release.Name` and `config.seed_size` | 110 | `config.num_tokens` | Initdb Arguments | `256` | 111 | `config.dc_name` | Initdb Arguments | `DC1` | 112 | `config.rack_name` | Initdb Arguments | `RAC1` | 113 | `config.endpoint_snitch` | Initdb Arguments | `SimpleSnitch` | 114 | `config.max_heap_size` | Initdb Arguments | `2048M` | 115 | `config.heap_new_size` | Initdb Arguments | `512M` | 116 | `config.ports.cql` | Initdb Arguments | `9042` | 117 | `config.ports.thrift` | Initdb Arguments | `9160` | 118 | `config.ports.agent` | The port of the JVM Agent (if any) | `nil` | 119 | `config.start_rpc` | Initdb Arguments | `false` | 120 | `configOverrides` | Overrides config files in /etc/cassandra dir | `{}` | 121 | `commandOverrides` | Overrides default docker command | `[]` | 122 | `argsOverrides` | Overrides default docker args | `[]` | 123 | `env` | Custom env variables | `{}` | 124 | `schedulerName` | Name of k8s scheduler (other than the default) | `nil` | 125 | `persistence.enabled` | Use a PVC to persist data | `true` | 126 | `persistence.storageClass` | Storage class of backing PVC | `nil` (uses alpha storage class annotation) | 127 | `persistence.accessMode` | Use volume as ReadOnly or ReadWrite | `ReadWriteOnce` | 128 | `persistence.size` | Size of data volume | `10Gi` | 129 | `resources` | CPU/Memory resource requests/limits | Memory: `4Gi`, CPU: `2` | 130 | `service.type` | k8s service type exposing ports, e.g. `NodePort`| `ClusterIP` | 131 | `service.annotations` | Annotations to apply to cassandra service | `""` | 132 | `podManagementPolicy` | podManagementPolicy of the StatefulSet | `OrderedReady` | 133 | `podDisruptionBudget` | Pod distruption budget | `{}` | 134 | `podAnnotations` | pod annotations for the StatefulSet | `{}` | 135 | `updateStrategy.type` | UpdateStrategy of the StatefulSet | `OnDelete` | 136 | `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `90` | 137 | `livenessProbe.periodSeconds` | How often to perform the probe | `30` | 138 | `livenessProbe.timeoutSeconds` | When the probe times out | `5` | 139 | `livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` | 140 | `livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `3` | 141 | `readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `90` | 142 | `readinessProbe.periodSeconds` | How often to perform the probe | `30` | 143 | `readinessProbe.timeoutSeconds` | When the probe times out | `5` | 144 | `readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` | 145 | `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `3` | 146 | `readinessProbe.address` | Address to use for checking node has joined the cluster and is ready. | `${POD_IP}` | 147 | `rbac.create` | Specifies whether RBAC resources should be created | `true` | 148 | `serviceAccount.create` | Specifies whether a ServiceAccount should be created | `true` | 149 | `serviceAccount.name` | The name of the ServiceAccount to use | | 150 | `backup.enabled` | Enable backup on chart installation | `false` | 151 | `backup.schedule` | Keyspaces to backup, each with cron time | | 152 | `backup.annotations` | Backup pod annotations | iam.amazonaws.com/role: `cain` | 153 | `backup.image.repository` | Backup image repository | `maorfr/cain` | 154 | `backup.image.tag` | Backup image tag | `0.6.0` | 155 | `backup.extraArgs` | Additional arguments for cain | `[]` | 156 | `backup.env` | Backup environment variables | AWS_REGION: `us-east-1` | 157 | `backup.resources` | Backup CPU/Memory resource requests/limits | Memory: `1Gi`, CPU: `1` | 158 | `backup.destination` | Destination to store backup artifacts | `s3://bucket/cassandra` | 159 | `backup.google.serviceAccountSecret` | Secret containing credentials if GCS is used as destination | | 160 | `exporter.enabled` | Enable Cassandra exporter | `false` | 161 | `exporter.servicemonitor.enabled` | Enable ServiceMonitor for exporter | `true` | 162 | `exporter.servicemonitor.additionalLabels`| Additional labels for Service Monitor | `{}` | 163 | `exporter.image.repo` | Exporter image repository | `criteord/cassandra_exporter` | 164 | `exporter.image.tag` | Exporter image tag | `2.0.2` | 165 | `exporter.port` | Exporter port | `5556` | 166 | `exporter.jvmOpts` | Exporter additional JVM options | | 167 | `exporter.resources` | Exporter CPU/Memory resource requests/limits | `{}` | 168 | `extraContainers` | Sidecar containers for the pods | `[]` | 169 | `extraVolumes` | Additional volumes for the pods | `[]` | 170 | `extraVolumeMounts` | Extra volume mounts for the pods | `[]` | 171 | `affinity` | Kubernetes node affinity | `{}` | 172 | `tolerations` | Kubernetes node tolerations | `[]` | 173 174 175 ## Scale cassandra 176 When you want to change the cluster size of your cassandra, you can use the helm upgrade command. 177 178 ```bash 179 helm upgrade --set config.cluster_size=5 cassandra incubator/cassandra 180 ``` 181 182 ## Get cassandra status 183 You can get your cassandra cluster status by running the command 184 185 ```bash 186 kubectl exec -it --namespace cassandra $(kubectl get pods --namespace cassandra -l app=cassandra-cassandra -o jsonpath='{.items[0].metadata.name}') nodetool status 187 ``` 188 189 Output 190 ```bash 191 Datacenter: asia-east1 192 ====================== 193 Status=Up/Down 194 |/ State=Normal/Leaving/Joining/Moving 195 -- Address Load Tokens Owns (effective) Host ID Rack 196 UN 10.8.1.11 108.45 KiB 256 66.1% 410cc9da-8993-4dc2-9026-1dd381874c54 a 197 UN 10.8.4.12 84.08 KiB 256 68.7% 96e159e1-ef94-406e-a0be-e58fbd32a830 c 198 UN 10.8.3.6 103.07 KiB 256 65.2% 1a42b953-8728-4139-b070-b855b8fff326 b 199 ``` 200 201 ## Benchmark 202 You can use [cassandra-stress](https://docs.datastax.com/en/cassandra/3.0/cassandra/tools/toolsCStress.html) tool to run the benchmark on the cluster by the following command 203 204 ```bash 205 kubectl exec -it --namespace cassandra $(kubectl get pods --namespace cassandra -l app=cassandra-cassandra -o jsonpath='{.items[0].metadata.name}') cassandra-stress 206 ``` 207 208 Example of `cassandra-stress` argument 209 - Run both read and write with ration 9:1 210 - Operator total 1 million keys with uniform distribution 211 - Use QUORUM for read/write 212 - Generate 50 threads 213 - Generate result in graph 214 - Use NetworkTopologyStrategy with replica factor 2 215 216 ```bash 217 cassandra-stress mixed ratio\(write=1,read=9\) n=1000000 cl=QUORUM -pop dist=UNIFORM\(1..1000000\) -mode native cql3 -rate threads=50 -log file=~/mixed_autorate_r9w1_1M.log -graph file=test2.html title=test revision=test2 -schema "replication(strategy=NetworkTopologyStrategy, factor=2)" 218 ```