You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Jens Rantil <je...@tink.se> on 2016/11/02 21:20:38 UTC

Backup restore with a different name

Hi,

Let's say I am periodically making snapshots of a table, say "users", for
backup purposes. Let's say a developer makes a mistake and corrupts the
table. Is there an easy way for me to restore a replica, say
"users_20161102", of the original table for the developer to looks at the
old copy?

Cheers,
Jens

-- 
Jens Rantil
Backend engineer
Tink AB

Email: jens.rantil@tink.se
Phone: +46 708 84 18 32
Web: www.tink.se

Facebook <https://www.facebook.com/#!/tink.se> Linkedin
<http://www.linkedin.com/company/2735919?trk=vsrp_companies_res_photo&trkInfo=VSRPsearchId%3A1057023381369207406670%2CVSRPtargetId%3A2735919%2CVSRPcmpt%3Aprimary>
 Twitter <https://twitter.com/tink>

Re: Backup restore with a different name

Posted by Jens Rantil <je...@tink.se>.
Thanks Anubhav,

Looks like a Java project without any documentation whatsoever ;) How do I
use the tool? What does it do?

Cheers,
Jens

On Wed, Nov 2, 2016 at 11:36 AM, Anubhav Kale <An...@microsoft.com>
wrote:

> You would have to build some logic on top of what’s natively supported.
>
>
>
> Here is an option: https://github.com/anubhavkale/CassandraTools/
> tree/master/BackupRestore
>
>
>
>
>
> *From:* Jens Rantil [mailto:jens.rantil@tink.se]
> *Sent:* Wednesday, November 2, 2016 2:21 PM
> *To:* Cassandra Group <us...@cassandra.apache.org>
> *Subject:* Backup restore with a different name
>
>
>
> Hi,
>
>
>
> Let's say I am periodically making snapshots of a table, say "users", for
> backup purposes. Let's say a developer makes a mistake and corrupts the
> table. Is there an easy way for me to restore a replica, say
> "users_20161102", of the original table for the developer to looks at the
> old copy?
>
>
>
> Cheers,
>
> Jens
>
>
>
> --
>
> Jens Rantil
>
> Backend engineer
>
> Tink AB
>
>
>
> Email: jens.rantil@tink.se
>
> Phone: +46 708 84 18 32
>
> Web: www.tink.se
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.tink.se%2F&data=02%7C01%7CAnubhav.Kale%40microsoft.com%7Cb96c56bb385a4b769ef508d403662a7c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636137184724447397&sdata=Vg7mNwD7Wcvyui1HSugueVv4GAc7961mWXUYMR0cE%2B4%3D&reserved=0>
>
>
>
> Facebook
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.facebook.com%2F%23!%2Ftink.se&data=02%7C01%7CAnubhav.Kale%40microsoft.com%7Cb96c56bb385a4b769ef508d403662a7c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636137184724457399&sdata=JD11Q5%2FlsE0nUZLoq%2FTI3tYKh3nZgNnlU8uCSBOJEOQ%3D&reserved=0>
>  Linkedin
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fcompany%2F2735919%3Ftrk%3Dvsrp_companies_res_photo%26trkInfo%3DVSRPsearchId%253A1057023381369207406670%252CVSRPtargetId%253A2735919%252CVSRPcmpt%253Aprimary&data=02%7C01%7CAnubhav.Kale%40microsoft.com%7Cb96c56bb385a4b769ef508d403662a7c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636137184724457399&sdata=z3yBN1NQpgEfjR2G5O4mwWE5GVw1ziIgj80v2%2FBIkB4%3D&reserved=0>
>  Twitter
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftwitter.com%2Ftink&data=02%7C01%7CAnubhav.Kale%40microsoft.com%7Cb96c56bb385a4b769ef508d403662a7c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636137184724457399&sdata=yo9FEAlRW6LdH5fsm4YdZoYLn6VvSt0h0iZCSEl2avY%3D&reserved=0>
>



-- 
Jens Rantil
Backend engineer
Tink AB

Email: jens.rantil@tink.se
Phone: +46 708 84 18 32
Web: www.tink.se

Facebook <https://www.facebook.com/#!/tink.se> Linkedin
<http://www.linkedin.com/company/2735919?trk=vsrp_companies_res_photo&trkInfo=VSRPsearchId%3A1057023381369207406670%2CVSRPtargetId%3A2735919%2CVSRPcmpt%3Aprimary>
 Twitter <https://twitter.com/tink>

RE: Backup restore with a different name

Posted by Anubhav Kale <An...@microsoft.com>.
You would have to build some logic on top of what’s natively supported.

Here is an option: https://github.com/anubhavkale/CassandraTools/tree/master/BackupRestore


From: Jens Rantil [mailto:jens.rantil@tink.se]
Sent: Wednesday, November 2, 2016 2:21 PM
To: Cassandra Group <us...@cassandra.apache.org>
Subject: Backup restore with a different name

Hi,

Let's say I am periodically making snapshots of a table, say "users", for backup purposes. Let's say a developer makes a mistake and corrupts the table. Is there an easy way for me to restore a replica, say "users_20161102", of the original table for the developer to looks at the old copy?

Cheers,
Jens

--
Jens Rantil
Backend engineer
Tink AB

Email: jens.rantil@tink.se<ma...@tink.se>
Phone: +46 708 84 18 32
Web: www.tink.se<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.tink.se%2F&data=02%7C01%7CAnubhav.Kale%40microsoft.com%7Cb96c56bb385a4b769ef508d403662a7c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636137184724447397&sdata=Vg7mNwD7Wcvyui1HSugueVv4GAc7961mWXUYMR0cE%2B4%3D&reserved=0>

Facebook<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.facebook.com%2F%23!%2Ftink.se&data=02%7C01%7CAnubhav.Kale%40microsoft.com%7Cb96c56bb385a4b769ef508d403662a7c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636137184724457399&sdata=JD11Q5%2FlsE0nUZLoq%2FTI3tYKh3nZgNnlU8uCSBOJEOQ%3D&reserved=0> Linkedin<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fcompany%2F2735919%3Ftrk%3Dvsrp_companies_res_photo%26trkInfo%3DVSRPsearchId%253A1057023381369207406670%252CVSRPtargetId%253A2735919%252CVSRPcmpt%253Aprimary&data=02%7C01%7CAnubhav.Kale%40microsoft.com%7Cb96c56bb385a4b769ef508d403662a7c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636137184724457399&sdata=z3yBN1NQpgEfjR2G5O4mwWE5GVw1ziIgj80v2%2FBIkB4%3D&reserved=0> Twitter<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftwitter.com%2Ftink&data=02%7C01%7CAnubhav.Kale%40microsoft.com%7Cb96c56bb385a4b769ef508d403662a7c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636137184724457399&sdata=yo9FEAlRW6LdH5fsm4YdZoYLn6VvSt0h0iZCSEl2avY%3D&reserved=0>

Re: Backup restore with a different name

Posted by kurt Greaves <ku...@instaclustr.com>.
On 2 November 2016 at 22:10, Jens Rantil <je...@tink.se> wrote:

> I mean "exposing that state for reference while keeping the (corrupt)
> current state in the live cluster".


The following should work:


   1. Create a new table with the same schema but different name (in the
   same or a different keyspace).
   2. Rename all the snapshotted SSTables to match the *new* table name.
   3. Copy SSTables into new table directory.
   4. nodetool refresh or restart Cassandra.


Kurt Greaves
kurt@instaclustr.com
www.instaclustr.com

Re: Backup restore with a different name

Posted by Rajath Subramanyam <ra...@gmail.com>.
Hi Jens,

Looks like what you need is an "any point in time" recovery solution. I
suggest that you go back to the snapshot that you issued that was closest
to "20161102" and restore that snapshot using the bulk loader to a new
table called "users_20161102". If you need to recover precisely to a
particular timestamp, you might have to parse every row in the SSTable and
filter out some rows.

Btw, we at Datos IO are working on exactly this solution. We have built a
data protection software for scale-out databases called RecoverX. We also
support Cassandra. One of the features that RecoverX supports is a repair
free recovery/restore that allows you to go back any point in time.

If you need more information, visit our website datos.io or drop us a note
at info@datos.io, joe.schwartz@datos.io.

Hope this helps.

Full disclaimer: I am an engineer at Datos.io.

Regards,
Rajath

------------------------
Rajath Subramanyam


On Wed, Nov 2, 2016 at 3:10 PM, Jens Rantil <je...@tink.se> wrote:

> Bryan,
>
> On Wed, Nov 2, 2016 at 11:38 AM, Bryan Cheng <br...@blockcypher.com>
> wrote:
>
>> do you mean restoring the cluster to that state, or just exposing that
>> state for reference while keeping the (corrupt) current state in the live
>> cluster?
>
>
> I mean "exposing that state for reference while keeping the (corrupt)
> current state in the live cluster".
>
> Cheers,
> Jens
>
> --
> Jens Rantil
> Backend engineer
> Tink AB
>
> Email: jens.rantil@tink.se
> Phone: +46 708 84 18 32
> Web: www.tink.se
>
> Facebook <https://www.facebook.com/#!/tink.se> Linkedin
> <http://www.linkedin.com/company/2735919?trk=vsrp_companies_res_photo&trkInfo=VSRPsearchId%3A1057023381369207406670%2CVSRPtargetId%3A2735919%2CVSRPcmpt%3Aprimary>
>  Twitter <https://twitter.com/tink>
>

Re: Backup restore with a different name

Posted by Jens Rantil <je...@tink.se>.
Bryan,

On Wed, Nov 2, 2016 at 11:38 AM, Bryan Cheng <br...@blockcypher.com> wrote:

> do you mean restoring the cluster to that state, or just exposing that
> state for reference while keeping the (corrupt) current state in the live
> cluster?


I mean "exposing that state for reference while keeping the (corrupt)
current state in the live cluster".

Cheers,
Jens

-- 
Jens Rantil
Backend engineer
Tink AB

Email: jens.rantil@tink.se
Phone: +46 708 84 18 32
Web: www.tink.se

Facebook <https://www.facebook.com/#!/tink.se> Linkedin
<http://www.linkedin.com/company/2735919?trk=vsrp_companies_res_photo&trkInfo=VSRPsearchId%3A1057023381369207406670%2CVSRPtargetId%3A2735919%2CVSRPcmpt%3Aprimary>
 Twitter <https://twitter.com/tink>

Re: Backup restore with a different name

Posted by Bryan Cheng <br...@blockcypher.com>.
Hi Jens,

When you refer to restoring a snapshot for a developer to look at, do you
mean restoring the cluster to that state, or just exposing that state for
reference while keeping the (corrupt) current state in the live cluster?

You may find these useful:
https://docs.datastax.com/en/cassandra/2.1/cassandra/operations/ops_backup_snapshot_restore_t.html
https://docs.datastax.com/en/cassandra/2.1/cassandra/operations/ops_snapshot_restore_new_cluster.html

Additionally, AFAIK the snapshot files are just SSTables, so any utility
that can examine them (for example, sstable2json) should work on those
files as well.

On Wed, Nov 2, 2016 at 2:20 PM, Jens Rantil <je...@tink.se> wrote:

> Hi,
>
> Let's say I am periodically making snapshots of a table, say "users", for
> backup purposes. Let's say a developer makes a mistake and corrupts the
> table. Is there an easy way for me to restore a replica, say
> "users_20161102", of the original table for the developer to looks at the
> old copy?
>
> Cheers,
> Jens
>
> --
> Jens Rantil
> Backend engineer
> Tink AB
>
> Email: jens.rantil@tink.se
> Phone: +46 708 84 18 32
> Web: www.tink.se
>
> Facebook <https://www.facebook.com/#!/tink.se> Linkedin
> <http://www.linkedin.com/company/2735919?trk=vsrp_companies_res_photo&trkInfo=VSRPsearchId%3A1057023381369207406670%2CVSRPtargetId%3A2735919%2CVSRPcmpt%3Aprimary>
>  Twitter <https://twitter.com/tink>
>

RE: Backup restore with a different name

Posted by Michael Laws <mi...@arrayent.com>.
Hi Jens – I put together a couple of simple scripts a couple of years ago
that might do exactly what you need.  These leverage nodetool snapshot and
sstableloader to create keyspace snapshots, collect up all the necessary
SSTable files in an easy-to-move file, rename the keyspace, restore it to
the same or a different cluster, etc.  Might be useful…
https://github.com/AppliedInfrastructure/cassandra-snapshot-tools



Mike



*From:* Jens Rantil [mailto:jens.rantil@tink.se]
*Sent:* Wednesday, November 2, 2016 2:21 PM
*To:* Cassandra Group <us...@cassandra.apache.org>
*Subject:* Backup restore with a different name



Hi,



Let's say I am periodically making snapshots of a table, say "users", for
backup purposes. Let's say a developer makes a mistake and corrupts the
table. Is there an easy way for me to restore a replica, say
"users_20161102", of the original table for the developer to looks at the
old copy?



Cheers,

Jens



-- 

Jens Rantil

Backend engineer

Tink AB



Email: jens.rantil@tink.se

Phone: +46 708 84 18 32

Web: www.tink.se



Facebook <https://www.facebook.com/#!/tink.se> Linkedin
<http://www.linkedin.com/company/2735919?trk=vsrp_companies_res_photo&trkInfo=VSRPsearchId%3A1057023381369207406670%2CVSRPtargetId%3A2735919%2CVSRPcmpt%3Aprimary>
 Twitter <https://twitter.com/tink>