github.com/alibaba/sealer@v0.8.6-0.20220430115802-37a2bdaa8173/applications/cassandra/README.md (about) 1 # Overview 2 3 This image chooses OpenEBS LocalPV as its persistence storage engine. 4 5 Components included in this image: 6 7 * 1 StatefulSet with 3 replicas for cassandra cluster which requests "50Gi" storage. 8 9 ## How to use it 10 11 Cassandra can be accessed through the following URLs from within the cluster: 12 13 * CQL: my-cassandra.cassandra-system.svc.cluster.local:9042 14 * Thrift: my-cassandra.cassandra-system.svc.cluster.local:9160 15 16 To get your password run: 17 18 export CASSANDRA_PASSWORD=$(kubectl get secret --namespace "cassandra-system" my-cassandra -o jsonpath=" 19 {.data.cassandra-password}" | base64 --decode) 20 21 Check the cluster status by running: 22 23 kubectl exec -it --namespace cassandra-system $(kubectl get pods --namespace cassandra-system -l 24 app=cassandra,release=my-cassandra -o jsonpath='{.items[0].metadata.name}') nodetool status 25 26 To connect to your Cassandra cluster using CQL: 27 28 1. Run a Cassandra pod that you can use as a client: 29 30 kubectl run --namespace cassandra-system my-cassandra-client --rm --tty -i --restart='Never' \ 31 --env CASSANDRA_PASSWORD=$CASSANDRA_PASSWORD \ 32 \ 33 --image docker.io/bitnami/cassandra:4.0.0-debian-10-r0 -- bash 34 35 2. Connect using the cqlsh client: 36 37 cqlsh -u cassandra -p $CASSANDRA_PASSWORD my-cassandra 38 39 To connect to your database from outside the cluster execute the following commands: 40 41 kubectl port-forward --namespace cassandra-system svc/my-cassandra 9042:9042 & cqlsh -u cassandra -p $CASSANDRA_PASSWORD 42 127.0.0.1 9042 43 44 ## How to rebuild it use helm 45 46 Kubefile: 47 48 ```shell 49 FROM registry.cn-qingdao.aliyuncs.com/sealer-apps/openebs-localpv:2.11.0 50 # add helm repo and run helm install 51 RUN helm repo add bitnami https://charts.bitnami.com/bitnami 52 # set persistence.storageClass=local-hostpath, which is provided by base image openebs-localpv:2.11.0. 53 CMD helm install my-cassandra --create-namespace --namespace cassandra-system --set persistence.storageClass=local-hostpath bitnami/cassandra --version 8.0.3 54 ``` 55 56 run below command to build it 57 58 ```shell 59 sealer build -t {Your Image Name} -f Kubefile -m cloud . 60 ``` 61 62 More parameters see [official document here](https://artifacthub.io/packages/helm/bitnami/cassandra). 63