You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Manu Chadha <ma...@hotmail.com> on 2020/10/07 22:21:02 UTC

Reducing no. of nodes to 0 without losing data

Hi

I have created a Cassandra cluster on Kubernetes using cass-operator on gcp. It is for my personal experimentation. To avoid incurring cost, I want to stop the cluster when I am not using it and start it when I need it without losing data. Is there a way to do so? Would setting number of size to 0 in example-cassdc-minimal.yaml stop the compute resources without losing data? If I change the size to 3 again later, would the existing data be picked?

Thanks
Manu

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10


Re: Reducing no. of nodes to 0 without losing data

Posted by Erick Ramirez <er...@datastax.com>.
I stand corrected. Happy to be schooled by one of the authors of
cass-operator. :)

On Thu, 8 Oct 2020 at 15:54, Christopher Bradford <br...@gmail.com>
wrote:

> This isn’t really a scaling operation. It’s a start / stop operation. In
> my mind scaling the cluster would change the tokens / replicas. Here the
> request seems to be all or nothing.
>
> On a side note scale down operations were merged 3 days ago in PR #265 (
> https://github.com/datastax/cass-operator/pull/265) although there has
> yet to be a release cut with this functionality.
>
> On Thu, Oct 8, 2020 at 12:46 AM Erick Ramirez <er...@datastax.com>
> wrote:
>
>> The cass-operator does not support scaling down at this point, only
>> scaling up. So the operation you're after isn't possible. Cheers!
>>
>>> --
>
> Christopher Bradford
>
>

Re: Reducing no. of nodes to 0 without losing data

Posted by Christopher Bradford <br...@gmail.com>.
This isn’t really a scaling operation. It’s a start / stop operation. In my
mind scaling the cluster would change the tokens / replicas. Here the
request seems to be all or nothing.

On a side note scale down operations were merged 3 days ago in PR #265 (
https://github.com/datastax/cass-operator/pull/265) although there has yet
to be a release cut with this functionality.

On Thu, Oct 8, 2020 at 12:46 AM Erick Ramirez <er...@datastax.com>
wrote:

> The cass-operator does not support scaling down at this point, only
> scaling up. So the operation you're after isn't possible. Cheers!
>
>> --

Christopher Bradford

Re: Reducing no. of nodes to 0 without losing data

Posted by Erick Ramirez <er...@datastax.com>.
The cass-operator does not support scaling down at this point, only scaling
up. So the operation you're after isn't possible. Cheers!

>

RE: Reducing no. of nodes to 0 without losing data

Posted by Manu Chadha <ma...@hotmail.com>.
The operator doesn’t accept 0. Changing the size in example-cass-dc-minimal.yaml doesn't work as I get error `The CassandraDatacenter "dc1" is invalid: spec.size: Invalid value: 1: spec.size in body should be greater than or equal to 1`

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10

From: Oleksandr Shulgin<ma...@zalando.de>
Sent: 08 October 2020 05:40
To: User<ma...@cassandra.apache.org>
Subject: Re: Reducing no. of nodes to 0 without losing data

On Thu, Oct 8, 2020 at 12:21 AM Manu Chadha <ma...@hotmail.com>> wrote:
Hi

I have created a Cassandra cluster on Kubernetes using cass-operator on gcp. It is for my personal experimentation. To avoid incurring cost, I want to stop the cluster when I am not using it and start it when I need it without losing data. Is there a way to do so? Would setting number of size to 0 in example-cassdc-minimal.yaml stop the compute resources without losing data? If I change the size to 3 again later, would the existing data be picked?

Depending if the operator is going to accept the size as 0 at all, but most probably not with the following policy in your storage class, as in the example[1]:

reclaimPolicy: Delete

You need some persistent storage and a suitable reclaim policy.

[1]: https://docs.datastax.com/en/cass-operator/doc/cass-operator/cassOperatorCloserLookConfiguration.html#CreateandapplyaStorageClass

Regards,
--
Alex


RE: Reducing no. of nodes to 0 without losing data

Posted by Manu Chadha <ma...@hotmail.com>.
Tried persistence as well (just table schemas, no data). It works as well across restarts. Next challenge for me is to find out how to backup the data in case there is a cluster wide data loss.

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10

From: Manu Chadha<ma...@hotmail.com>
Sent: 08 October 2020 13:33
To: user@cassandra.apache.org<ma...@cassandra.apache.org>
Subject: RE: Reducing no. of nodes to 0 without losing data

Dear Christopher

I tried the answer and it works (at least the stopping bit). I still need to test persistence bit which to be honest might take time considering that I am more rubbish in K8S than Cassandra.  I had created an question on SO. Please feel free to provide your answer there.

https://stackoverflow.com/questions/64253051/temporarily-stopping-k8s-and-cassandra-cluster?noredirect=1#comment113633984_64253051

thanks
Manu

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10

From: Christopher Bradford<ma...@gmail.com>
Sent: 08 October 2020 05:47
To: user@cassandra.apache.org<ma...@cassandra.apache.org>
Subject: Re: Reducing no. of nodes to 0 without losing data

cass-operator has a parameter spec.stopped (
https://github.com/datastax/cass-operator/blob/master/operator/example-cassdc-yaml/cassandra-3.11.x/example-cassdc-full.yaml#L65) when set to true the underlying stateful sets are scaled down to 0 while keeping the persistent volumes. This allows you to reduce your k8s cluster size while not losing data. When you want to bring the cluster back up change the parameter back to false.

On Thu, Oct 8, 2020 at 12:40 AM Oleksandr Shulgin <ol...@zalando.de>> wrote:
On Thu, Oct 8, 2020 at 12:21 AM Manu Chadha <ma...@hotmail.com>> wrote:
Hi

I have created a Cassandra cluster on Kubernetes using cass-operator on gcp. It is for my personal experimentation. To avoid incurring cost, I want to stop the cluster when I am not using it and start it when I need it without losing data. Is there a way to do so? Would setting number of size to 0 in example-cassdc-minimal.yaml stop the compute resources without losing data? If I change the size to 3 again later, would the existing data be picked?

Depending if the operator is going to accept the size as 0 at all, but most probably not with the following policy in your storage class, as in the example[1]:

reclaimPolicy: Delete

You need some persistent storage and a suitable reclaim policy.

[1]: https://docs.datastax.com/en/cass-operator/doc/cass-operator/cassOperatorCloserLookConfiguration.html#CreateandapplyaStorageClass

Regards,
--
Alex
--

Christopher Bradford




RE: Reducing no. of nodes to 0 without losing data

Posted by Manu Chadha <ma...@hotmail.com>.
Dear Christopher

I tried the answer and it works (at least the stopping bit). I still need to test persistence bit which to be honest might take time considering that I am more rubbish in K8S than Cassandra.  I had created an question on SO. Please feel free to provide your answer there.

https://stackoverflow.com/questions/64253051/temporarily-stopping-k8s-and-cassandra-cluster?noredirect=1#comment113633984_64253051

thanks
Manu

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10

From: Christopher Bradford<ma...@gmail.com>
Sent: 08 October 2020 05:47
To: user@cassandra.apache.org<ma...@cassandra.apache.org>
Subject: Re: Reducing no. of nodes to 0 without losing data

cass-operator has a parameter spec.stopped (
https://github.com/datastax/cass-operator/blob/master/operator/example-cassdc-yaml/cassandra-3.11.x/example-cassdc-full.yaml#L65) when set to true the underlying stateful sets are scaled down to 0 while keeping the persistent volumes. This allows you to reduce your k8s cluster size while not losing data. When you want to bring the cluster back up change the parameter back to false.

On Thu, Oct 8, 2020 at 12:40 AM Oleksandr Shulgin <ol...@zalando.de>> wrote:
On Thu, Oct 8, 2020 at 12:21 AM Manu Chadha <ma...@hotmail.com>> wrote:
Hi

I have created a Cassandra cluster on Kubernetes using cass-operator on gcp. It is for my personal experimentation. To avoid incurring cost, I want to stop the cluster when I am not using it and start it when I need it without losing data. Is there a way to do so? Would setting number of size to 0 in example-cassdc-minimal.yaml stop the compute resources without losing data? If I change the size to 3 again later, would the existing data be picked?

Depending if the operator is going to accept the size as 0 at all, but most probably not with the following policy in your storage class, as in the example[1]:

reclaimPolicy: Delete

You need some persistent storage and a suitable reclaim policy.

[1]: https://docs.datastax.com/en/cass-operator/doc/cass-operator/cassOperatorCloserLookConfiguration.html#CreateandapplyaStorageClass

Regards,
--
Alex
--

Christopher Bradford



Re: Reducing no. of nodes to 0 without losing data

Posted by Christopher Bradford <br...@gmail.com>.
cass-operator has a parameter spec.stopped (
https://github.com/datastax/cass-operator/blob/master/operator/example-cassdc-yaml/cassandra-3.11.x/example-cassdc-full.yaml#L65)
when set to true the underlying stateful sets are scaled down to 0 while
keeping the persistent volumes. This allows you to reduce your k8s cluster
size while not losing data. When you want to bring the cluster back up
change the parameter back to false.

On Thu, Oct 8, 2020 at 12:40 AM Oleksandr Shulgin <
oleksandr.shulgin@zalando.de> wrote:

> On Thu, Oct 8, 2020 at 12:21 AM Manu Chadha <ma...@hotmail.com>
> wrote:
>
>> Hi
>>
>>
>>
>> I have created a Cassandra cluster on Kubernetes using cass-operator on
>> gcp. It is for my personal experimentation. To avoid incurring cost, I
>> want to stop the cluster when I am not using it and start it when I need it
>> without losing data. Is there a way to do so? Would setting number of
>> size to 0 in example-cassdc-minimal.yaml stop the compute resources
>> without losing data? If I change the size to 3 again later, would the
>> existing data be picked?
>>
>
> Depending if the operator is going to accept the size as 0 at all, but
> most probably not with the following policy in your storage class, as in
> the example[1]:
>
> reclaimPolicy: Delete
>
> You need some persistent storage and a suitable reclaim policy.
>
> [1]:
> https://docs.datastax.com/en/cass-operator/doc/cass-operator/cassOperatorCloserLookConfiguration.html#CreateandapplyaStorageClass
>
>
>>
> Regards,
> --
> Alex
>
-- 

Christopher Bradford

Re: Reducing no. of nodes to 0 without losing data

Posted by Oleksandr Shulgin <ol...@zalando.de>.
On Thu, Oct 8, 2020 at 12:21 AM Manu Chadha <ma...@hotmail.com> wrote:

> Hi
>
>
>
> I have created a Cassandra cluster on Kubernetes using cass-operator on
> gcp. It is for my personal experimentation. To avoid incurring cost, I
> want to stop the cluster when I am not using it and start it when I need it
> without losing data. Is there a way to do so? Would setting number of size
>  to 0 in example-cassdc-minimal.yaml stop the compute resources without
> losing data? If I change the size to 3 again later, would the existing
> data be picked?
>

Depending if the operator is going to accept the size as 0 at all, but most
probably not with the following policy in your storage class, as in the
example[1]:

reclaimPolicy: Delete

You need some persistent storage and a suitable reclaim policy.

[1]:
https://docs.datastax.com/en/cass-operator/doc/cass-operator/cassOperatorCloserLookConfiguration.html#CreateandapplyaStorageClass


>
Regards,
--
Alex