Open chenweisomebody126 opened 1 year ago
Hi @chenweisomebody126,
yes, Cassandra pods are controlled by statefulsets. This means the data gets persisted between pod restarts.
We expose the capability of stopping datacenters through the datacenters[].stopped
field: https://docs.k8ssandra.io/reference/crd/k8ssandra-operator-crds-latest/#k8ssandraclusterspeccassandradatacentersindex
So you can create a cluster, let it run as long as needed, then stop its Cassandra pods by setting the stopped flag to true
. Then remove the flag to get it running again. It will re-attach the PVs if they are still available (which depends on your storage classes and PV management).
Hi @chenweisomebody126,
yes, Cassandra pods are controlled by statefulsets. This means the data gets persisted between pod restarts. We expose the capability of stopping datacenters through the
datacenters[].stopped
field: https://docs.k8ssandra.io/reference/crd/k8ssandra-operator-crds-latest/#k8ssandraclusterspeccassandradatacentersindexSo you can create a cluster, let it run as long as needed, then stop its Cassandra pods by setting the stopped flag to
true
. Then remove the flag to get it running again. It will re-attach the PVs if they are still available (which depends on your storage classes and PV management).
If I understand correctly, we can turn on and off the Cassandra pods but need to leave the cluster running, right? I was wondering if we allow turnning down the cluster to save instance cost and then spin up the cluster on-demand and mount the long-existing PV, e.g. azure blob storage to the stateful set.
Sure, as long as your etcd is persisted between restarts of the cluster. There could be some implementation specific details, so that's something to experiment first.
@adejanovski Thanks! Another follow-up question would be, do we have an answer for this https://forum.k8ssandra.io/t/k8ssandra-cluster-horizontal-autoscaling/441?
Thanks for answering these. One last question.
@adejanovski Do we have a trigger-based approach to set the stopped
flag to true
for Cassandra pods? Imagine, we have a kafka event or even an api call as a trigger, How to make K8s set the stopped
flag?
You have to build the automation interact with the k8s API to patch the K8ssandraCluster spec and set the stopped
flag to true
.
What is missing? My end goal is to have Cassandra turn on and off in an on-demand fashion and all data are persisted in a long-standing Persistent Volume. Do we support it now?
Why do we need it? Our usage case is that we expect to set up Cassandra when someone pays for it.
┆Issue is synchronized with this Jira Story by Unito ┆Issue Number: K8OP-77