Cassandra备份(包括架构) [英] Cassandra backup including schema

查看:90
本文介绍了Cassandra备份(包括架构)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我感兴趣的备份技术有两种:

There are two types of backup techniques I am interested in:

a)SCHEMA备份,用于恢复数据库架构(添加或删除列,更改列的类型,添加表等)

a) SCHEMA backup, which recover database schema (add or remove column, change type of column, add table, etc)

b)数据备份,用于恢复数据(更新,从一个表读取到另一个表).

b) DATA backup, which recover data (update, read from one table to another).

让我通过示例进行解释:

Let me explain by example:

  1. 首先,我创建实体客户"

客户

|id |名称|

|11 |杰克|

  1. 现在我使用nodetool创建快照
  2. 之后,我更改了表,添加了新列"test"


|id |名称|测试|

|11 |杰克|值|

  1. 使用nodetool制作第二张快照
  2. 现在,我尝试通过将快照数据复制到正确的目录(
  1. Make a second snapshot using the nodetool
  2. Now I try to recover the first snapshot by copying the snapshot data in the correct directory (as described here) and unfortunately I get:


|id |名称|测试|

|11 |杰克|NULL |

...而不是预期的...


| id | name | test |

| 11 | jack | NULL |

... instead of the expected ...

如何获得预期的第一张快照?

How can I get the expected first snapshot?

更新1

相关问题:

推荐答案

要以相同状态还原,还需要还原系统键空间.例如,检查system.schema_columns,您将看到表结构.

To restore at the same state you also need to restore the system keyspaces. Check, for instance, system.schema_columns and you will see your table structure.

此外,请记住,如果只想还原一个表,则还需要表架构.因此,在快照之前运行desc表.

Also, have in mind that if you want to restore just one table, you also need the table schema. So, run desc table before the snapshot.

在还原快照之前,您需要适当的架构.

Before restoring the snapshot, you need the schema to be in place.

这篇关于Cassandra备份(包括架构)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆