nodetool快照也需要架构快照(备份)吗? [英] nodetool snapshot takes schema snapshot (backup) too?

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

问题描述

Cassandra doc 提到了 nodetool snapshot命令获取表数据的快照。但是,我也可以在生成所有快照文件的快照目录中看到schema.cql和manifest.json文件。

Cassandra doc mentions that "nodetool snapshot" command takes snapshot of table data. However, I am also able to see schema.cql and manifest.json file in my snapshot directory where all snapshot files are generated.

这是预期的行为吗?还可以根据需要使用schema.cql文件还原模式吗?

Is this expected behavior? Also can I use this schema.cql file to restore the schema if needed?

我的卡桑德拉版本

cqlsh> show version
[cqlsh 5.0.1 | Cassandra 3.0.9 | CQL spec 3.4.0 | Native protocol v4]

>nodetool version
ReleaseVersion: 3.0.9

编辑:


  1. 在还原数据时是否必须使用快照中的cql文件?假设我已经在其他地方创建了表cql。我可以用吗?
    我执行了一些测试。当我使用快照中的cql重新创建表时,表名称中的ID仍为 employee- 42a71380966111e8870f97a01282a56a 。但是,当我使用原始cql重新创建表格时,表格名称中的ID发生了变化。这可能是一个问题,这就是为什么我们应该从快照中使用cql?
    注-:当我从快照恢复数据时,在上述两种情况下都可以正常加载

  2. 此cql文件用于表。我们可以从快照中获取cql来创建密钥空间吗?

  3. 是否仅为用户定义的表生成cql文件?我看不到为系统表生成cql文件。.

  1. Is it mandatory to use cql file from snapshot while restoring data? Suppose I have create table cql stored somewhere else. Can I use that? I performed some tests. When I re-created table using cql from snapshot, ID in table name remains same "employee-42a71380966111e8870f97a01282a56a". However when I re-created table using my original cql, ID in table name changed. Can this be a problem and that's why we should use cql from snapshot? Note-: When I restored data from snapshot, it loaded fine in both above cases
  2. This cql file is for table. Can we get cql from snapshot to create keyspace?
  3. Does cql file gets generated only for user defined table? I can't see cql file getting generated for system tables..


推荐答案

是的,这些文件是还原此特定表所必需的。并且 schema.cql 在快照时捕获表的结构,因为您需要将快照还原到具有相同结构的表。

Yes, these files are necessary for restoring this particular table. And schema.cql captures the structure of table on the time of the snapshot because you need to restore snapshot to table with the same structure.

您可以找到请参阅DataStax文档中的更详细说明。

You can find more detailed description in the DataStax documentation.

添加更多问题后进行更新:

Update after addition of more questions:


  1. 快照中存在模式使生活变得更轻松-模式经常会演变,并且如果保证模式与快照中的数据匹配,则可以使用非快照模式;

  2. nodetool快照仅生成表的模式

  3. 最好不要弄乱系统表...
  1. Presence of schema in snapshot makes life easier - quite often the schema evolve, and you can use non-snapshot schema if you guarantee that schema will match to data in snapshot;
  2. nodetool snapshot generates only table's schemas
  3. It's better not to mess-up with system tables...

这里是详细的知识库文章有关备份/还原。

Here is detailed knowledge base article from DataStax support about backup/restore.

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

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